35
35
ts : ${{ steps.filter.outputs.ts }}
36
36
k8s : ${{ steps.filter.outputs.k8s }}
37
37
ci : ${{ steps.filter.outputs.ci }}
38
+ offlinedocs-only : ${{ steps.filter.outputs.offlinedocs_count == steps.filter.outputs.all_count }}
39
+ offlinedocs : ${{ steps.filter.outputs.offlinedocs }}
38
40
steps :
39
41
- name : Checkout
40
42
uses : actions/checkout@v3
85
87
ts:
86
88
- "site/**"
87
89
- "Makefile"
88
- - "offlinedocs/**"
89
90
k8s:
90
91
- "helm/**"
91
92
- "scripts/Dockerfile"
@@ -94,11 +95,16 @@ jobs:
94
95
ci:
95
96
- ".github/actions/**"
96
97
- ".github/workflows/ci.yaml"
98
+ offlinedocs:
99
+ - "offlinedocs/**"
100
+
97
101
- id : debug
98
102
run : |
99
103
echo "${{ toJSON(steps.filter )}}"
100
104
101
105
lint :
106
+ needs : changes
107
+ if : needs.changes.outputs.offlinedocs-only == 'false' || needs.changes.outputs.ci == 'true' || github.ref == 'refs/heads/main'
102
108
runs-on : ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }}
103
109
steps :
104
110
- name : Checkout
@@ -164,9 +170,7 @@ jobs:
164
170
uses : ./.github/actions/setup-go
165
171
166
172
- name : Setup sqlc
167
- uses : sqlc-dev/setup-sqlc@v3
168
- with :
169
- sqlc-version : " 1.19.1"
173
+ uses : ./.github/actions/setup-sqlc
170
174
171
175
- name : go install tools
172
176
run : |
@@ -196,8 +200,10 @@ jobs:
196
200
run : ./scripts/check_unstaged.sh
197
201
198
202
fmt :
203
+ needs : changes
204
+ if : needs.changes.outputs.offlinedocs-only == 'false' || needs.changes.outputs.ci == 'true' || github.ref == 'refs/heads/main'
199
205
runs-on : ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }}
200
- timeout-minutes : 5
206
+ timeout-minutes : 7
201
207
steps :
202
208
- name : Checkout
203
209
uses : actions/checkout@v3
@@ -569,10 +575,17 @@ jobs:
569
575
with :
570
576
buildScriptName : " storybook:build"
571
577
exitOnceUploaded : true
578
+ # This will prevent CI from failing when Chromatic detects visual changes
579
+ exitZeroOnChanges : true
572
580
# Chromatic states its fine to make this token public. See:
573
581
# https://www.chromatic.com/docs/github-actions#forked-repositories
574
582
projectToken : 695c25b6cb65
575
583
workingDir : " ./site"
584
+ # Prevent excessive build runs on minor version changes
585
+ skip : " @(renovate/**|dependabot/**)"
586
+ # Run TurboSnap to trace file dependencies to related stories
587
+ # and tell chromatic to only take snapshots of relevent stories
588
+ onlyChanged : true
576
589
577
590
# This is a separate step for mainline only that auto accepts and changes
578
591
# instead of holding CI up. Since we squash/merge, this is defensive to
@@ -588,13 +601,77 @@ jobs:
588
601
STORYBOOK : true
589
602
with :
590
603
autoAcceptChanges : true
604
+ # This will prevent CI from failing when Chromatic detects visual changes
605
+ exitZeroOnChanges : true
591
606
buildScriptName : " storybook:build"
592
607
projectToken : 695c25b6cb65
593
608
workingDir : " ./site"
609
+ # Run TurboSnap to trace file dependencies to related stories
610
+ # and tell chromatic to only take snapshots of relevent stories
611
+ onlyChanged : true
612
+
613
+ offlinedocs :
614
+ name : offlinedocs
615
+ needs : changes
616
+ runs-on : ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }}
617
+ if : needs.changes.outputs.offlinedocs == 'true' || needs.changes.outputs.ci == 'true'
618
+ steps :
619
+ - name : Checkout
620
+ uses : actions/checkout@v3
621
+ with :
622
+ fetch-depth : 0
623
+
624
+ - name : Setup Node
625
+ uses : ./.github/actions/setup-node
626
+ with :
627
+ directory : offlinedocs
628
+
629
+ - name : Setup Go
630
+ uses : ./.github/actions/setup-go
631
+
632
+ - name : Install go tools
633
+ run : |
634
+ go install github.com/golang/mock/mockgen@v1.6.0
635
+
636
+ - name : Setup sqlc
637
+ uses : sqlc-dev/setup-sqlc@v3
638
+ with :
639
+ sqlc-version : " 1.19.1"
640
+
641
+ - name : Install dependencies
642
+ run : |
643
+ cd offlinedocs
644
+ yarn
645
+ # Install prettier globally
646
+ prettier_version=$(jq -r '.devDependencies.prettier' < package.json)
647
+ yarn global add "prettier@${prettier_version}"
648
+
649
+ - name : Format
650
+ run : |
651
+ cd offlinedocs
652
+ yarn format:check
653
+
654
+ - name : Lint
655
+ run : |
656
+ cd offlinedocs
657
+ yarn lint
658
+
659
+ - name : Build
660
+ run : |
661
+ version="$(./scripts/version.sh)"
662
+ make -j build/coder_docs_"$version".tgz
594
663
595
664
required :
596
665
runs-on : ubuntu-latest
597
- needs : [fmt, lint, gen, test-go, test-go-pg, test-go-race, test-js]
666
+ needs :
667
+ - fmt
668
+ - lint
669
+ - gen
670
+ - test-go
671
+ - test-go-pg
672
+ - test-go-race
673
+ - test-js
674
+ - offlinedocs
598
675
# Allow this job to run even if the needed jobs fail, are skipped or
599
676
# cancelled.
600
677
if : always()
0 commit comments