Skip to content

Commit

Permalink
BUG: Skip "CI (Build)" workflow for SuperBuild changes on "nightly-main"
Browse files Browse the repository at this point in the history
Skip the "CI (Build)" workflow if changes to "External_*.cmake" files are
detected since the last Preview build. Pull request builds likely require
an updated Docker image, which provides external dependencies, and building
with outdated dependencies could lead to failures. To avoid this, the CI build
is skipped when SuperBuild file changes may require an updated image.

Additionally, since the GitHub action `dorny/paths-filter` does not suppor
specifying the `base` input for pull request events, we replaced it with the
`tj-actions/changed-files` action. This resolves the warning: "'base' input
parameter is ignored when action is triggered by pull request event".
  • Loading branch information
jcfr committed Sep 20, 2024
1 parent df05bab commit fb06d97
Showing 1 changed file with 32 additions and 2 deletions.
34 changes: 32 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,40 @@ jobs:
- "Testing/**"
- "CMakeLists.txt"
# Build Slicer if relevant paths were changed
# Retrieve changes in SuperBuild-related files relative to the 'nightly-main' branch
- name: "Detect SuperBuild Changes"
uses: tj-actions/changed-files@48d8f15b2aaa3d255ca5af3eba4870f807ce6b3c # v45.0.2
id: superbuild-changes
with:
files: |
SuperBuild/External_*
base_sha: nightly-main

# List any SuperBuild files that were changed
- name: "List Changed SuperBuild Files"
if: steps.superbuild-changes.outputs.any_changed == 'true'
run: |
echo "Changed files:"
for file in ${ALL_CHANGED_FILES}; do
echo " $file"
done
env:
ALL_CHANGED_FILES: ${{ steps.superbuild-changes.outputs.all_changed_files }}

# Check prerequisites for the build
- name: "Check Prerequisites"
id: check-prereqisities
run: |
if [[ $SUPERBUILD_CHANGED == "true" ]]; then
echo "::warning ::Skipping Slicer build due to changes in SuperBuild files relative to 'nightly-main' branch."
fi
env:
SUPERBUILD_CHANGED: ${{ steps.superbuild-changes.outputs.any_changed }}

# Build Slicer if relevant paths were changed and no SuperBuild changes were detected
- name: "Build Slicer"
id: slicer-build
if: steps.changes.outputs.paths-to-include == 'true'
if: ${{ steps.changes.outputs.paths-to-include == 'true' && steps.superbuild-changes.outputs.any_changed == 'false' }}
uses: ./.github/actions/slicer-build

# Upload the Slicer package artifact if the build was successful
Expand Down

0 comments on commit fb06d97

Please sign in to comment.