Forgejo/.forgejo/workflows/testing.yml

157 lines
4.6 KiB
YAML
Raw Normal View History

[CI] Forgejo Actions based CI for PR & branches (cherry picked from commit f9d75d4705ece5c119f2fd5e2bfbaf630d0bf739) (cherry picked from commit 64f76f4ab269daa6a584305164732c68be0161c5) (cherry picked from commit 5d024541551f1be98444923f0fa327a855104725) [CI] Forgejo Actions workflows (cherry picked from commit 3ff59b5379ebf761f32875f9d869a1d18f79741c) (cherry picked from commit 8af826a6f7c70d03079ec68f10230041695017cd) (cherry picked from commit d7c09d9cc80037a28d488da142ae2a2a99f59ac9) [CI] use the docker label instead of ubuntu-latest (cherry picked from commit b6a6470db6c8bae9963e204f9c8c408f309e81e3) [CI] all tests need compliance before proceeding (cherry picked from commit b35c496f2c3034164b9bb3a3550f35026adf9372) (cherry picked from commit 36a4148a8ec654ae9fa5a6925a3b8606b96aebcc) (cherry picked from commit 7ffcffa653808a284f422fdc31f6ea07874b585d) (cherry picked from commit 8a246d296e502c181c6ee779d1773c9e78ca7acf) (cherry picked from commit dd0b6e1826ba7699f967de2c00c1332909a53473) [CI] Forgejo Actions based release process (squash) MySQL optimization Refs: https://codeberg.org/forgejo/forgejo/issues/976 (cherry picked from commit b4b8c489e6e9fe36349eced5d4249467b25df2a7) (cherry picked from commit 1e861db4afdc32549784381a96b16dac508ec1c0) (cherry picked from commit a6c0e00330ded851c2f524039259f0b723d793e4) (cherry picked from commit f97b336465fd6be15079e756c9ee3a580f0aa339) (cherry picked from commit 6d65d5f0d6f798556a8f9e547896be03a5ee2f87) (cherry picked from commit 79bfbadbed3bf84b96f2c027d119a4aa5c60d5e2) (cherry picked from commit e86c40a34a97fc568c724ee5f8ee5b2bf46ebf19) (cherry picked from commit da0c454adbcf1b5dbb95d9d74afaa371e32351a0)
2023-05-28 15:31:52 +02:00
name: testing
on:
pull_request:
push:
branches:
- 'forgejo*'
- 'v*/forgejo*'
jobs:
lint-backend:
runs-on: docker
steps:
- uses: https://code.forgejo.org/actions/checkout@v3
- uses: https://code.forgejo.org/actions/setup-go@v4
with:
go-version: ">=1.20"
check-latest: true
- run: make deps-backend deps-tools
- run: make lint-backend
env:
TAGS: bindata sqlite sqlite_unlock_notify
checks-backend:
runs-on: docker
steps:
- uses: https://code.forgejo.org/actions/checkout@v3
- uses: https://code.forgejo.org/actions/setup-go@v4
with:
go-version: ">=1.20"
check-latest: true
- run: make deps-backend deps-tools
- run: make --always-make checks-backend # ensure the "go-licenses" make target runs
test-unit:
runs-on: docker
needs: [lint-backend, checks-backend]
container:
image: codeberg.org/forgejo/test_env:main
steps:
- uses: https://code.forgejo.org/actions/checkout@v3
- uses: https://code.forgejo.org/actions/setup-go@v4
with:
go-version: ">=1.20.0"
- run: |
git config --add safe.directory '*'
chown -R gitea:gitea . /go
- run: |
su gitea -c 'make deps-backend'
- run: |
su gitea -c 'make backend'
env:
TAGS: bindata
- run: |
su gitea -c 'make unit-test-coverage test-check'
timeout-minutes: 50
env:
RACE_ENABLED: 'true'
TAGS: bindata
test-mysql:
runs-on: docker
needs: [lint-backend, checks-backend]
container:
image: codeberg.org/forgejo/test_env:main
services:
mysql8:
image: mysql:8-debian
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: testgitea
ports:
- "3306:3306"
#
# See also https://codeberg.org/forgejo/forgejo/issues/976
#
cmd: ['mysqld', '--innodb-adaptive-flushing=OFF', '--innodb-buffer-pool-size=4G', '--innodb-log-buffer-size=128M', '--innodb-flush-log-at-trx-commit=0', '--innodb-flush-log-at-timeout=30', '--innodb-flush-method=nosync', '--innodb-fsync-threshold=1000000000']
steps:
- uses: https://code.forgejo.org/actions/checkout@v3
- uses: https://code.forgejo.org/actions/setup-go@v4
with:
go-version: ">=1.20.0"
- run: |
git config --add safe.directory '*'
chown -R gitea:gitea . /go
- run: |
su gitea -c 'make deps-backend'
- run: |
su gitea -c 'make backend'
env:
TAGS: bindata
- run: |
su gitea -c 'make test-mysql8-migration test-mysql8'
timeout-minutes: 50
env:
TAGS: bindata
USE_REPO_TEST_DIR: 1
test-pgsql:
runs-on: docker
needs: [lint-backend, checks-backend]
container:
image: codeberg.org/forgejo/test_env:main
services:
pgsql:
image: postgres:15
env:
POSTGRES_DB: test
POSTGRES_PASSWORD: postgres
ports:
- "5432:5432"
steps:
- uses: https://code.forgejo.org/actions/checkout@v3
- uses: https://code.forgejo.org/actions/setup-go@v4
with:
go-version: ">=1.20.0"
- run: |
git config --add safe.directory '*'
chown -R gitea:gitea . /go
- run: |
su gitea -c 'make deps-backend'
- run: |
su gitea -c 'make backend'
env:
TAGS: bindata
- run: |
su gitea -c 'make test-pgsql-migration test-pgsql'
timeout-minutes: 50
env:
TAGS: bindata gogit
RACE_ENABLED: true
TEST_TAGS: gogit
USE_REPO_TEST_DIR: 1
test-sqlite:
runs-on: docker
needs: [lint-backend, checks-backend]
container:
image: codeberg.org/forgejo/test_env:main
steps:
- uses: https://code.forgejo.org/actions/checkout@v3
- uses: https://code.forgejo.org/actions/setup-go@v4
with:
go-version: ">=1.20.0"
- run: |
git config --add safe.directory '*'
chown -R gitea:gitea . /go
- run: |
su gitea -c 'make deps-backend'
- run: |
su gitea -c 'make backend'
env:
TAGS: bindata gogit sqlite sqlite_unlock_notify
- run: |
su gitea -c 'make test-sqlite-migration test-sqlite'
timeout-minutes: 50
env:
TAGS: bindata gogit sqlite sqlite_unlock_notify
RACE_ENABLED: true
TEST_TAGS: gogit sqlite sqlite_unlock_notify
USE_REPO_TEST_DIR: 1