Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit634e146

Browse files
ci: skip ts or go tests based on changed files (#7134)
* chore: skip ts or go tests based on files changed* comments* chore: add 'required' job* fixup! chore: add 'required' job* fake go modification* merge main into dean/skip-tests-fe-be* fix typo* remove x_test.go* remove duplicate setup-node action* condition test-go-race too* skip ete on docs changes* allows tests to run if changes are made .github directory---------Co-authored-by: Atif Ali <atif@coder.com>
1 parent71c9089 commit634e146

File tree

1 file changed

+91
-55
lines changed

1 file changed

+91
-55
lines changed

‎.github/workflows/ci.yaml‎

Lines changed: 91 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,71 @@ concurrency:
2727
cancel-in-progress:${{ github.event_name == 'pull_request' }}
2828

2929
jobs:
30+
changes:
31+
runs-on:ubuntu-latest
32+
outputs:
33+
docs-only:${{ steps.filter.outputs.docs_count == steps.filter.outputs.all_count }}
34+
go:${{ steps.filter.outputs.go }}
35+
ts:${{ steps.filter.outputs.ts }}
36+
k8s:${{ steps.filter.outputs.k8s }}
37+
ci:${{ steps.filter.outputs.ci }}
38+
steps:
39+
-uses:actions/checkout@v3
40+
# For pull requests it's not necessary to checkout the code
41+
-uses:dorny/paths-filter@v2
42+
id:filter
43+
with:
44+
filters:|
45+
all:
46+
- "**"
47+
docs:
48+
- "docs/**"
49+
- "README.md"
50+
# For testing:
51+
# - ".github/**"
52+
go:
53+
- "**.sql"
54+
- "**.go"
55+
- "**.golden"
56+
- "go.mod"
57+
- "go.sum"
58+
# Other non-Go files that may affect Go code:
59+
- "**.rego"
60+
- "**.sh"
61+
- "**.tpl"
62+
- "**.gotmpl"
63+
- "**.gotpl"
64+
- "Makefile"
65+
- "site/static/error.html"
66+
# Main repo directories for completeness in case other files are
67+
# touched:
68+
- "agent/**"
69+
- "cli/**"
70+
- "cmd/**"
71+
- "coderd/**"
72+
- "enterprise/**"
73+
- "examples/**"
74+
- "provisioner/**"
75+
- "provisionerd/**"
76+
- "provisionersdk/**"
77+
- "pty/**"
78+
- "scaletest/**"
79+
- "tailnet/**"
80+
- "testutil/**"
81+
ts:
82+
- "site/**"
83+
- "Makefile"
84+
k8s:
85+
- "helm/**"
86+
- "scripts/Dockerfile"
87+
- "scripts/Dockerfile.base"
88+
- "scripts/helm.sh"
89+
ci:
90+
- ".github/**"
91+
-id:debug
92+
run:|
93+
echo "${{ toJSON(steps.filter )}}"
94+
3095
lint:
3196
runs-on:${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }}
3297
steps:
@@ -79,44 +144,11 @@ jobs:
79144
-name:Check for AGPL code importing Enterprise...
80145
run:./scripts/check_enterprise_imports.sh
81146

82-
changes:
83-
runs-on:ubuntu-latest
84-
outputs:
85-
docs-only:${{ steps.filter.outputs.docs_count == steps.filter.outputs.all_count }}
86-
sh:${{ steps.filter.outputs.sh }}
87-
ts:${{ steps.filter.outputs.ts }}
88-
k8s:${{ steps.filter.outputs.k8s }}
89-
steps:
90-
-uses:actions/checkout@v3
91-
# For pull requests it's not necessary to checkout the code
92-
-uses:dorny/paths-filter@v2
93-
id:filter
94-
with:
95-
filters:|
96-
all:
97-
- '**'
98-
docs:
99-
- 'docs/**'
100-
# For testing:
101-
# - '.github/**'
102-
sh:
103-
- "**.sh"
104-
ts:
105-
- 'site/**'
106-
k8s:
107-
- 'helm/**'
108-
- scripts/Dockerfile
109-
- scripts/Dockerfile.base
110-
- scripts/helm.sh
111-
-id:debug
112-
run:|
113-
echo "${{ toJSON(steps.filter )}}"
114-
115147
gen:
116148
timeout-minutes:8
117149
runs-on:${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }}
118150
needs:changes
119-
if:needs.changes.outputs.docs-only == 'false'
151+
if:needs.changes.outputs.docs-only == 'false' || needs.changes.outputs.ci == 'true' || github.ref == 'refs/heads/main'
120152
steps:
121153
-uses:actions/checkout@v3
122154

@@ -182,6 +214,8 @@ jobs:
182214

