Skip to content

Commit fc06349

Browse files
ci(wasmcloud): run actions only if wasmcloud files change
Signed-off-by: Brooks Townsend <brooksmtownsend@gmail.com>
1 parent 85ede3c commit fc06349

File tree

1 file changed

+79
-2
lines changed

1 file changed

+79
-2
lines changed

.github/workflows/wasmcloud.yml

Lines changed: 79 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,47 @@ concurrency:
9898
cancel-in-progress: true
9999

100100
jobs:
101+
meta:
102+
runs-on: ubuntu-latest
103+
outputs:
104+
wasmcloud_modified: ${{ steps.changes.outputs.wasmcloud }}
105+
providers_modified: ${{ steps.changes.outputs.providers }}
106+
steps:
107+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
108+
- uses: dorny/paths-filter@v3
109+
id: changes
110+
with:
111+
# Consider wasmCloud changed if any Rust file other than
112+
# capability providers change
113+
filters: |
114+
wasmcloud:
115+
- './.github/workflows/wasmcloud.yml'
116+
- './.github/actions/build-nix/action.yml'
117+
- './.github/actions/install-nix/action.yml'
118+
- './.config/nextest.toml'
119+
- 'nix/images/default.nix'
120+
- 'flake.lock'
121+
- 'flake.nix'
122+
- 'Cargo.lock'
123+
- 'Cargo.toml'
124+
- 'rust-toolchain.toml'
125+
- 'crates/**/*'
126+
- 'crates/provider-sdk/*'
127+
- 'src/**/*'
128+
- 'tests/**/*'
129+
- 'wit/**/*'
130+
- '!crates/provider-*'
131+
- '!crates/wash-*/'
132+
- '!crates/**/*.md'
133+
- '!wit/**/*.md'
134+
providers:
135+
- 'Cargo.lock'
136+
- 'Cargo.toml'
137+
- 'crates/provider-*'
138+
- 'crates/provider-sdk/*'
101139
build-bin:
140+
needs: [meta]
141+
if: ${{ needs.meta.outputs.wasmcloud_modified == 'true' || startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/tags/wash-cli-v')}}
102142
strategy:
103143
matrix:
104144
config:
@@ -172,8 +212,8 @@ jobs:
172212
if: ${{ !endsWith(matrix.config.target, 'fhs') }}
173213

174214
build-windows:
215+
if: ${{ startswith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main'}}
175216
name: wasmcloud-x86_64-pc-windows-msvc
176-
if: startswith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main'
177217
runs-on: windows-latest
178218
steps:
179219
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
@@ -262,6 +302,8 @@ jobs:
262302
- run: .\bin\wasmcloud.exe --version
263303

264304
cargo:
305+
needs: [meta]
306+
if: ${{ needs.meta.outputs.wasmcloud_modified == 'true' || startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/tags/wash-cli-v')}}
265307
strategy:
266308
matrix:
267309
check:
@@ -281,6 +323,9 @@ jobs:
281323
- run: nix build -L .#checks.x86_64-linux.${{ matrix.check }}
282324

283325
build-doc:
326+
needs: [meta]
327+
# TODO: maybe we just need this for wasmcloud_host changes
328+
if: ${{ needs.meta.outputs.wasmcloud_modified == 'true' }}
284329
runs-on: ubuntu-22.04
285330
steps:
286331
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
@@ -306,7 +351,7 @@ jobs:
306351
path: doc
307352

308353
providers:
309-
if: startswith(github.ref, 'refs/tags/provider-')
354+
if: ${{ needs.meta.outputs.providers_modified == 'true' || startswith(github.ref, 'refs/tags/provider-') }}
310355
strategy:
311356
matrix:
312357
include:
@@ -344,6 +389,7 @@ jobs:
344389
subject: SQLDB_POSTGRES_SUBJECT
345390

346391
needs:
392+
- meta
347393
- build-bin
348394
- build-windows
349395
- test-linux
@@ -778,3 +824,34 @@ jobs:
778824
git config --global user.email "automation@wasmcloud.com"
779825
git config --global user.name "wasmCloud automation"
780826
cargo smart-release --update-crates-index --execute --no-changelog-preview --no-changelog ${{ inputs.additional-args }} ${{ inputs.crate }}
827+
828+
# This check always runs, and succeeds either if no relevant wasmCloud files were modified or jobs are successful.
829+
wasmcloud_successful_checks:
830+
needs:
831+
- meta
832+
- build-bin
833+
- build-lipo
834+
- test-linux
835+
- cargo
836+
- build-doc
837+
- providers
838+
- deploy-doc
839+
- oci
840+
if: ${{ always() }}
841+
runs-on: ubuntu-latest
842+
steps:
843+
- name: Results
844+
run: |
845+
echo 'needs.integration_tests.result: ${{ needs.integration_tests.result }}'
846+
echo 'needs.build-bin.result: ${{ needs.build-bin.result }}'
847+
echo 'needs.build-lipo.result: ${{ needs.build-lipo.result }}'
848+
echo 'needs.test-linux.result: ${{ needs.test-linux.result }}'
849+
echo 'needs.cargo.result: ${{ needs.cargo.result }}'
850+
echo 'needs.build-doc.result: ${{ needs.build-doc.result }}'
851+
echo 'needs.providers.result: ${{ needs.providers.result }}'
852+
echo 'needs.deploy-doc.result: ${{ needs.deploy-doc.result }}'
853+
echo 'needs.oci.result: ${{ needs.oci.result }}'
854+
- name: Verify jobs
855+
# All jobs must succeed or be skipped.
856+
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
857+
run: exit 1

0 commit comments

Comments
 (0)