2023-04-30 11:26:17 -05:00
|
|
|
name: checks
|
|
|
|
on:
|
|
|
|
- pull_request
|
|
|
|
- push
|
|
|
|
|
|
|
|
env:
|
2023-07-11 15:45:49 -05:00
|
|
|
FORGEJO_HOST_PORT: 'forgejo:3000'
|
|
|
|
FORGEJO_ADMIN_USER: 'root'
|
|
|
|
FORGEJO_ADMIN_PASSWORD: 'admin1234'
|
|
|
|
FORGEJO_RUNNER_SECRET: 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
|
|
|
|
FORGEJO_SCRIPT: |
|
|
|
|
/bin/s6-svscan /etc/s6 & sleep 10 ; su -c "forgejo admin user create --admin --username $FORGEJO_ADMIN_USER --password $FORGEJO_ADMIN_PASSWORD --email root@example.com" git && su -c "forgejo forgejo-cli actions register --labels docker --name therunner --secret $FORGEJO_RUNNER_SECRET" git && sleep infinity
|
2023-04-30 11:26:17 -05:00
|
|
|
GOPROXY: https://goproxy.io,direct
|
|
|
|
|
|
|
|
jobs:
|
2023-07-11 15:45:49 -05:00
|
|
|
tests:
|
2023-04-30 11:26:17 -05:00
|
|
|
name: check and test
|
|
|
|
if: github.repository_owner != 'forgejo-integration' && github.repository_owner != 'forgejo-experimental' && github.repository_owner != 'forgejo-release'
|
2023-07-11 15:45:49 -05:00
|
|
|
runs-on: docker
|
|
|
|
|
|
|
|
services:
|
|
|
|
forgejo:
|
|
|
|
image: codeberg.org/forgejo-integration/forgejo:1.20.0-4-rc2
|
|
|
|
env:
|
|
|
|
FORGEJO__security__INSTALL_LOCK: "true"
|
|
|
|
FORGEJO__log__LEVEL: "debug"
|
|
|
|
FORGEJO__actions__ENABLED: "true"
|
|
|
|
FORGEJO_ADMIN_USER: ${{ env.FORGEJO_ADMIN_USER }}
|
|
|
|
FORGEJO_ADMIN_PASSWORD: ${{ env.FORGEJO_ADMIN_PASSWORD }}
|
|
|
|
FORGEJO_RUNNER_SECRET: ${{ env.FORGEJO_RUNNER_SECRET }}
|
|
|
|
cmd:
|
|
|
|
- 'bash'
|
|
|
|
- '-c'
|
|
|
|
- ${{ env.FORGEJO_SCRIPT }}
|
|
|
|
|
2023-04-30 11:26:17 -05:00
|
|
|
steps:
|
|
|
|
- uses: actions/setup-go@v3
|
|
|
|
with:
|
2023-05-30 04:47:06 -05:00
|
|
|
go-version: '1.21'
|
2023-07-11 15:45:49 -05:00
|
|
|
|
2023-04-30 11:26:17 -05:00
|
|
|
- uses: actions/checkout@v3
|
2023-07-11 15:45:49 -05:00
|
|
|
|
|
|
|
- run: make vet
|
|
|
|
|
|
|
|
- run: make build
|
|
|
|
|
|
|
|
- name: check the forgejo server is responding
|
|
|
|
run: |
|
|
|
|
set -x
|
|
|
|
apt-get update -qq
|
|
|
|
apt-get install -y -qq jq curl
|
|
|
|
test $FORGEJO_ADMIN_USER = $(curl -sS http://$FORGEJO_ADMIN_USER:$FORGEJO_ADMIN_PASSWORD@$FORGEJO_HOST_PORT/api/v1/user | jq --raw-output .login)
|
|
|
|
|
|
|
|
- run: make FORGEJO_URL=http://$FORGEJO_HOST_PORT test
|