Skip to content

Commit 6c8b680

Browse files
silverwindyardenshoham
andauthoredMay 12, 2023
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 <[email protected]>
1 parent 365bb77 commit 6c8b680

13 files changed

+173
-288
lines changed
 

‎.github/workflows/cron-licenses.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
1-
name: "Cron: Update licenses and gitignores"
1+
name: cron-licenses
22

33
on:
44
schedule:
5-
# weekly on Monday at 0:07 UTC
6-
- cron: "7 0 * * 1"
5+
- cron: "7 0 * * 1" # every Monday at 00:07 UTC
76

87
jobs:
9-
cron:
8+
cron-licenses:
9+
if: github.repository == "go-gitea/gitea"
1010
runs-on: ubuntu-latest
1111
steps:
12-
- name: Checkout
13-
uses: actions/checkout@v3
12+
- uses: actions/checkout@v3
1413
- uses: actions/setup-go@v3
1514
with:
16-
go-version: '>=1.20.1'
17-
- name: update licenses and gitignores
18-
run: timeout -s ABRT 40m make generate-license generate-gitignore
15+
go-version: ">=1.20.1"
16+
- run: make generate-license generate-gitignore
17+
timeout-minutes: 40
1918
- name: push translations to repo
2019
uses: appleboy/git-push-action@v0.0.2
2120
with:

‎.github/workflows/lock.yml renamed to ‎.github/workflows/cron-lock.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
name: 'Lock Threads'
1+
name: cron-lock
22

33
on:
44
schedule:
5-
- cron: '0 0 * * *' # Run once a day
5+
- cron: "0 0 * * *" # every day at 00:00 UTC
66
workflow_dispatch:
77

88
permissions:

‎.github/workflows/cron-translations.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
name: "Cron: Pull translations from Crowdin"
1+
name: cron-translations
22

33
on:
44
schedule:
5-
- cron: "7 0 * * *" # every day at 0:07 UTC
5+
- cron: "7 0 * * *" # every day at 00:07 UTC
66

77
jobs:
8-
crowdin_pull:
8+
crowdin-pull:
99
runs-on: ubuntu-latest
1010
steps:
11-
- name: Checkout
12-
uses: actions/checkout@v3
11+
- uses: actions/checkout@v3
1312
- name: download from crowdin
1413
uses: docker://jonasfranz/crowdin
1514
env:
@@ -30,11 +29,10 @@ jobs:
3029
commit_message: "[skip ci] Updated translations via Crowdin"
3130
remote: "git@github.com:go-gitea/gitea.git"
3231
ssh_key: ${{ secrets.DEPLOY_KEY }}
33-
crowdin_push:
32+
crowdin-push:
3433
runs-on: ubuntu-latest
3534
steps:
36-
- name: Checkout
37-
uses: actions/checkout@v3
35+
- uses: actions/checkout@v3
3836
- name: push translations to crowdin
3937
uses: docker://jonasfranz/crowdin
4038
env:

‎.github/workflows/push-publish_docs.yml renamed to ‎.github/workflows/publish-docs.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: "Docs: Publish"
1+
name: publish-docs
22

33
on:
44
push:
@@ -11,12 +11,10 @@ jobs:
1111
compliance-docs:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- name: checkout
15-
uses: actions/checkout@v3
16-
- name: setup go
17-
uses: actions/setup-go@v4
14+
- uses: actions/checkout@v3
15+
- uses: actions/setup-go@v4
1816
with:
19-
go-version: '>=1.20.1'
17+
go-version: ">=1.20.1"
2018
- name: build docs
2119
run: |
2220
cd docs
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: compliance-docs
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- "docs/**"
7+
- "*.md"
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
compliance-docs:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v3
18+
- uses: actions/setup-node@v3
19+
with:
20+
node-version: 20
21+
- run: make deps-frontend
22+
- run: make lint-md

‎.github/workflows/pull-compliance.yml

Lines changed: 38 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: "Pull: Compliance Tests"
1+
name: compliance
22

33
on: [pull_request]
44

@@ -7,136 +7,93 @@ concurrency:
77
cancel-in-progress: true
88

