Reduce CI jobs being run when not needed

This commit is contained in:
Gabe Kangas
2024-07-11 11:44:23 -07:00
parent e7d90d441e
commit c4756a9a45
4 changed files with 56 additions and 4 deletions

View File

@@ -18,7 +18,16 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Get changed files
id: changed-files-yaml
uses: tj-actions/changed-files@v44
with:
files_yaml: |
src:
- '**/*.{go,mod,sum}'
- uses: actions/cache@v4
if: steps.changed-files-yaml.outputs.src_any_changed == 'true'
with:
path: |
~/.cache/go-build
@@ -28,12 +37,14 @@ jobs:
go-test-
- name: Install go
if: steps.changed-files-yaml.outputs.src_any_changed == 'true'
uses: actions/setup-go@v5
with:
go-version: '^1'
cache: true
- name: Run tests
if: steps.changed-files-yaml.outputs.src_any_changed == 'true'
run: go test ./...
test-bsds:
@@ -50,6 +61,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/cache@v4
if: steps.changed-files-yaml.outputs.src_any_changed == 'true'
with:
path: |
~/.cache/go-build
@@ -60,9 +72,11 @@ jobs:
- name: Install go
uses: actions/setup-go@v5
if: steps.changed-files-yaml.outputs.src_any_changed == 'true'
with:
go-version: '^1'
cache: true
- name: Run tests
if: steps.changed-files-yaml.outputs.src_any_changed == 'true'
run: go test ./...