diff options
author | techknowlogick <techknowlogick@gitea.io> | 2023-05-03 22:04:02 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-04 02:04:02 +0000 |
commit | f7f078213297ee870301d1282366d2f0b5d9de2b (patch) | |
tree | 8e7c0c1222269061f368e89b4a7a9116a3ea0adb /.github/workflows | |
parent | ad8631c069e331c29fe0bca8a0215d2122afaa74 (diff) | |
download | gitea-f7f078213297ee870301d1282366d2f0b5d9de2b.tar.gz gitea-f7f078213297ee870301d1282366d2f0b5d9de2b.zip |
Use Actions for DB & E2E tests (#24494)
following https://github.com/go-gitea/gitea/pull/24314 and
https://github.com/go-gitea/gitea/pull/24434, this PR moves drone cron
pipelines to (GitHub) Actions. As these are mostly compatible with Gitea
Actions, when we start to dogfood, these will already be migrated.
---------
Co-authored-by: silverwind <me@silverwind.io>
Diffstat (limited to '.github/workflows')
-rw-r--r-- | .github/workflows/cron-licenses.yml | 4 | ||||
-rw-r--r-- | .github/workflows/cron-translations.yml | 4 | ||||
-rw-r--r-- | .github/workflows/pull-compliance.yml | 133 | ||||
-rw-r--r-- | .github/workflows/pull-compliance_docs.yml | 2 | ||||
-rw-r--r-- | .github/workflows/pull-db_test.yml | 260 | ||||
-rw-r--r-- | .github/workflows/pull-docker_dryrun.yml | 2 | ||||
-rw-r--r-- | .github/workflows/pull-e2e.yml | 28 | ||||
-rw-r--r-- | .github/workflows/push-publish_docs.yml | 2 |
8 files changed, 428 insertions, 7 deletions
diff --git a/.github/workflows/cron-licenses.yml b/.github/workflows/cron-licenses.yml index 116b8dd095..7239078710 100644 --- a/.github/workflows/cron-licenses.yml +++ b/.github/workflows/cron-licenses.yml @@ -1,10 +1,10 @@ +name: "Cron: Update licenses and gitignores" + on: schedule: # weekly on Monday at 0:07 UTC - cron: "7 0 * * 1" -name: Update licenses and gitignores - jobs: cron: runs-on: ubuntu-latest diff --git a/.github/workflows/cron-translations.yml b/.github/workflows/cron-translations.yml index 31262fd3dd..c83450d2e6 100644 --- a/.github/workflows/cron-translations.yml +++ b/.github/workflows/cron-translations.yml @@ -1,9 +1,9 @@ +name: "Cron: Pull translations from Crowdin" + on: schedule: - cron: "7 0 * * *" # every day at 0:07 UTC -name: Pull translations from Crowdin - jobs: crowdin_pull: runs-on: ubuntu-latest diff --git a/.github/workflows/pull-compliance.yml b/.github/workflows/pull-compliance.yml new file mode 100644 index 0000000000..1239b9caa7 --- /dev/null +++ b/.github/workflows/pull-compliance.yml @@ -0,0 +1,133 @@ +name: "Pull: Compliance Tests" + +on: [pull_request] + +jobs: + lint_basic: + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v3 + - name: setup go + uses: actions/setup-go@v4 + with: + go-version: '>=1.20' + - name: deps-backend + run: make deps-backend deps-tools + - name: lint backend + run: make lint-backend + env: + GOPROXY: https://goproxy.io # proxy.golang.org is blocked in China, this proxy is not + GOSUMDB: sum.golang.org + TAGS: bindata sqlite sqlite_unlock_notify + lint_windows: + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v3 + - name: setup go + uses: actions/setup-go@v4 + with: + go-version: '>=1.20' + - name: deps-backend + run: make deps-backend deps-tools + - name: lint-backend-windows + run: make lint-go-windows lint-go-vet + env: + GOPROXY: https://goproxy.io # proxy.golang.org is blocked in China, this proxy is not + GOSUMDB: sum.golang.org + TAGS: bindata sqlite sqlite_unlock_notify + GOOS: windows + GOARCH: amd64 + lint_gogit: + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v3 + - name: setup go + uses: actions/setup-go@v4 + with: + go-version: '>=1.20' + - name: deps-backend + run: make deps-backend deps-tools + - name: lint-backend-gogit + run: make lint-backend + env: + GOPROXY: https://goproxy.io # proxy.golang.org is blocked in China, this proxy is not + GOSUMDB: sum.golang.org + TAGS: bindata gogit sqlite sqlite_unlock_notify + - name: checks backend + run: make --always-make checks-backend # ensure the 'go-licenses' make target runs + check_backend: + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v3 + - name: setup go + uses: actions/setup-go@v4 + with: + go-version: '>=1.20' + - name: deps-backend + run: make deps-backend deps-tools + - name: checks backend + run: make --always-make checks-backend # ensure the 'go-licenses' make target runs + frontend: + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v3 + - name: setup node + uses: actions/setup-node@v3 + with: + node-version: 18 + - name: deps-frontend + run: make deps-frontend + - name: lint frontend + run: make lint-frontend + - name: checks frontend + run: make checks-frontend + - name: test frontend + run: make test-frontend + backend: + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v3 + - name: setup go + uses: actions/setup-go@v4 + with: + go-version: '>=1.20' + - name: setup node + uses: actions/setup-node@v3 + with: + node-version: 18 + - name: deps-backend + run: make deps-backend deps-tools + - name: deps-frontend + run: make deps-frontend + - name: build frontend + run: make frontend + - name: build-backend-no-gcc + run: go build -o gitea_no_gcc # test if build succeeds without the sqlite tag + env: + GOPROXY: https://goproxy.io + - name: build-backend-arm64 + run: make backend # test cross compile + env: + GOPROXY: https://goproxy.io + GOOS: linux + GOARCH: arm64 + TAGS: bindata gogit + - name: build-backend-windows + run: go build -o gitea_windows + env: + GOPROXY: https://goproxy.io + GOOS: windows + GOARCH: amd64 + TAGS: bindata gogit + - name: build-backend-386 + run: go build -o gitea_linux_386 # test if compatible with 32 bit + env: + GOPROXY: https://goproxy.io + GOOS: linux + GOARCH: 386 diff --git a/.github/workflows/pull-compliance_docs.yml b/.github/workflows/pull-compliance_docs.yml index e3c3a42541..679e925515 100644 --- a/.github/workflows/pull-compliance_docs.yml +++ b/.github/workflows/pull-compliance_docs.yml @@ -1,4 +1,4 @@ -name: Compliance testing for documentation +name: "Pull: Compliance testing for documentation" on: pull_request: diff --git a/.github/workflows/pull-db_test.yml b/.github/workflows/pull-db_test.yml new file mode 100644 index 0000000000..3cae4df039 --- /dev/null +++ b/.github/workflows/pull-db_test.yml @@ -0,0 +1,260 @@ +name: "Pull: Database Tests" + +on: [pull_request] + +jobs: + # PostgreSQL Tests + db_pgsql_test: + runs-on: ubuntu-latest + services: + pgsql: + image: postgres:15 + env: + POSTGRES_DB: test + POSTGRES_PASSWORD: postgres + ports: + - "5432:5432" + ldap: + image: gitea/test-openldap:latest + ports: + - "389:389" + - "636:636" + minio: + # as github actions doesn't support "entrypoint", we need to use a non-official image + # that has a custom entrypoint set to "minio server /data" + image: bitnami/minio:2021.3.17 + env: + MINIO_ACCESS_KEY: 123456 + MINIO_SECRET_KEY: 12345678 + ports: + - "9000:9000" + steps: + - name: checkout + uses: actions/checkout@v3 + - name: setup go + uses: actions/setup-go@v4 + with: + go-version: '>=1.20.0' + - name: Add hosts to /etc/hosts + run: echo "127.0.0.1 pgsql ldap minio" | sudo tee -a /etc/hosts + - name: install dependencies + run: make deps-backend + - name: build + run: make backend + env: + GOPROXY: https://goproxy.io + GOSUMDB: sum.golang.org + TAGS: bindata + - name: run tests + run: timeout -s ABRT 50m make test-pgsql-migration test-pgsql + env: + GOPROXY: https://goproxy.io + TAGS: bindata gogit + RACE_ENABLED: true + TEST_TAGS: gogit + TEST_LDAP: 1 + USE_REPO_TEST_DIR: 1 + + # SQLite Tests + db_sqlite_test: + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v3 + - name: setup go + uses: actions/setup-go@v4 + with: + go-version: '>=1.20.0' + - name: install dependencies + run: make deps-backend + - name: build + run: make backend + env: + GOPROXY: https://goproxy.io + GOSUMDB: sum.golang.org + TAGS: bindata gogit sqlite sqlite_unlock_notify + - name: run tests + run: timeout -s ABRT 50m make test-sqlite-migration test-sqlite + env: + GOPROXY: https://goproxy.io + TAGS: bindata gogit sqlite sqlite_unlock_notify + RACE_ENABLED: true + TEST_TAGS: gogit sqlite sqlite_unlock_notify + USE_REPO_TEST_DIR: 1 + + # Unit Tests + db_unit_tests: + runs-on: ubuntu-latest + services: + mysql: + image: mysql:5.7 + env: + MYSQL_ALLOW_EMPTY_PASSWORD: yes + MYSQL_DATABASE: test + ports: + - "3306:3306" + elasticsearch: + image: elasticsearch:7.5.0 + env: + discovery.type: single-node + ports: + - "9200:9200" + smtpimap: + image: tabascoterrier/docker-imap-devel:latest + ports: + - "25:25" + - "143:143" + - "587:587" + - "993:993" + steps: + - name: checkout + uses: actions/checkout@v3 + - name: setup go + uses: actions/setup-go@v4 + with: + go-version: '>=1.20.0' + - name: Add hosts to /etc/hosts + run: echo "127.0.0.1 mysql elasticsearch smtpimap" | sudo tee -a /etc/hosts + - name: install dependencies + run: make deps-backend + - name: build + run: make backend + env: + GOPROXY: https://goproxy.io + GOSUMDB: sum.golang.org + TAGS: bindata + - name: unit tests + run: make unit-test-coverage test-check + env: + GOPROXY: https://goproxy.io + TAGS: bindata + RACE_ENABLED: true + GITHUB_READ_TOKEN: ${{ secrets.GITHUB_READ_TOKEN }} + - name: unit tests (gogit) + run: make unit-test-coverage test-check + env: + GOPROXY: https://goproxy.io + TAGS: bindata gogit + RACE_ENABLED: true + GITHUB_READ_TOKEN: ${{ secrets.GITHUB_READ_TOKEN }} + + # MySQL Tests + db_mysql_test: + runs-on: ubuntu-latest + services: + mysql: + image: mysql:5.7 + env: + MYSQL_ALLOW_EMPTY_PASSWORD: yes + MYSQL_DATABASE: test + ports: + - "3306:3306" + elasticsearch: + image: elasticsearch:7.5.0 + env: + discovery.type: single-node + ports: + - "9200:9200" + smtpimap: + image: tabascoterrier/docker-imap-devel:latest + ports: + - "25:25" + - "143:143" + - "587:587" + - "993:993" + steps: + - name: checkout + uses: actions/checkout@v3 + - name: setup go + uses: actions/setup-go@v4 + with: + go-version: '>=1.20.0' + - name: Add hosts to /etc/hosts + run: echo "127.0.0.1 mysql elasticsearch smtpimap" | sudo tee -a /etc/hosts + - name: install dependencies + run: make deps-backend + - name: build + run: make backend + env: + GOPROXY: https://goproxy.io + GOSUMDB: sum.golang.org + TAGS: bindata + - name: run tests + run: make test-mysql-migration integration-test-coverage + env: + GOPROXY: https://goproxy.io + TAGS: bindata + RACE_ENABLED: true + USE_REPO_TEST_DIR: 1 + TEST_INDEXER_CODE_ES_URL: "http://elastic:changeme@elasticsearch:9200" + + # MySQL8 Tests + db_mysql8_test: + runs-on: ubuntu-latest + services: + mysql8: + image: mysql:8 + env: + MYSQL_ALLOW_EMPTY_PASSWORD: yes + MYSQL_DATABASE: testgitea + ports: + - "3306:3306" + steps: + - name: checkout + uses: actions/checkout@v3 + - name: setup go + uses: actions/setup-go@v4 + with: + go-version: '>=1.20.0' + - name: Add hosts to /etc/hosts + run: echo "127.0.0.1 mysql8" | sudo tee -a /etc/hosts + - name: install dependencies + run: make deps-backend + - name: build + run: make backend + env: + GOPROXY: https://goproxy.io + GOSUMDB: sum.golang.org + TAGS: bindata + - name: run tests + run: timeout -s ABRT 50m make test-mysql8-migration test-mysql8 + env: + GOPROXY: https://goproxy.io + TAGS: bindata + USE_REPO_TEST_DIR: 1 + + # MSSQL Tests + db_mssql_test: + runs-on: ubuntu-latest + services: + mssql: + image: mcr.microsoft.com/mssql/server:latest + env: + ACCEPT_EULA: Y + MSSQL_PID: Standard + SA_PASSWORD: MwantsaSecurePassword1 + ports: + - "1433:1433" + steps: + - name: checkout + uses: actions/checkout@v3 + - name: setup go + uses: actions/setup-go@v4 + with: + go-version: '>=1.20.0' + - name: Add hosts to /etc/hosts + run: echo "127.0.0.1 mssql" | sudo tee -a /etc/hosts + - name: install dependencies + run: make deps-backend + - name: build + run: make backend + env: + GOPROXY: https://goproxy.io + GOSUMDB: sum.golang.org + TAGS: bindata + - name: run tests + run: timeout -s ABRT 50m make test-mssql-migration test-mssql + env: + GOPROXY: https://goproxy.io + TAGS: bindata + USE_REPO_TEST_DIR: 1 diff --git a/.github/workflows/pull-docker_dryrun.yml b/.github/workflows/pull-docker_dryrun.yml index 719668db81..8e5acb3cee 100644 --- a/.github/workflows/pull-docker_dryrun.yml +++ b/.github/workflows/pull-docker_dryrun.yml @@ -1,4 +1,4 @@ -name: Docker build dry run +name: "Pull: Docker Dry Run" on: [pull_request] diff --git a/.github/workflows/pull-e2e.yml b/.github/workflows/pull-e2e.yml new file mode 100644 index 0000000000..2cd6bd0d6a --- /dev/null +++ b/.github/workflows/pull-e2e.yml @@ -0,0 +1,28 @@ +name: "Pull: E2E Tests" + +on: [pull_request] + +jobs: + e2e_tests: + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v3 + - name: setup go + uses: actions/setup-go@v4 + with: + go-version: '>=1.20' + - name: setup node + uses: actions/setup-node@v3 + with: + node-version: 18 + - name: build + run: make deps-frontend frontend deps-backend + - name: Install playwright browsers + run: npx playwright install --with-deps + - name: run tests + run: timeout -s ABRT 40m make test-e2e-sqlite + env: + GOPROXY: https://goproxy.io + GOSUMDB: sum.golang.org + USE_REPO_TEST_DIR: 1 diff --git a/.github/workflows/push-publish_docs.yml b/.github/workflows/push-publish_docs.yml index 579157ccd8..9037e278ca 100644 --- a/.github/workflows/push-publish_docs.yml +++ b/.github/workflows/push-publish_docs.yml @@ -1,4 +1,4 @@ -name: Publish documentation +name: "Docs: Publish" on: push: |