99
jobs:
10-
lint_basic:
10+
lint-backend:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- name: checkout
14-
uses: actions/checkout@v3
15-
- name: setup go
16-
uses: actions/setup-go@v4
13+
- uses: actions/checkout@v3
14+
- uses: actions/setup-go@v4
1715
with:
18-
go-version: '>=1.20'
16+
go-version: ">=1.20"
1917
check-latest: true
20-
- name: deps-backend
21-
run: make deps-backend deps-tools
22-
- name: lint backend
23-
run: make lint-backend
18+
- run: make deps-backend deps-tools
19+
- run: make lint-backend
2420
env:
25-
GOPROXY: https://goproxy.io # proxy.golang.org is blocked in China, this proxy is not
26-
GOSUMDB: sum.golang.org
2721
TAGS: bindata sqlite sqlite_unlock_notify
28-
lint_windows:
22+
lint-go-windows:
2923
runs-on: ubuntu-latest
3024
steps:
31-
- name: checkout
32-
uses: actions/checkout@v3
33-
- name: setup go
34-
uses: actions/setup-go@v4
25+
- uses: actions/checkout@v3
26+
- uses: actions/setup-go@v4
3527
with:
36-
go-version: '>=1.20'
28+
go-version: ">=1.20"
3729
check-latest: true
38-
- name: deps-backend
39-
run: make deps-backend deps-tools
40-
- name: lint-backend-windows
41-
run: make lint-go-windows lint-go-vet
30+
- run: make deps-backend deps-tools
31+
- run: make lint-go-windows lint-go-vet
4232
env:
43-
GOPROXY: https://goproxy.io # proxy.golang.org is blocked in China, this proxy is not
44-
GOSUMDB: sum.golang.org
4533
TAGS: bindata sqlite sqlite_unlock_notify
4634
GOOS: windows
4735
GOARCH: amd64
48-
lint_gogit:
36+
lint-go-gogit:
4937
runs-on: ubuntu-latest
5038
steps:
51-
- name: checkout
52-
uses: actions/checkout@v3
53-
- name: setup go
54-
uses: actions/setup-go@v4
39+
- uses: actions/checkout@v3
40+
- uses: actions/setup-go@v4
5541
with:
56-
go-version: '>=1.20'
42+
go-version: ">=1.20"
5743
check-latest: true
58-
- name: deps-backend
59-
run: make deps-backend deps-tools
60-
- name: lint-backend-gogit
61-
run: make lint-backend
44+
- run: make deps-backend deps-tools
45+
- run: make lint-go
6246
env:
63-
GOPROXY: https://goproxy.io # proxy.golang.org is blocked in China, this proxy is not
64-
GOSUMDB: sum.golang.org
6547
TAGS: bindata gogit sqlite sqlite_unlock_notify
66-
- name: checks backend
67-
run: make --always-make checks-backend # ensure the 'go-licenses' make target runs
68-
check_backend:
48+
checks-backend:
6949
runs-on: ubuntu-latest
7050
steps:
71-
- name: checkout
72-
uses: actions/checkout@v3
73-
- name: setup go
74-
uses: actions/setup-go@v4
51+
- uses: actions/checkout@v3
52+
- uses: actions/setup-go@v4
7553
with:
76-
go-version: '>=1.20'
54+
go-version: ">=1.20"
7755
check-latest: true
78-
- name: deps-backend
79-
run: make deps-backend deps-tools
80-
- name: checks backend
81-
run: make --always-make checks-backend # ensure the 'go-licenses' make target runs
56+
- run: make deps-backend deps-tools
57+
- run: make --always-make checks-backend # ensure the "go-licenses" make target runs
8258
frontend:
8359
runs-on: ubuntu-latest
8460
steps:
85-
- name: checkout
86-
uses: actions/checkout@v3
87-
- name: setup node
88-
uses: actions/setup-node@v3
61+
- uses: actions/checkout@v3
62+
- uses: actions/setup-node@v3
8963
with:
9064
node-version: 20
91-
- name: deps-frontend
92-
run: make deps-frontend
93-
- name: lint frontend
94-
run: make lint-frontend
95-
- name: checks frontend
96-
run: make checks-frontend
97-
- name: test frontend
98-
run: make test-frontend
65+
- run: make deps-frontend
66+
- run: make lint-frontend
67+
- run: make checks-frontend
9968
backend:
10069
runs-on: ubuntu-latest
10170
steps:
102-
- name: checkout
103-
uses: actions/checkout@v3
104-
- name: setup go
105-
uses: actions/setup-go@v4
71+
- uses: actions/checkout@v3
72+
- uses: actions/setup-go@v4
10673
with:
107-
go-version: '>=1.20'
74+
go-version: ">=1.20"
10875
check-latest: true
109-
- name: setup node
110-
uses: actions/setup-node@v3
76+
- uses: actions/setup-node@v3
11177
with:
11278
node-version: 20
113-
- name: deps-backend
114-
run: make deps-backend deps-tools
115-
- name: deps-frontend
116-
run: make deps-frontend
117-
- name: build frontend
118-
run: make frontend
119-
- name: build-backend-no-gcc
120-
run: go build -o gitea_no_gcc # test if build succeeds without the sqlite tag
121-
env:
122-
GOPROXY: https://goproxy.io
79+
- run: make deps-backend deps-tools
80+
- run: make deps-frontend
81+
- run: make frontend
82+
- run: go build -o gitea_no_gcc # test if build succeeds without the sqlite tag
12383
- name: build-backend-arm64
12484
run: make backend # test cross compile
12585
env:
126-
GOPROXY: https://goproxy.io
12786
GOOS: linux
12887
GOARCH: arm64
12988
TAGS: bindata gogit
13089
- name: build-backend-windows
13190
run: go build -o gitea_windows
13291
env:
133-
GOPROXY: https://goproxy.io
13492
GOOS: windows
13593
GOARCH: amd64
13694
TAGS: bindata gogit
13795
- name: build-backend-386
13896
run: go build -o gitea_linux_386 # test if compatible with 32 bit
13997
env:
140-
GOPROXY: https://goproxy.io
14198
GOOS: linux
14299
GOARCH: 386

‎.github/workflows/pull-compliance_docs.yml

Lines changed: 0 additions & 26 deletions
This file was deleted.
Lines changed: 48 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: "Pull: Database Tests"
1+
name: db-tests
22

33
on: [pull_request]
44

@@ -7,8 +7,7 @@ concurrency:
77
cancel-in-progress: true
88

99
jobs:
10-
# PostgreSQL Tests
11-
db_pgsql_test:
10+
test-pgsql:
1211
runs-on: ubuntu-latest
1312
services:
1413
pgsql:
@@ -33,61 +32,45 @@ jobs:
3332
ports:
3433
- "9000:9000"
3534
steps:
36-
- name: checkout
37-
uses: actions/checkout@v3
38-
- name: setup go
39-
uses: actions/setup-go@v4
35+
- uses: actions/checkout@v3
36+
- uses: actions/setup-go@v4
4037
with:
41-
go-version: '>=1.20.0'
38+
go-version: ">=1.20.0"
4239
- name: Add hosts to /etc/hosts
4340
run: echo "127.0.0.1 pgsql ldap minio" | sudo tee -a /etc/hosts
44-
- name: install dependencies
45-
run: make deps-backend
46-
- name: build
47-
run: make backend
41+
- run: make deps-backend
42+
- run: make backend
4843
env:
49-
GOPROXY: https://goproxy.io
50-
GOSUMDB: sum.golang.org
5144
TAGS: bindata
52-
- name: run tests
53-
run: timeout -s ABRT 50m make test-pgsql-migration test-pgsql
45+
- run: make test-pgsql-migration test-pgsql
46+
timeout-minutes: 50
5447
env:
55-
GOPROXY: https://goproxy.io
5648
TAGS: bindata gogit
5749
RACE_ENABLED: true
5850
TEST_TAGS: gogit
5951
TEST_LDAP: 1
6052
USE_REPO_TEST_DIR: 1
6153

62-
# SQLite Tests
63-
db_sqlite_test:
54+
test-sqlite:
6455
runs-on: ubuntu-latest
6556
steps:
66-
- name: checkout
67-
uses: actions/checkout@v3
68-
- name: setup go
69-
uses: actions/setup-go@v4
57+
- uses: actions/checkout@v3
58+
- uses: actions/setup-go@v4
7059
with:
71-
go-version: '>=1.20.0'
72-
- name: install dependencies
73-
run: make deps-backend
74-
- name: build
75-
run: make backend
60+
go-version: ">=1.20.0"
61+
- run: make deps-backend
62+
- run: make backend
7663
env:
77-
GOPROXY: https://goproxy.io
78-
GOSUMDB: sum.golang.org
7964
TAGS: bindata gogit sqlite sqlite_unlock_notify
80-
- name: run tests
81-
run: timeout -s ABRT 50m make test-sqlite-migration test-sqlite
65+
- run: make test-sqlite-migration test-sqlite
66+
timeout-minutes: 50
8267
env:
83-
GOPROXY: https://goproxy.io
8468
TAGS: bindata gogit sqlite sqlite_unlock_notify
8569
RACE_ENABLED: true
8670
TEST_TAGS: gogit sqlite sqlite_unlock_notify
8771
USE_REPO_TEST_DIR: 1
8872

