Skip to content

Commit 60a8cf2

Browse files
authored
Merge pull request #768 from SumoLogic/sjain-fix-matrix-test-job-run-condition
Matrix test step should be a noop when only doc change is pushed
2 parents 025d0f8 + 92c85dd commit 60a8cf2

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

.github/workflows/test.yml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
# you can turn it on using a cron schedule for regular testing.
33
#
44
name: Tests
5+
permissions:
6+
contents: read
57
on:
68
pull_request:
79
branches: [ master ]
@@ -29,8 +31,23 @@ on:
2931
concurrency: "TfAccTests"
3032

3133
jobs:
34+
should_test:
35+
runs-on: ubuntu-latest
36+
outputs:
37+
run_tests: ${{ steps.filter.outputs.run_tests }}
38+
steps:
39+
- uses: dorny/paths-filter@v2
40+
id: filter
41+
with:
42+
filters: |
43+
run_tests:
44+
- '!CHANGELOG.md'
45+
- '!README.md'
46+
- '!website/**'
3247
# ensure the code builds...
3348
build:
49+
if: needs.should_test.outputs.run_tests == 'true'
50+
needs: should_test
3451
name: Build
3552
runs-on: ubuntu-latest
3653
timeout-minutes: 5
@@ -53,8 +70,9 @@ jobs:
5370
go build -v .
5471
# run acceptance tests in a matrix with Terraform core versions
5572
test:
56-
name: Matrix Test
73+
if: needs.should_test.outputs.run_tests == 'true'
5774
needs: build
75+
name: Matrix Test
5876
runs-on: ubuntu-latest
5977
timeout-minutes: 90
6078
strategy:
@@ -110,3 +128,10 @@ jobs:
110128
# disable go test timeout. We rely on GitHub action timeout.
111129
run: |
112130
go test -timeout 0 -v -cover ./sumologic/
131+
# skip acceptance tests
132+
skip:
133+
if: needs.should_test.outputs.run_tests != 'true'
134+
needs: should_test
135+
runs-on: ubuntu-latest
136+
steps:
137+
- run: echo "Skipping tests because only docs or website files changed."

0 commit comments

Comments
 (0)