|
| 1 | +name: testing |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - 'forgejo*' |
| 8 | + - 'v*/forgejo*' |
| 9 | + |
| 10 | +jobs: |
| 11 | + lint-backend: |
| 12 | + runs-on: docker |
| 13 | + steps: |
| 14 | + - uses: https://code.forgejo.org/actions/checkout@v3 |
| 15 | + - uses: https://code.forgejo.org/actions/setup-go@v4 |
| 16 | + with: |
| 17 | + go-version: ">=1.20" |
| 18 | + check-latest: true |
| 19 | + - run: make deps-backend deps-tools |
| 20 | + - run: make lint-backend |
| 21 | + env: |
| 22 | + TAGS: bindata sqlite sqlite_unlock_notify |
| 23 | + checks-backend: |
| 24 | + runs-on: docker |
| 25 | + steps: |
| 26 | + - uses: https://code.forgejo.org/actions/checkout@v3 |
| 27 | + - uses: https://code.forgejo.org/actions/setup-go@v4 |
| 28 | + with: |
| 29 | + go-version: ">=1.20" |
| 30 | + check-latest: true |
| 31 | + - run: make deps-backend deps-tools |
| 32 | + - run: make --always-make checks-backend # ensure the "go-licenses" make target runs |
| 33 | + test-unit: |
| 34 | + runs-on: docker |
| 35 | + needs: [lint-backend, checks-backend] |
| 36 | + container: |
| 37 | + image: codeberg.org/forgejo/test_env:main |
| 38 | + steps: |
| 39 | + - uses: https://code.forgejo.org/actions/checkout@v3 |
| 40 | + - uses: https://code.forgejo.org/actions/setup-go@v4 |
| 41 | + with: |
| 42 | + go-version: ">=1.20.0" |
| 43 | + - run: | |
| 44 | + git config --add safe.directory '*' |
| 45 | + chown -R gitea:gitea . /go |
| 46 | + - run: | |
| 47 | + su gitea -c 'make deps-backend' |
| 48 | + - run: | |
| 49 | + su gitea -c 'make backend' |
| 50 | + env: |
| 51 | + TAGS: bindata |
| 52 | + - run: | |
| 53 | + su gitea -c 'make unit-test-coverage test-check' |
| 54 | + timeout-minutes: 50 |
| 55 | + env: |
| 56 | + RACE_ENABLED: 'true' |
| 57 | + TAGS: bindata |
| 58 | + test-mysql: |
| 59 | + runs-on: docker |
| 60 | + needs: [lint-backend, checks-backend] |
| 61 | + container: |
| 62 | + image: codeberg.org/forgejo/test_env:main |
| 63 | + services: |
| 64 | + mysql8: |
| 65 | + image: mysql:8 |
| 66 | + env: |
| 67 | + MYSQL_ALLOW_EMPTY_PASSWORD: yes |
| 68 | + MYSQL_DATABASE: testgitea |
| 69 | + ports: |
| 70 | + - "3306:3306" |
| 71 | + steps: |
| 72 | + - uses: https://code.forgejo.org/actions/checkout@v3 |
| 73 | + - uses: https://code.forgejo.org/actions/setup-go@v4 |
| 74 | + with: |
| 75 | + go-version: ">=1.20.0" |
| 76 | + - run: | |
| 77 | + git config --add safe.directory '*' |
| 78 | + chown -R gitea:gitea . /go |
| 79 | + - run: | |
| 80 | + su gitea -c 'make deps-backend' |
| 81 | + - run: | |
| 82 | + su gitea -c 'make backend' |
| 83 | + env: |
| 84 | + TAGS: bindata |
| 85 | + - run: | |
| 86 | + su gitea -c 'make test-mysql8-migration test-mysql8' |
| 87 | + timeout-minutes: 50 |
| 88 | + env: |
| 89 | + TAGS: bindata |
| 90 | + USE_REPO_TEST_DIR: 1 |
| 91 | + test-pgsql: |
| 92 | + runs-on: docker |
| 93 | + needs: [lint-backend, checks-backend] |
| 94 | + container: |
| 95 | + image: codeberg.org/forgejo/test_env:main |
| 96 | + services: |
| 97 | + pgsql: |
| 98 | + image: postgres:15 |
| 99 | + env: |
| 100 | + POSTGRES_DB: test |
| 101 | + POSTGRES_PASSWORD: postgres |
| 102 | + ports: |
| 103 | + - "5432:5432" |
| 104 | + steps: |
| 105 | + - uses: https://code.forgejo.org/actions/checkout@v3 |
| 106 | + - uses: https://code.forgejo.org/actions/setup-go@v4 |
| 107 | + with: |
| 108 | + go-version: ">=1.20.0" |
| 109 | + - run: | |
| 110 | + git config --add safe.directory '*' |
| 111 | + chown -R gitea:gitea . /go |
| 112 | + - run: | |
| 113 | + su gitea -c 'make deps-backend' |
| 114 | + - run: | |
| 115 | + su gitea -c 'make backend' |
| 116 | + env: |
| 117 | + TAGS: bindata |
| 118 | + - run: | |
| 119 | + su gitea -c 'make test-pgsql-migration test-pgsql' |
| 120 | + timeout-minutes: 50 |
| 121 | + env: |
| 122 | + TAGS: bindata gogit |
| 123 | + RACE_ENABLED: true |
| 124 | + TEST_TAGS: gogit |
| 125 | + USE_REPO_TEST_DIR: 1 |
| 126 | + test-sqlite: |
| 127 | + runs-on: docker |
| 128 | + needs: [lint-backend, checks-backend] |
| 129 | + container: |
| 130 | + image: codeberg.org/forgejo/test_env:main |
| 131 | + steps: |
| 132 | + - uses: https://code.forgejo.org/actions/checkout@v3 |
| 133 | + - uses: https://code.forgejo.org/actions/setup-go@v4 |
| 134 | + with: |
| 135 | + go-version: ">=1.20.0" |
| 136 | + - run: | |
| 137 | + git config --add safe.directory '*' |
| 138 | + chown -R gitea:gitea . /go |
| 139 | + - run: | |
| 140 | + su gitea -c 'make deps-backend' |
| 141 | + - run: | |
| 142 | + su gitea -c 'make backend' |
| 143 | + env: |
| 144 | + TAGS: bindata gogit sqlite sqlite_unlock_notify |
| 145 | + - run: | |
| 146 | + su gitea -c 'make test-sqlite-migration test-sqlite' |
| 147 | + timeout-minutes: 50 |
| 148 | + env: |
| 149 | + TAGS: bindata gogit sqlite sqlite_unlock_notify |
| 150 | + RACE_ENABLED: true |
| 151 | + TEST_TAGS: gogit sqlite sqlite_unlock_notify |
| 152 | + USE_REPO_TEST_DIR: 1 |
0 commit comments