89-
# Unit Tests
90-
db_unit_tests:
73+
test-unit:
9174
runs-on: ubuntu-latest
9275
services:
9376
mysql:
@@ -112,48 +95,38 @@ jobs:
11295
- "993:993"
11396
redis:
11497
image: redis
115-
# Set health checks to wait until redis has started
116-
options: >-
98+
options: >- # wait until redis has started
11799
--health-cmd "redis-cli ping"
118100
--health-interval 5s
119101
--health-timeout 3s
120102
--health-retries 10
121103
ports:
122104
- 6379:6379
123105
steps:
124-
- name: checkout
125-
uses: actions/checkout@v3
126-
- name: setup go
127-
uses: actions/setup-go@v4
106+
- uses: actions/checkout@v3
107+
- uses: actions/setup-go@v4
128108
with:
129-
go-version: '>=1.20.0'
109+
go-version: ">=1.20.0"
130110
- name: Add hosts to /etc/hosts
131111
run: echo "127.0.0.1 mysql elasticsearch smtpimap" | sudo tee -a /etc/hosts
132-
- name: install dependencies
133-
run: make deps-backend
134-
- name: build
135-
run: make backend
112+
- run: make deps-backend
113+
- run: make backend
136114
env:
137-
GOPROXY: https://goproxy.io
138-
GOSUMDB: sum.golang.org
139115
TAGS: bindata
140-
- name: unit tests
116+
- name: unit-tests
141117
run: make unit-test-coverage test-check
142118
env:
143-
GOPROXY: https://goproxy.io
144119
TAGS: bindata
145120
RACE_ENABLED: true
146121
GITHUB_READ_TOKEN: ${{ secrets.GITHUB_READ_TOKEN }}
147-
- name: unit tests (gogit)
122+
- name: unit-tests-gogit
148123
run: make unit-test-coverage test-check
149124
env:
150-
GOPROXY: https://goproxy.io
151125
TAGS: bindata gogit
152126
RACE_ENABLED: true
153127
GITHUB_READ_TOKEN: ${{ secrets.GITHUB_READ_TOKEN }}
154128

155-
# MySQL Tests
156-
db_mysql_test:
129+
test-mysql5:
157130
runs-on: ubuntu-latest
158131
services:
159132
mysql:
@@ -177,33 +150,25 @@ jobs:
177150
- "587:587"
178151
- "993:993"
179152
steps:
180-
- name: checkout
181-
uses: actions/checkout@v3
182-
- name: setup go
183-
uses: actions/setup-go@v4
153+
- uses: actions/checkout@v3
154+
- uses: actions/setup-go@v4
184155
with:
185-
go-version: '>=1.20.0'
156+
go-version: ">=1.20.0"
186157
- name: Add hosts to /etc/hosts
187158
run: echo "127.0.0.1 mysql elasticsearch smtpimap" | sudo tee -a /etc/hosts
188-
- name: install dependencies
189-
run: make deps-backend
190-
- name: build
191-
run: make backend
159+
- run: make deps-backend
160+
- run: make backend
192161
env:
193-
GOPROXY: https://goproxy.io
194-
GOSUMDB: sum.golang.org
195162
TAGS: bindata
196163
- name: run tests
197164
run: make test-mysql-migration integration-test-coverage
198165
env:
199-
GOPROXY: https://goproxy.io
200166
TAGS: bindata
201167
RACE_ENABLED: true
202168
USE_REPO_TEST_DIR: 1
203169
TEST_INDEXER_CODE_ES_URL: "http://elastic:changeme@elasticsearch:9200"
204170