183215
test-go:
184216
runs-on:${{ matrix.os == 'ubuntu-latest' && github.repository_owner == 'coder' && 'buildjet-4vcpu-ubuntu-2204' || matrix.os == 'macos-latest' && github.repository_owner == 'coder' && 'macos-latest-xl' || matrix.os == 'windows-2019' && github.repository_owner == 'coder' && 'windows-latest-8-cores' || matrix.os }}
217+
needs:changes
218+
if:needs.changes.outputs.go == 'true' || needs.changes.outputs.ci == 'true' || github.ref == 'refs/heads/main'
185219
timeout-minutes:20
186220
strategy:
187221
matrix:
@@ -192,11 +226,6 @@ jobs:
192226
steps:
193227
-uses:actions/checkout@v3
194228

195-
-uses:buildjet/setup-go@v4
196-
with:
197-
cache:false
198-
go-version:${{ env.CODER_GO_VERSION }}
199-
200229
-uses:./.github/actions/setup-go
201230

202231
-uses:hashicorp/setup-terraform@v2
@@ -257,6 +286,8 @@ jobs:
257286

258287
test-go-pg:
259288
runs-on:${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }}
289+
needs:changes
290+
if:needs.changes.outputs.go == 'true' || needs.changes.outputs.ci == 'true' || github.ref == 'refs/heads/main'
260291
# This timeout must be greater than the timeout set by `go test` in
261292
# `make test-postgres` to ensure we receive a trace of running
262293
# goroutines. Setting this to the timeout +5m should work quite well
@@ -310,6 +341,8 @@ jobs:
310341

311342
test-go-race:
312343
runs-on:${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }}
344+
needs:changes
345+
if:needs.changes.outputs.go == 'true' || needs.changes.outputs.ci == 'true' || github.ref == 'refs/heads/main'
313346
timeout-minutes:25
314347
steps:
315348
-uses:actions/checkout@v3
@@ -355,11 +388,6 @@ jobs:
355388
-name:Set up Google Cloud SDK
356389
uses:google-github-actions/setup-gcloud@v1
357390

358-
-uses:buildjet/setup-go@v4
359-
with:
360-
cache:false
361-
go-version:${{ env.CODER_GO_VERSION }}
362-
363391
-uses:./.github/actions/setup-go
364392
-uses:./.github/actions/setup-node
365393

@@ -426,13 +454,15 @@ jobs:
426454

427455
test-js:
428456
runs-on:${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }}
457+
needs:changes
458+
if:needs.changes.outputs.ts == 'true' || needs.changes.outputs.ci == 'true' || github.ref == 'refs/heads/main'
429459
timeout-minutes:20
430460
steps:
431461
-uses:actions/checkout@v3
432462

433463
-uses:./.github/actions/setup-node
434464

435-
-run:yarn test:ci --max-workers ${{ steps.cpu-cores.outputs.count }}
465+
-run:yarn test:ci --max-workers $(nproc)
436466
working-directory:site
437467

438468
-uses:codecov/codecov-action@v3
@@ -448,10 +478,9 @@ jobs:
448478
flags:unittest-js
449479

450480
test-e2e:
451-
needs:
452-
-changes
453-
if:needs.changes.outputs.docs-only == 'false'
454481
runs-on:${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }}
482+
needs:changes
483+
if:needs.changes.outputs.go == 'true' || needs.changes.outputs.ts == 'true' || needs.changes.outputs.ci == 'true' || github.ref == 'refs/heads/main'
455484
timeout-minutes:20
456485
steps:
457486
-uses:actions/checkout@v3
@@ -464,10 +493,6 @@ jobs:
464493
terraform_version:1.1.9
465494
terraform_wrapper:false
466495

467-
-uses:buildjet/setup-node@v3
468-
with:
469-
node-version:"16.16.0"
470-
471496
-name:Build
472497
run:|
473498
sudo npm install -g prettier
@@ -492,9 +517,8 @@ jobs:
492517
chromatic:
493518
# REMARK: this is only used to build storybook and deploy it to Chromatic.
494519
runs-on:ubuntu-latest
495-
needs:
496-
-changes
497-
if:needs.changes.outputs.ts == 'true'
520+
needs:changes
521+
if:needs.changes.outputs.ts == 'true' || needs.changes.outputs.ci == 'true' || github.ref == 'refs/heads/main'
498522
steps:
499523
-uses:actions/checkout@v3
500524
with:
@@ -538,3 +562,15 @@ jobs:
538562
buildScriptName:"storybook:build"
539563
projectToken:695c25b6cb65
540564
workingDir:"./site"
565+
566+
required:
567+
runs-on:ubuntu-latest
568+
needs:[test-go, test-go-pg, test-js]
569+
# allow this job to run even if the previous jobs are skipped
570+
if:|
571+
always() &&
572+
!contains(needs.*.result, 'failure') &&
573+
!contains(needs.*.result, 'cancelled')
574+
steps:
575+
-name:Ensure required checks
576+
run:echo "Required checks have passed"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp