1
0
Fork 0

GitHub Actions cleanups (#24620)

- Remove actions name where command is descriptive enough
- Use kebab-case instead of snake-case for step names
- Use shorter job names because to make PR checks more readable
- Remove duplicate `checks-backend`

---------

Co-authored-by: Yarden Shoham <git@yardenshoham.com>
This commit is contained in:
silverwind 2023-05-12 03:21:28 +02:00 committed by GitHub
parent 365bb77a54
commit 6c8b680f91
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 173 additions and 288 deletions

View file

@ -1,21 +1,20 @@
name: "Cron: Update licenses and gitignores" name: cron-licenses
on: on:
schedule: schedule:
# weekly on Monday at 0:07 UTC - cron: "7 0 * * 1" # every Monday at 00:07 UTC
- cron: "7 0 * * 1"
jobs: jobs:
cron: cron-licenses:
if: github.repository == "go-gitea/gitea"
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - uses: actions/checkout@v3
uses: actions/checkout@v3
- uses: actions/setup-go@v3 - uses: actions/setup-go@v3
with: with:
go-version: '>=1.20.1' go-version: ">=1.20.1"
- name: update licenses and gitignores - run: make generate-license generate-gitignore
run: timeout -s ABRT 40m make generate-license generate-gitignore timeout-minutes: 40
- name: push translations to repo - name: push translations to repo
uses: appleboy/git-push-action@v0.0.2 uses: appleboy/git-push-action@v0.0.2
with: with:

View file

@ -1,8 +1,8 @@
name: 'Lock Threads' name: cron-lock
on: on:
schedule: schedule:
- cron: '0 0 * * *' # Run once a day - cron: "0 0 * * *" # every day at 00:00 UTC
workflow_dispatch: workflow_dispatch:
permissions: permissions:

View file

@ -1,15 +1,14 @@
name: "Cron: Pull translations from Crowdin" name: cron-translations
on: on:
schedule: schedule:
- cron: "7 0 * * *" # every day at 0:07 UTC - cron: "7 0 * * *" # every day at 00:07 UTC
jobs: jobs:
crowdin_pull: crowdin-pull:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - uses: actions/checkout@v3
uses: actions/checkout@v3
- name: download from crowdin - name: download from crowdin
uses: docker://jonasfranz/crowdin uses: docker://jonasfranz/crowdin
env: env:
@ -30,11 +29,10 @@ jobs:
commit_message: "[skip ci] Updated translations via Crowdin" commit_message: "[skip ci] Updated translations via Crowdin"
remote: "git@github.com:go-gitea/gitea.git" remote: "git@github.com:go-gitea/gitea.git"
ssh_key: ${{ secrets.DEPLOY_KEY }} ssh_key: ${{ secrets.DEPLOY_KEY }}
crowdin_push: crowdin-push:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - uses: actions/checkout@v3
uses: actions/checkout@v3
- name: push translations to crowdin - name: push translations to crowdin
uses: docker://jonasfranz/crowdin uses: docker://jonasfranz/crowdin
env: env:

View file

@ -1,4 +1,4 @@
name: "Docs: Publish" name: publish-docs
on: on:
push: push:
@ -11,12 +11,10 @@ jobs:
compliance-docs: compliance-docs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: checkout - uses: actions/checkout@v3
uses: actions/checkout@v3 - uses: actions/setup-go@v4
- name: setup go
uses: actions/setup-go@v4
with: with:
go-version: '>=1.20.1' go-version: ">=1.20.1"
- name: build docs - name: build docs
run: | run: |
cd docs cd docs

View file

@ -0,0 +1,22 @@
name: compliance-docs
on:
pull_request:
paths:
- "docs/**"
- "*.md"
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
compliance-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20
- run: make deps-frontend
- run: make lint-md

View file

@ -1,4 +1,4 @@
name: "Pull: Compliance Tests" name: compliance
on: [pull_request] on: [pull_request]
@ -7,136 +7,93 @@ concurrency:
cancel-in-progress: true cancel-in-progress: true
jobs: jobs:
lint_basic: lint-backend:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: checkout - uses: actions/checkout@v3
uses: actions/checkout@v3 - uses: actions/setup-go@v4
- name: setup go
uses: actions/setup-go@v4
with: with:
go-version: '>=1.20' go-version: ">=1.20"
check-latest: true check-latest: true
- name: deps-backend - run: make deps-backend deps-tools
run: make deps-backend deps-tools - run: make lint-backend
- name: lint backend
run: make lint-backend
env: 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 TAGS: bindata sqlite sqlite_unlock_notify
lint_windows: lint-go-windows:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: checkout - uses: actions/checkout@v3
uses: actions/checkout@v3 - uses: actions/setup-go@v4
- name: setup go
uses: actions/setup-go@v4
with: with:
go-version: '>=1.20' go-version: ">=1.20"
check-latest: true check-latest: true
- name: deps-backend - run: make deps-backend deps-tools
run: make deps-backend deps-tools - run: make lint-go-windows lint-go-vet
- name: lint-backend-windows
run: make lint-go-windows lint-go-vet
env: 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 TAGS: bindata sqlite sqlite_unlock_notify
GOOS: windows GOOS: windows
GOARCH: amd64 GOARCH: amd64
lint_gogit: lint-go-gogit:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: checkout - uses: actions/checkout@v3
uses: actions/checkout@v3 - uses: actions/setup-go@v4
- name: setup go
uses: actions/setup-go@v4
with: with:
go-version: '>=1.20' go-version: ">=1.20"
check-latest: true check-latest: true
- name: deps-backend - run: make deps-backend deps-tools
run: make deps-backend deps-tools - run: make lint-go
- name: lint-backend-gogit
run: make lint-backend
env: 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 TAGS: bindata gogit sqlite sqlite_unlock_notify
- name: checks backend checks-backend:
run: make --always-make checks-backend # ensure the 'go-licenses' make target runs
check_backend:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: checkout - uses: actions/checkout@v3
uses: actions/checkout@v3 - uses: actions/setup-go@v4
- name: setup go
uses: actions/setup-go@v4
with: with:
go-version: '>=1.20' go-version: ">=1.20"
check-latest: true check-latest: true
- name: deps-backend - run: make deps-backend deps-tools
run: make deps-backend deps-tools - run: make --always-make checks-backend # ensure the "go-licenses" make target runs
- name: checks backend
run: make --always-make checks-backend # ensure the 'go-licenses' make target runs
frontend: frontend:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: checkout - uses: actions/checkout@v3
uses: actions/checkout@v3 - uses: actions/setup-node@v3
- name: setup node
uses: actions/setup-node@v3
with: with:
node-version: 20 node-version: 20
- name: deps-frontend - run: make deps-frontend
run: make deps-frontend - run: make lint-frontend
- name: lint frontend - run: make checks-frontend
run: make lint-frontend
- name: checks frontend
run: make checks-frontend
- name: test frontend
run: make test-frontend
backend: backend:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: checkout - uses: actions/checkout@v3
uses: actions/checkout@v3 - uses: actions/setup-go@v4
- name: setup go
uses: actions/setup-go@v4
with: with:
go-version: '>=1.20' go-version: ">=1.20"
check-latest: true check-latest: true
- name: setup node - uses: actions/setup-node@v3
uses: actions/setup-node@v3
with: with:
node-version: 20 node-version: 20
- name: deps-backend - run: make deps-backend deps-tools
run: make deps-backend deps-tools - run: make deps-frontend
- name: deps-frontend - run: make frontend
run: make deps-frontend - run: go build -o gitea_no_gcc # test if build succeeds without the sqlite tag
- 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 - name: build-backend-arm64
run: make backend # test cross compile run: make backend # test cross compile
env: env:
GOPROXY: https://goproxy.io
GOOS: linux GOOS: linux
GOARCH: arm64 GOARCH: arm64
TAGS: bindata gogit TAGS: bindata gogit
- name: build-backend-windows - name: build-backend-windows
run: go build -o gitea_windows run: go build -o gitea_windows
env: env:
GOPROXY: https://goproxy.io
GOOS: windows GOOS: windows
GOARCH: amd64 GOARCH: amd64
TAGS: bindata gogit TAGS: bindata gogit
- name: build-backend-386 - name: build-backend-386
run: go build -o gitea_linux_386 # test if compatible with 32 bit run: go build -o gitea_linux_386 # test if compatible with 32 bit
env: env:
GOPROXY: https://goproxy.io
GOOS: linux GOOS: linux
GOARCH: 386 GOARCH: 386

View file

@ -1,26 +0,0 @@
name: "Pull: Compliance testing for documentation"
on:
pull_request:
paths:
- "docs/**"
- "*.md"
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
compliance-docs:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
- name: setup node
uses: actions/setup-node@v3
with:
node-version: 20
- name: install dependencies
run: make deps-frontend
- name: lint markdown
run: make lint-md

View file

@ -1,4 +1,4 @@
name: "Pull: Database Tests" name: db-tests
on: [pull_request] on: [pull_request]
@ -7,8 +7,7 @@ concurrency:
cancel-in-progress: true cancel-in-progress: true
jobs: jobs:
# PostgreSQL Tests test-pgsql:
db_pgsql_test:
runs-on: ubuntu-latest runs-on: ubuntu-latest
services: services:
pgsql: pgsql:
@ -33,61 +32,45 @@ jobs:
ports: ports:
- "9000:9000" - "9000:9000"
steps: steps:
- name: checkout - uses: actions/checkout@v3
uses: actions/checkout@v3 - uses: actions/setup-go@v4
- name: setup go
uses: actions/setup-go@v4
with: with:
go-version: '>=1.20.0' go-version: ">=1.20.0"
- name: Add hosts to /etc/hosts - name: Add hosts to /etc/hosts
run: echo "127.0.0.1 pgsql ldap minio" | sudo tee -a /etc/hosts run: echo "127.0.0.1 pgsql ldap minio" | sudo tee -a /etc/hosts
- name: install dependencies - run: make deps-backend
run: make deps-backend - run: make backend
- name: build
run: make backend
env: env:
GOPROXY: https://goproxy.io
GOSUMDB: sum.golang.org
TAGS: bindata TAGS: bindata
- name: run tests - run: make test-pgsql-migration test-pgsql
run: timeout -s ABRT 50m make test-pgsql-migration test-pgsql timeout-minutes: 50
env: env:
GOPROXY: https://goproxy.io
TAGS: bindata gogit TAGS: bindata gogit
RACE_ENABLED: true RACE_ENABLED: true
TEST_TAGS: gogit TEST_TAGS: gogit
TEST_LDAP: 1 TEST_LDAP: 1
USE_REPO_TEST_DIR: 1 USE_REPO_TEST_DIR: 1
# SQLite Tests test-sqlite:
db_sqlite_test:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: checkout - uses: actions/checkout@v3
uses: actions/checkout@v3 - uses: actions/setup-go@v4
- name: setup go
uses: actions/setup-go@v4
with: with:
go-version: '>=1.20.0' go-version: ">=1.20.0"
- name: install dependencies - run: make deps-backend
run: make deps-backend - run: make backend
- name: build
run: make backend
env: env:
GOPROXY: https://goproxy.io
GOSUMDB: sum.golang.org
TAGS: bindata gogit sqlite sqlite_unlock_notify TAGS: bindata gogit sqlite sqlite_unlock_notify
- name: run tests - run: make test-sqlite-migration test-sqlite
run: timeout -s ABRT 50m make test-sqlite-migration test-sqlite timeout-minutes: 50
env: env:
GOPROXY: https://goproxy.io
TAGS: bindata gogit sqlite sqlite_unlock_notify TAGS: bindata gogit sqlite sqlite_unlock_notify
RACE_ENABLED: true RACE_ENABLED: true
TEST_TAGS: gogit sqlite sqlite_unlock_notify TEST_TAGS: gogit sqlite sqlite_unlock_notify
USE_REPO_TEST_DIR: 1 USE_REPO_TEST_DIR: 1
# Unit Tests test-unit:
db_unit_tests:
runs-on: ubuntu-latest runs-on: ubuntu-latest
services: services:
mysql: mysql:
@ -112,8 +95,7 @@ jobs:
- "993:993" - "993:993"
redis: redis:
image: redis image: redis
# Set health checks to wait until redis has started options: >- # wait until redis has started
options: >-
--health-cmd "redis-cli ping" --health-cmd "redis-cli ping"
--health-interval 5s --health-interval 5s
--health-timeout 3s --health-timeout 3s
@ -121,39 +103,30 @@ jobs:
ports: ports:
- 6379:6379 - 6379:6379
steps: steps:
- name: checkout - uses: actions/checkout@v3
uses: actions/checkout@v3 - uses: actions/setup-go@v4
- name: setup go
uses: actions/setup-go@v4
with: with:
go-version: '>=1.20.0' go-version: ">=1.20.0"
- name: Add hosts to /etc/hosts - name: Add hosts to /etc/hosts
run: echo "127.0.0.1 mysql elasticsearch smtpimap" | sudo tee -a /etc/hosts run: echo "127.0.0.1 mysql elasticsearch smtpimap" | sudo tee -a /etc/hosts
- name: install dependencies - run: make deps-backend
run: make deps-backend - run: make backend
- name: build
run: make backend
env: env:
GOPROXY: https://goproxy.io
GOSUMDB: sum.golang.org
TAGS: bindata TAGS: bindata
- name: unit tests - name: unit-tests
run: make unit-test-coverage test-check run: make unit-test-coverage test-check
env: env:
GOPROXY: https://goproxy.io
TAGS: bindata TAGS: bindata
RACE_ENABLED: true RACE_ENABLED: true
GITHUB_READ_TOKEN: ${{ secrets.GITHUB_READ_TOKEN }} GITHUB_READ_TOKEN: ${{ secrets.GITHUB_READ_TOKEN }}
- name: unit tests (gogit) - name: unit-tests-gogit
run: make unit-test-coverage test-check run: make unit-test-coverage test-check
env: env:
GOPROXY: https://goproxy.io
TAGS: bindata gogit TAGS: bindata gogit
RACE_ENABLED: true RACE_ENABLED: true
GITHUB_READ_TOKEN: ${{ secrets.GITHUB_READ_TOKEN }} GITHUB_READ_TOKEN: ${{ secrets.GITHUB_READ_TOKEN }}
# MySQL Tests test-mysql5:
db_mysql_test:
runs-on: ubuntu-latest runs-on: ubuntu-latest
services: services:
mysql: mysql:
@ -177,33 +150,25 @@ jobs:
- "587:587" - "587:587"
- "993:993" - "993:993"
steps: steps:
- name: checkout - uses: actions/checkout@v3
uses: actions/checkout@v3 - uses: actions/setup-go@v4
- name: setup go
uses: actions/setup-go@v4
with: with:
go-version: '>=1.20.0' go-version: ">=1.20.0"
- name: Add hosts to /etc/hosts - name: Add hosts to /etc/hosts
run: echo "127.0.0.1 mysql elasticsearch smtpimap" | sudo tee -a /etc/hosts run: echo "127.0.0.1 mysql elasticsearch smtpimap" | sudo tee -a /etc/hosts
- name: install dependencies - run: make deps-backend
run: make deps-backend - run: make backend
- name: build
run: make backend
env: env:
GOPROXY: https://goproxy.io
GOSUMDB: sum.golang.org
TAGS: bindata TAGS: bindata
- name: run tests - name: run tests
run: make test-mysql-migration integration-test-coverage run: make test-mysql-migration integration-test-coverage
env: env:
GOPROXY: https://goproxy.io
TAGS: bindata TAGS: bindata
RACE_ENABLED: true RACE_ENABLED: true
USE_REPO_TEST_DIR: 1 USE_REPO_TEST_DIR: 1
TEST_INDEXER_CODE_ES_URL: "http://elastic:changeme@elasticsearch:9200" TEST_INDEXER_CODE_ES_URL: "http://elastic:changeme@elasticsearch:9200"
# MySQL8 Tests test-mysql8:
db_mysql8_test:
runs-on: ubuntu-latest runs-on: ubuntu-latest
services: services:
mysql8: mysql8:
@ -214,31 +179,23 @@ jobs:
ports: ports:
- "3306:3306" - "3306:3306"
steps: steps:
- name: checkout - uses: actions/checkout@v3
uses: actions/checkout@v3 - uses: actions/setup-go@v4
- name: setup go
uses: actions/setup-go@v4
with: with:
go-version: '>=1.20.0' go-version: ">=1.20.0"
- name: Add hosts to /etc/hosts - name: Add hosts to /etc/hosts
run: echo "127.0.0.1 mysql8" | sudo tee -a /etc/hosts run: echo "127.0.0.1 mysql8" | sudo tee -a /etc/hosts
- name: install dependencies - run: make deps-backend
run: make deps-backend - run: make backend
- name: build
run: make backend
env: env:
GOPROXY: https://goproxy.io
GOSUMDB: sum.golang.org
TAGS: bindata TAGS: bindata
- name: run tests - run: make test-mysql8-migration test-mysql8
run: timeout -s ABRT 50m make test-mysql8-migration test-mysql8 timeout-minutes: 50
env: env:
GOPROXY: https://goproxy.io
TAGS: bindata TAGS: bindata
USE_REPO_TEST_DIR: 1 USE_REPO_TEST_DIR: 1
# MSSQL Tests test-mssql:
db_mssql_test:
runs-on: ubuntu-latest runs-on: ubuntu-latest
services: services:
mssql: mssql:
@ -250,25 +207,18 @@ jobs:
ports: ports:
- "1433:1433" - "1433:1433"
steps: steps:
- name: checkout - uses: actions/checkout@v3
uses: actions/checkout@v3 - uses: actions/setup-go@v4
- name: setup go
uses: actions/setup-go@v4
with: with:
go-version: '>=1.20.0' go-version: ">=1.20.0"
- name: Add hosts to /etc/hosts - name: Add hosts to /etc/hosts
run: echo "127.0.0.1 mssql" | sudo tee -a /etc/hosts run: echo "127.0.0.1 mssql" | sudo tee -a /etc/hosts
- name: install dependencies - run: make deps-backend
run: make deps-backend - run: make backend
- name: build
run: make backend
env: env:
GOPROXY: https://goproxy.io
GOSUMDB: sum.golang.org
TAGS: bindata TAGS: bindata
- name: run tests - run: make test-mssql-migration test-mssql
run: timeout -s ABRT 50m make test-mssql-migration test-mssql timeout-minutes: 50
env: env:
GOPROXY: https://goproxy.io
TAGS: bindata TAGS: bindata
USE_REPO_TEST_DIR: 1 USE_REPO_TEST_DIR: 1

View file

@ -0,0 +1,17 @@
name: docker-dryrun
on: [pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
docker-dryrun:
runs-on: ubuntu-latest
steps:
- uses: docker/setup-buildx-action@v2
- uses: docker/build-push-action@v4
with:
push: false
tags: gitea/gitea:linux-amd64

View file

@ -1,23 +0,0 @@
name: "Pull: Docker Dry Run"
on: [pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
docker_dryrun:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push
uses: docker/build-push-action@v4
with:
push: false
tags: gitea/gitea:linux-amd64
build-args: |
GOPROXY=https://goproxy.io

26
.github/workflows/pull-e2e-tests.yml vendored Normal file
View file

@ -0,0 +1,26 @@
name: e2e-tests
on: [pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
test-e2e:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: ">=1.20"
check-latest: true
- uses: actions/setup-node@v3
with:
node-version: 20
- run: make deps-frontend frontend deps-backend
- run: npx playwright install --with-deps
- run: make test-e2e-sqlite
timeout-minutes: 40
env:
USE_REPO_TEST_DIR: 1

View file

@ -1,33 +0,0 @@
name: "Pull: E2E Tests"
on: [pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
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'
check-latest: true
- name: setup node
uses: actions/setup-node@v3
with:
node-version: 20
- 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

View file

@ -394,7 +394,7 @@ lint-go:
lint-go-fix: lint-go-fix:
$(GO) run $(GOLANGCI_LINT_PACKAGE) run --fix $(GO) run $(GOLANGCI_LINT_PACKAGE) run --fix
# workaround step for the lint-backend-windows CI task because 'go run' can not # workaround step for the lint-go-windows CI task because 'go run' can not
# have distinct GOOS/GOARCH for its build and run steps # have distinct GOOS/GOARCH for its build and run steps
.PHONY: lint-go-windows .PHONY: lint-go-windows
lint-go-windows: lint-go-windows:
@ -409,7 +409,7 @@ lint-go-vet:
.PHONY: lint-editorconfig .PHONY: lint-editorconfig
lint-editorconfig: lint-editorconfig:
$(GO) run $(EDITORCONFIG_CHECKER_PACKAGE) templates $(GO) run $(EDITORCONFIG_CHECKER_PACKAGE) templates .github/workflows
.PHONY: watch .PHONY: watch
watch: watch: