Skip to content

Commit c0af2ba

Browse files
authored
Add an SDK gate as the single required check for the SDK build (#113)
1 parent 9db9828 commit c0af2ba

1 file changed

Lines changed: 58 additions & 10 deletions

File tree

.github/workflows/sdk.yml

Lines changed: 58 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,15 @@
1313
name: SDK
1414

1515
on:
16+
# The workflow ALWAYS triggers on PRs (no top-level `paths:` filter) so the
17+
# `sdk-gate` job below always reports a status — that is what lets it be a
18+
# required check without deadlocking PRs that don't touch the SDK. The heavy
19+
# build legs are skipped for those PRs via the `changes` filter, not by
20+
# suppressing the whole workflow. See issue #109.
1621
push:
1722
branches: [main]
1823
pull_request:
1924
branches: [main]
20-
paths:
21-
- CMake/wheel_sdks/**
22-
- CMake/vtkWheelPreparation.cmake
23-
- ci/build-sdk.sh
24-
- ci/test-sdk.sh
25-
- ci/cmake/linux.cmake
26-
- ci/cmake/macos.cmake
27-
- ci/cmake/windows.cmake
28-
- fvtk-config/**
29-
- .github/workflows/sdk.yml
3025
release:
3126
types: [published]
3227
workflow_dispatch:
@@ -36,8 +31,39 @@ concurrency:
3631
cancel-in-progress: true
3732

3833
jobs:
34+
# PR-only: decide whether the SDK inputs actually changed, so the heavy build
35+
# legs run only when relevant. On push/release/dispatch this job is skipped and
36+
# build-sdk runs unconditionally (see its `if`).
37+
changes:
38+
name: detect SDK changes
39+
if: github.event_name == 'pull_request'
40+
runs-on: ubuntu-latest
41+
outputs:
42+
sdk: ${{ steps.filter.outputs.sdk }}
43+
steps:
44+
- uses: actions/checkout@v5
45+
- uses: dorny/paths-filter@v3
46+
id: filter
47+
with:
48+
filters: |
49+
sdk:
50+
- 'CMake/wheel_sdks/**'
51+
- 'CMake/vtkWheelPreparation.cmake'
52+
- 'ci/build-sdk.sh'
53+
- 'ci/test-sdk.sh'
54+
- 'ci/cmake/linux.cmake'
55+
- 'ci/cmake/macos.cmake'
56+
- 'ci/cmake/windows.cmake'
57+
- 'fvtk-config/**'
58+
- '.github/workflows/sdk.yml'
59+
3960
build-sdk:
4061
name: build fvtk-sdk (${{ matrix.os }})
62+
# On PRs: run only when the SDK inputs changed. On push/release/dispatch:
63+
# always (the `changes` job is skipped there, so the second clause carries it;
64+
# `!cancelled()` lets this run despite that skipped dependency).
65+
needs: changes
66+
if: ${{ !cancelled() && (github.event_name != 'pull_request' || needs.changes.outputs.sdk == 'true') }}
4167
# Heavy C++ compile (same VTK kit as the runtime wheel) → Blacksmith runners
4268
# when the FVTK_RUNNER_* vars are set, else the github-hosted defaults. The
4369
# `os` key is the stable artifact suffix; `runner.os`/uname inside the build
@@ -103,6 +129,28 @@ jobs:
103129
path: sdk-dist/*.whl
104130
if-no-files-found: error
105131

132+
# Single stable required check. Runs on every event (always()), so it always
133+
# reports — make THIS the required status in the branch ruleset, never the
134+
# per-OS `build fvtk-sdk (...)` legs (their names change with the matrix, and
135+
# they don't run on SDK-irrelevant PRs). Passes when build-sdk succeeded OR was
136+
# skipped (SDK inputs unchanged); fails on any leg failure/cancellation. See #109.
137+
sdk-gate:
138+
name: SDK gate
139+
needs: build-sdk
140+
if: ${{ always() }}
141+
runs-on: ubuntu-latest
142+
steps:
143+
- name: Require build-sdk to pass or be skipped
144+
run: |
145+
r='${{ needs.build-sdk.result }}'
146+
echo "build-sdk result: $r"
147+
if [ "$r" = success ] || [ "$r" = skipped ]; then
148+
echo "SDK gate OK ($r)"
149+
else
150+
echo "::error::SDK build $r"
151+
exit 1
152+
fi
153+
106154
publish-sdk:
107155
name: Publish fvtk-sdk to PyPI (trusted publishing)
108156
# Release-only. Requires a PyPI trusted publisher on project `fvtk-sdk`

0 commit comments

Comments
 (0)