205-
# MySQL8 Tests
206-
db_mysql8_test:
171+
test-mysql8:
207172
runs-on: ubuntu-latest
208173
services:
209174
mysql8:
@@ -214,31 +179,23 @@ jobs:
214179
ports:
215180
- "3306:3306"
216181
steps:
217-
- name: checkout
218-
uses: actions/checkout@v3
219-
- name: setup go
220-
uses: actions/setup-go@v4
182+
- uses: actions/checkout@v3
183+
- uses: actions/setup-go@v4
221184
with:
222-
go-version: '>=1.20.0'
185+
go-version: ">=1.20.0"
223186
- name: Add hosts to /etc/hosts
224187
run: echo "127.0.0.1 mysql8" | sudo tee -a /etc/hosts
225-
- name: install dependencies
226-
run: make deps-backend
227-
- name: build
228-
run: make backend
188+
- run: make deps-backend
189+
- run: make backend
229190
env:
230-
GOPROXY: https://goproxy.io
231-
GOSUMDB: sum.golang.org
232191
TAGS: bindata
233-
- name: run tests
234-
run: timeout -s ABRT 50m make test-mysql8-migration test-mysql8
192+
- run: make test-mysql8-migration test-mysql8
193+
timeout-minutes: 50
235194
env:
236-
GOPROXY: https://goproxy.io
237195
TAGS: bindata
238196
USE_REPO_TEST_DIR: 1
239197

240-
# MSSQL Tests
241-
db_mssql_test:
198+
test-mssql:
242199
runs-on: ubuntu-latest
243200
services:
244201
mssql:
@@ -250,25 +207,18 @@ jobs:
250207
ports:
251208
- "1433:1433"
252209
steps:
253-
- name: checkout
254-
uses: actions/checkout@v3
255-
- name: setup go
256-
uses: actions/setup-go@v4
210+
- uses: actions/checkout@v3
211+
- uses: actions/setup-go@v4
257212
with:
258-
go-version: '>=1.20.0'
213+
go-version: ">=1.20.0"
259214
- name: Add hosts to /etc/hosts
260215
run: echo "127.0.0.1 mssql" | sudo tee -a /etc/hosts
261-
- name: install dependencies
262-
run: make deps-backend
263-
- name: build
264-
run: make backend
216+
- run: make deps-backend
217+
- run: make backend
265218
env:
266-
GOPROXY: https://goproxy.io
267-
GOSUMDB: sum.golang.org
268219
TAGS: bindata
269-
- name: run tests
270-
run: timeout -s ABRT 50m make test-mssql-migration test-mssql
220+
- run: make test-mssql-migration test-mssql
221+
timeout-minutes: 50
271222
env:
272-
GOPROXY: https://goproxy.io
273223
TAGS: bindata
274224
USE_REPO_TEST_DIR: 1
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: docker-dryrun
2+
3+
on: [pull_request]
4+
5+
concurrency:
6+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
7+
cancel-in-progress: true
8+
9+
jobs:
10+
docker-dryrun:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: docker/setup-buildx-action@v2
14+
- uses: docker/build-push-action@v4
15+
with:
16+
push: false
17+
tags: gitea/gitea:linux-amd64

‎.github/workflows/pull-docker_dryrun.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.

‎.github/workflows/pull-e2e-tests.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: e2e-tests
2+
3+
on: [pull_request]
4+
5+
concurrency:
6+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
7+
cancel-in-progress: true
8+
9+
jobs:
10+
test-e2e:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- uses: actions/setup-go@v4
15+
with:
16+
go-version: ">=1.20"
17+
check-latest: true
18+
- uses: actions/setup-node@v3
19+
with:
20+
node-version: 20
21+
- run: make deps-frontend frontend deps-backend
22+
- run: npx playwright install --with-deps
23+
- run: make test-e2e-sqlite
24+
timeout-minutes: 40
25+
env:
26+
USE_REPO_TEST_DIR: 1

‎.github/workflows/pull-e2e.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

‎Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ lint-go:
394394
lint-go-fix:
395395
$(GO) run $(GOLANGCI_LINT_PACKAGE) run --fix
396396

397-
# workaround step for the lint-backend-windows CI task because 'go run' can not
397+
# workaround step for the lint-go-windows CI task because 'go run' can not
398398
# have distinct GOOS/GOARCH for its build and run steps
399399
.PHONY: lint-go-windows
400400
lint-go-windows:
@@ -409,7 +409,7 @@ lint-go-vet:
409409

410410
.PHONY: lint-editorconfig
411411
lint-editorconfig:
412-
$(GO) run $(EDITORCONFIG_CHECKER_PACKAGE) templates
412+
$(GO) run $(EDITORCONFIG_CHECKER_PACKAGE) templates .github/workflows
413413

414414
.PHONY: watch
415415
watch:

0 commit comments

Comments
 (0)
Please sign in to comment.