Skip to content

Commit a6d7d10

Browse files
committed
Separate linter test to own workflow to only run it when necessary
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
1 parent 97c8e01 commit a6d7d10

3 files changed

Lines changed: 48 additions & 3 deletions

File tree

.github/workflows/ci-linter.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- release-v*
8+
paths:
9+
- tools/tfproviderlint/**
10+
pull_request:
11+
branches:
12+
- main
13+
- release-v*
14+
paths:
15+
- tools/tfproviderlint/**
16+
17+
concurrency:
18+
group: ci-linter-${{ github.ref }}
19+
cancel-in-progress: true
20+
21+
defaults:
22+
run:
23+
shell: bash
24+
25+
jobs:
26+
test:
27+
name: Custom Linter Tests
28+
runs-on: ubuntu-latest
29+
permissions:
30+
contents: read
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
34+
- name: Set-up Go
35+
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
36+
with:
37+
go-version-file: go.mod
38+
cache: true
39+
cache-dependency-path: |
40+
go.sum
41+
tools/tfproviderlint/go.sum
42+
- run: make test-tools

.github/workflows/ci.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ jobs:
3939
cache: true
4040
- run: make build -o lintcheck
4141
- run: make test
42-
- run: make test-tools
4342
golangci:
4443
name: lint
4544
runs-on: ubuntu-latest
@@ -71,6 +70,10 @@ jobs:
7170
with:
7271
go-version-file: go.mod
7372
cache: true
73+
cache-dependency-path: |
74+
go.sum
75+
tools/tfproviderlint/go.sum
76+
custom-gcl
7477
- run: make .golangci.new.yml
7578
- name: golangci-lint
7679
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0

tools/tfproviderlint/GNUmakefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ test_go_sums = $(patsubst %/go.mod,%/go.sum,$(wildcard checks/*/testdata/go.mod)
22

33
.SECONDEXPANSION:
44
checks/%/testdata/go.sum: checks/%/testdata/go.mod $$(wildcard checks/$$*/*.go)
5-
cd $(dir $@) && go mod tidy
5+
@cd $(dir $@) && go mod tidy
66

77
go.sum: go.mod $(shell find checks -name '*.go' -maxdepth 2)
8-
go mod tidy
8+
@go mod tidy
99

1010
test: go.sum $(test_go_sums)
1111
CGO_ENABLED=0 go test ./... -v -count=1 -timeout=30s -parallel=4

0 commit comments

Comments
 (0)