-
-
Notifications
You must be signed in to change notification settings - Fork 735
WIP: CI TESTING ENH: Two-level CastXML/igenerator build cache + Python CI workflow #6486
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
hjmjohnson
wants to merge
9
commits into
InsightSoftwareConsortium:main
Choose a base branch
from
hjmjohnson:ci/linux-azure-disk-management
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
951de4c
COMP: Free unused preinstalled software in Linux Azure CI jobs
hjmjohnson 92e1070
ENH: Two-level content-addressed CastXML/igenerator build cache
hjmjohnson 71a75d9
ENH: Multi-path cascade + uncompressed/hardlink L2 store for castxml …
hjmjohnson 7540dc8
STYLE: Rename _CACHE_FMT to _KEY_VERSION in castxml cache
hjmjohnson 14bbf24
ENH: Simplify CastXML cache restore and default ITK_WRAP_CASTXML_CACH…
hjmjohnson 8f67375
ENH: Add Python CI workflow with persistent CastXML and ccache stores
hjmjohnson 20b1c6e
COMP: Add CastXML cache restore/save to Azure DevOps Python pipelines
hjmjohnson 0a92d1b
BUG: Fix castxml cache activation and exclude Windows Python CI
hjmjohnson 47a29b7
STYLE: Bump castxml cache key to v4 to force cold-cache benchmark run
hjmjohnson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,179 @@ | ||
| name: ITK.Pixi.Python | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| - 'release*' | ||
| paths-ignore: | ||
| - '*.md' | ||
| - LICENSE | ||
| - NOTICE | ||
| - 'Documentation/**' | ||
| - 'Utilities/Debugger/**' | ||
| - 'Utilities/ITKv5Preparation/**' | ||
| - 'Utilities/Maintenance/**' | ||
| - 'Modules/Remote/*.remote.cmake' | ||
| pull_request: | ||
| paths-ignore: | ||
| - '*.md' | ||
| - LICENSE | ||
| - NOTICE | ||
| - 'Documentation/**' | ||
| - 'Utilities/Debugger/**' | ||
| - 'Utilities/ITKv5Preparation/**' | ||
| - 'Utilities/Maintenance/**' | ||
| - 'Modules/Remote/*.remote.cmake' | ||
|
|
||
| concurrency: | ||
| group: '${{ github.workflow }}@${{ github.head_ref || github.ref }}' | ||
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | ||
|
|
||
| jobs: | ||
| Pixi-Python: | ||
| runs-on: ${{ matrix.os }} | ||
| timeout-minutes: 360 | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| # windows-2022 excluded: itk_end_wrap_module.cmake generates an | ||
| # igenerator command that exceeds cmd.exe's 8191-char batch-file | ||
| # line limit for large modules (e.g. ITKImageIntensity, 59 | ||
| # submodules). Fix requires response-file support in cmake custom | ||
| # command, tracked separately. | ||
| os: [ubuntu-24.04, macos-15] | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v5 | ||
| with: | ||
| fetch-depth: 5 | ||
| clean: true | ||
|
|
||
| - name: Configure ccache environment | ||
| shell: bash | ||
| run: | | ||
| echo "CCACHE_BASEDIR=${GITHUB_WORKSPACE}" >> "$GITHUB_ENV" | ||
| echo "CCACHE_COMPILERCHECK=content" >> "$GITHUB_ENV" | ||
| echo "CCACHE_NOHASHDIR=true" >> "$GITHUB_ENV" | ||
| echo "CCACHE_SLOPPINESS=pch_defines,time_macros" >> "$GITHUB_ENV" | ||
| echo "CCACHE_DIR=${{ runner.temp }}/ccache" >> "$GITHUB_ENV" | ||
| echo "CCACHE_MAXSIZE=5G" >> "$GITHUB_ENV" | ||
| if [ "$RUNNER_OS" == "Linux" ]; then | ||
| sudo apt-get update -qq && sudo apt-get install -y locales | ||
| sudo locale-gen de_DE.UTF-8 | ||
| fi | ||
|
|
||
| - name: Configure CastXML cache environment | ||
| shell: bash | ||
| run: | | ||
| echo "ITK_WRAP_CACHE=${{ runner.temp }}/itk-castxml-cache" >> "$GITHUB_ENV" | ||
|
|
||
| - name: Restore compiler cache | ||
| id: restore-ccache | ||
| uses: actions/cache/restore@v5 | ||
| with: | ||
| path: ${{ runner.temp }}/ccache | ||
| key: ccache-v4-${{ runner.os }}-pixi-python-${{ github.sha }} | ||
| restore-keys: | | ||
| ccache-v4-${{ runner.os }}-pixi-python- | ||
|
|
||
| - name: Restore CastXML cache | ||
| id: restore-castxml-cache | ||
| uses: actions/cache/restore@v5 | ||
| with: | ||
| path: ${{ runner.temp }}/itk-castxml-cache | ||
| key: castxml-v1-${{ runner.os }}-pixi-python-${{ github.sha }} | ||
| restore-keys: | | ||
| castxml-v1-${{ runner.os }}-pixi-python- | ||
|
|
||
| - name: Restore ExternalData object store | ||
| id: restore-externaldata | ||
| uses: actions/cache/restore@v5 | ||
| with: | ||
| path: ${{ runner.temp }}/ExternalData | ||
| key: externaldata-v1-${{ hashFiles('**/*.cid') }} | ||
| restore-keys: | | ||
| externaldata-v1- | ||
|
|
||
| - name: Disk space before build (Ubuntu) | ||
| if: matrix.os == 'ubuntu-24.04' | ||
| run: df -h / | ||
|
|
||
| - name: Free Disk Space (Ubuntu) | ||
|
hjmjohnson marked this conversation as resolved.
|
||
| if: matrix.os == 'ubuntu-24.04' | ||
| uses: BRAINSia/free-disk-space@v2 | ||
| with: | ||
| removalmode: "rmz" | ||
| swap-storage: "true" | ||
| haskell: "true" | ||
| dotnet: "true" | ||
| docker-images: "false" | ||
| tool-cache: "true" | ||
| android: "false" | ||
| large-packages: "true" | ||
| mandb: "true" | ||
|
|
||
| - name: Export ExternalData_OBJECT_STORES | ||
| shell: bash | ||
| run: | | ||
| echo "ExternalData_OBJECT_STORES=${{ runner.temp }}/ExternalData" >> "$GITHUB_ENV" | ||
|
|
||
| - name: Set up Pixi | ||
| uses: prefix-dev/setup-pixi@v0.9.5 | ||
|
|
||
| - name: Show ccache configuration, stats and maintenance | ||
| shell: bash | ||
| run: | | ||
| pixi run -e python ccache --zero-stats | ||
| pixi run -e python ccache --evict-older-than 7d | ||
| pixi run -e python ccache --show-config | ||
|
|
||
| - name: Configure | ||
| run: pixi run configure-python-ci | ||
|
|
||
| - name: Fetch ExternalData | ||
| shell: bash | ||
| run: pixi run -e python cmake --build build-python --target ITKData | ||
|
|
||
| - name: Build | ||
| run: | | ||
| df -h / || true | ||
| pixi run build-python-ci | ||
| df -h / || true | ||
|
|
||
| - name: Free disk space after build | ||
| shell: bash | ||
| run: | | ||
| find build-python -type f \( -path '*/CMakeFiles/*' -o -path '*.dir/*' \) \( -name "*.o" -o -name "*.obj" \) -delete | ||
| find build-python/lib -type f \( -name "*.a" -o -name "*.lib" \) -delete 2>/dev/null || true | ||
| pixi run -e python ccache --evict-older-than 1d 2>/dev/null || true | ||
| pixi run -e python ccache --cleanup 2>/dev/null || true | ||
| df -h / || true | ||
|
|
||
| - name: Test | ||
| run: pixi run test-python-ci | ||
|
|
||
| - name: Save compiler cache | ||
| if: ${{ !cancelled() }} | ||
| uses: actions/cache/save@v5 | ||
| with: | ||
| path: ${{ runner.temp }}/ccache | ||
| key: ccache-v4-${{ runner.os }}-pixi-python-${{ github.sha }} | ||
|
|
||
| - name: Save CastXML cache | ||
| if: ${{ !cancelled() }} | ||
| uses: actions/cache/save@v5 | ||
| with: | ||
| path: ${{ runner.temp }}/itk-castxml-cache | ||
| key: castxml-v1-${{ runner.os }}-pixi-python-${{ github.sha }} | ||
|
|
||
| - name: Save ExternalData object store | ||
| if: ${{ !cancelled() }} | ||
| uses: actions/cache/save@v5 | ||
| with: | ||
| path: ${{ runner.temp }}/ExternalData | ||
| key: externaldata-v1-${{ hashFiles('**/*.cid') }} | ||
|
|
||
| - name: ccache stats | ||
| if: always() | ||
| run: pixi run -e python ccache --show-stats | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| ############################################################################### | ||
| # Content-addressed two-level cache for CastXML wrapping steps. | ||
| # | ||
| # When ITK_WRAP_CASTXML_CACHE is ON, a Python wrapper replaces | ||
| # `ccache castxml` for every .xml generation step. The wrapper computes | ||
| # a two-level SHA-256 key: | ||
| # L1 (fast, ~0.2s): direct inputs (cxx + castxml.inc + compiler flags) | ||
| # L2 (robust, ~1s): sha256(L1_key + `castxml -E` preprocessed output) | ||
| # | ||
| # On L2 hit: restores .xml from cache, saving the full CastXML run. | ||
| # On miss: runs castxml normally and populates the cache. | ||
| # | ||
| # Cache location: $ITK_WRAP_CACHE env var (default: ~/.cache/itk-wrap) | ||
|
|
||
| set( | ||
| _ITK_WRAP_CASTXML_CACHE_SCRIPT_DEFAULT | ||
| "${ITK_SOURCE_DIR}/Wrapping/Generators/CastXML/itk-castxml-cache.py" | ||
| ) | ||
|
|
||
| option( | ||
| ITK_WRAP_CASTXML_CACHE | ||
| "Use a content-addressed two-level cache for CastXML wrapping steps." | ||
| ON | ||
| ) | ||
| mark_as_advanced(ITK_WRAP_CASTXML_CACHE) | ||
|
|
||
| if(ITK_WRAP_CASTXML_CACHE) | ||
| set( | ||
| ITK_WRAP_CASTXML_CACHE_SCRIPT | ||
| "${_ITK_WRAP_CASTXML_CACHE_SCRIPT_DEFAULT}" | ||
| CACHE FILEPATH | ||
| "Path to the CastXML content-addressed cache wrapper script" | ||
| ) | ||
| mark_as_advanced(ITK_WRAP_CASTXML_CACHE_SCRIPT) | ||
|
|
||
| if(NOT EXISTS "${ITK_WRAP_CASTXML_CACHE_SCRIPT}") | ||
| message( | ||
| FATAL_ERROR | ||
| "ITK_WRAP_CASTXML_CACHE is ON but the wrapper script was not found:\n" | ||
| " ${ITK_WRAP_CASTXML_CACHE_SCRIPT}\n" | ||
| "Set ITK_WRAP_CASTXML_CACHE_SCRIPT to the correct path or turn off ITK_WRAP_CASTXML_CACHE." | ||
| ) | ||
| endif() | ||
|
|
||
| if(NOT Python3_EXECUTABLE) | ||
| message( | ||
| FATAL_ERROR | ||
| "ITK_WRAP_CASTXML_CACHE requires Python3_EXECUTABLE to be set." | ||
| ) | ||
| endif() | ||
|
|
||
| message(STATUS "CastXML content-addressed cache enabled") | ||
| message(STATUS " Script: ${ITK_WRAP_CASTXML_CACHE_SCRIPT}") | ||
| message( | ||
| STATUS | ||
| " Cache root: set ITK_WRAP_CACHE env var at build time (default: ~/.cache/itk-wrap)" | ||
| ) | ||
| endif() | ||
|
|
||
| unset(_ITK_WRAP_CASTXML_CACHE_SCRIPT_DEFAULT) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -55,6 +55,7 @@ jobs: | |
| df -h / | ||
| displayName: 'Free preinstalled software' | ||
|
|
||
|
|
||
| - checkout: self | ||
| clean: true | ||
| fetchDepth: 5 | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.