@@ -150,43 +150,77 @@ jobs:
150
150
# run: git diff --exit-code
151
151
152
152
lint :
153
- runs-on :windows-latest-16-cores
153
+ needs :changes
154
+ if :needs.changes.outputs.offlinedocs-only == 'false' || needs.changes.outputs.ci == 'true' || github.ref == 'refs/heads/main'
155
+ runs-on :${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-8' || 'ubuntu-latest' }}
154
156
steps :
155
- -name :Checkout code
156
- uses :actions/checkout@v4
157
+ -name :Harden Runner
158
+ uses :step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
159
+ with :
160
+ egress-policy :audit
157
161
158
- -name :Download ImDisk
159
- shell :bash
162
+ -name :Checkout
163
+ uses :actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
164
+ with :
165
+ fetch-depth :1
166
+
167
+ -name :Setup Node
168
+ uses :./.github/actions/setup-node
169
+
170
+ -name :Setup Go
171
+ uses :./.github/actions/setup-go
172
+
173
+ -name :Get golangci-lint cache dir
160
174
run :|
161
- mkdir imdisk
162
- cd imdisk
163
- curl -L -o files.cab https://imdisk-ci-files.pages.dev/ImDiskTk20241123/files.cab
164
- curl -L -o install.bat https://imdisk-ci-files.pages.dev/ImDiskTk20241123/install.bat
165
- cd ..
166
-
167
- -name :Install ImDisk
168
- shell :cmd
175
+ linter_ver=$(egrep -o 'GOLANGCI_LINT_VERSION=\S+' dogfood/contents/Dockerfile | cut -d '=' -f 2)
176
+ go install github.com/golangci/golangci-lint/cmd/golangci-lint@v$linter_ver
177
+ dir=$(golangci-lint cache status | awk '/Dir/ { print $2 }')
178
+ echo "LINT_CACHE_DIR=$dir" >> $GITHUB_ENV
179
+
180
+ -name :golangci-lint cache
181
+ uses :actions/cache@2cdf405574d6ef1f33a1d12acccd3ae82f47b3f2 # v4.1.0
182
+ with :
183
+ path :|
184
+ ${{ env.LINT_CACHE_DIR }}
185
+ key :golangci-lint-${{ runner.os }}-${{ hashFiles('**/*.go') }}
186
+ restore-keys :|
187
+ golangci-lint-${{ runner.os }}-
188
+
189
+ # Check for any typos
190
+ -name :Check for typos
191
+ uses :crate-ci/typos@b74202f74b4346efdbce7801d187ec57b266bac8 # v1.27.3
192
+ with :
193
+ config :.github/workflows/typos.toml
194
+
195
+ -name :Fix the typos
196
+ if :${{ failure() }}
169
197
run :|
170
- cd imdisk
171
- install.bat /silent
172
-
173
- -name :Create RAM Disk
174
- shell :cmd
198
+ echo "::notice:: you can automatically fix typos from your CLI:
199
+ cargo install typos-cli
200
+ typos -c .github/workflows/typos.toml -w"
201
+
202
+ # Needed for helm chart linting
203
+ -name :Install helm
204
+ uses :azure/setup-helm@fe7b79cd5ee1e45176fcad797de68ecaf3ca4814 # v4.2.0
205
+ with :
206
+ version :v3.9.2
207
+
208
+ -name :make lint
175
209
run :|
176
- imdisk -a -s 512M -m R: -p "/fs:ntfs /q /y"
177
-
178
- -name :Test RAM Disk
179
- shell :cmd
210
+ make --output-sync=line -j lint
211
+
212
+ -name :Check workflow files
180
213
run :|
181
- dir R:
182
- echo "Testing write to RAM disk" > R:\test.txt
183
- type R:\test.txt
184
-
185
- -name :Cleanup RAM Disk
186
- if :always()
187
- shell :cmd
214
+ bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) 1.7.4
215
+ ./actionlint -color -shellcheck= -ignore "set-output"
216
+ shell :bash
217
+
218
+ -name :Check for unstaged files
188
219
run :|
189
- imdisk -D -m R:
220
+ rm -f ./actionlint ./typos
221
+ ./scripts/check_unstaged.sh
222
+ shell :bash
223
+
190
224
191
225
gen :
192
226
timeout-minutes :8