Skip to content

Commit 1631015

Browse files
authored
feat: Adding lint.yml and strict-lint.yml workflows for GitHub Actions (#4172)
* feat: Adding `lint.yml` and `strict-lint.yml` workflows for GitHub Actions * feat: Use Makefile recipes * fix: Also run on push to `main`
1 parent a671fa0 commit 1631015

File tree

5 files changed

+100
-32
lines changed

5 files changed

+100
-32
lines changed

.circleci/config.yml

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -237,11 +237,6 @@ jobs:
237237
command: |
238238
make install-mockery
239239
make generate-mocks
240-
- run:
241-
name: run lint
242-
command: |
243-
make install-lint
244-
make run-lint
245240
- run:
246241
command: |
247242
mkdir -p logs
@@ -561,20 +556,6 @@ jobs:
561556
- store_test_results:
562557
path: logs
563558

564-
strict_lint:
565-
resource_class: medium
566-
<<: *defaults
567-
<<: *env
568-
steps:
569-
- checkout
570-
# The `run-strict-lint` target requires the `main` ref for comparison.
571-
- run: git fetch
572-
- run:
573-
name: Run strict lint
574-
command: |
575-
make install-lint
576-
make run-strict-lint
577-
578559
# Run TFLint tests separately as tflint during execution change working directory.
579560
integration_test_tflint:
580561
resource_class: large
@@ -1024,15 +1005,3 @@ workflows:
10241005
- GCP__automated-tests
10251006
- GITHUB__PAT__gruntwork-ci
10261007
- APPLE__OSX__code-signing
1027-
unessential:
1028-
jobs:
1029-
- strict_lint:
1030-
filters:
1031-
tags:
1032-
only:
1033-
- /^v.*/
1034-
- /^alpha.*/
1035-
context:
1036-
- AWS__PHXDEVOPS__circle-ci-test
1037-
- GCP__automated-tests
1038-
- GITHUB__PAT__gruntwork-ci

.github/workflows/build-no-proxy.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
name: Build Without Go Proxy
22

33
on:
4+
push:
5+
branches:
6+
- main
47
pull_request:
58
types: [opened, synchronize, reopened]
69

710
jobs:
811
build-no-proxy:
9-
name: Build Without Go Proxy (${{ matrix.os }}/${{ matrix.arch }})
12+
name: Build (${{ matrix.os }}/${{ matrix.arch }})
1013
runs-on: ubuntu-latest
1114
strategy:
1215
matrix:

.github/workflows/lint.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
types: [opened, synchronize, reopened]
9+
10+
jobs:
11+
lint:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Set up mise
18+
uses: jdx/mise-action@v2
19+
with:
20+
version: 2025.4.4
21+
22+
- id: go-cache-paths
23+
run: |
24+
echo "go-build=$(go env GOCACHE)" >> "$GITHUB_OUTPUT"
25+
echo "go-mod=$(go env GOMODCACHE)" >> "$GITHUB_OUTPUT"
26+
27+
# TODO: Make this less brittle.
28+
echo "golanci-lint-cache=/home/runner/.cache/golangci-lint" >> "$GITHUB_OUTPUT"
29+
30+
- name: Go Build Cache
31+
uses: actions/cache@v4
32+
with:
33+
path: ${{ steps.go-cache-paths.outputs.go-build }}
34+
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
35+
36+
- name: Go Mod Cache
37+
uses: actions/cache@v4
38+
with:
39+
path: ${{ steps.go-cache-paths.outputs.go-mod }}
40+
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
41+
42+
- name: golangci-lint Cache
43+
uses: actions/cache@v4
44+
with:
45+
path: ${{ steps.go-cache-paths.outputs.golanci-lint-cache }}
46+
key: ${{ runner.os }}-golangci-lint-${{ hashFiles('**/go.sum') }}
47+
48+
- name: Lint
49+
run: make run-lint

.github/workflows/strict-lint.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Strict Lint
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
7+
jobs:
8+
lint:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- name: Set up mise
15+
uses: jdx/mise-action@v2
16+
with:
17+
version: 2025.4.4
18+
19+
- id: go-cache-paths
20+
run: |
21+
echo "go-build=$(go env GOCACHE)" >> "$GITHUB_OUTPUT"
22+
echo "go-mod=$(go env GOMODCACHE)" >> "$GITHUB_OUTPUT"
23+
24+
# TODO: Make this less brittle.
25+
echo "golanci-lint-cache=/home/runner/.cache/golangci-lint" >> "$GITHUB_OUTPUT"
26+
27+
- name: Go Build Cache
28+
uses: actions/cache@v4
29+
with:
30+
path: ${{ steps.go-cache-paths.outputs.go-build }}
31+
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
32+
33+
- name: Go Mod Cache
34+
uses: actions/cache@v4
35+
with:
36+
path: ${{ steps.go-cache-paths.outputs.go-mod }}
37+
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
38+
39+
- name: golangci-lint Cache
40+
uses: actions/cache@v4
41+
with:
42+
path: ${{ steps.go-cache-paths.outputs.golanci-lint-cache }}
43+
key: ${{ runner.os }}-golangci-lint-${{ hashFiles('**/go.sum') }}
44+
45+
- name: Lint
46+
run: make run-strict-lint

mise.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
[tools]
22
go = "1.23.8"
33
opentofu = "1.9.0"
4+
golangci-lint = "1.64.6"

0 commit comments

Comments
 (0)