44
55env :
66 ROS_VERSION : 2
7+ # Change to 'true' to enable the cache upload as artifacts
8+ SAVE_CACHE_AS_ARTIFACT : ' false'
9+ # Change to 'true' to ignore cache and force a full rebuild, but please restore to 'false' before merging
10+ IGNORE_CACHE_AND_DO_FULL_REBUILD : ' false'
711
812jobs :
913 build :
@@ -13,26 +17,30 @@ jobs:
1317 include :
1418 - os : ubuntu-latest
1519 platform : linux-64
20+ folder_cache : ' output/linux-64'
1621 - os : ubuntu-24.04-arm
1722 platform : linux-aarch64
23+ folder_cache : ' output/linux-aarch64'
1824 - os : macos-13
1925 platform : osx-64
26+ folder_cache : ' output/osx-64'
2027 - os : macos-14
2128 platform : osx-arm64
29+ folder_cache : ' output/osx-arm64'
2230 - os : windows-2022
2331 platform : win-64
32+ folder_cache : ' C:/bld/win-64'
2433
2534 runs-on : ${{ matrix.os }}
2635
2736 steps :
28- - uses : actions/checkout@v4
37+ - uses : actions/checkout@v5
2938 with :
3039 persist-credentials : false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
3140 fetch-depth : 0 # otherwise, you will failed to push refs to dest repo
3241
3342 -
uses :
prefix-dev/[email protected] 3443 with :
35- pixi-version : v0.44.0
3644 frozen : true
3745
3846 # Workaround for https://github.com/RoboStack/ros-humble/pull/141#issuecomment-1941919816
7987 run : |
8088 pixi run python check_patches_clean_apply.py
8189
90+ - name : Restore build cache
91+ id : cache-restore
92+ uses : actions/cache/restore@v4
93+ with :
94+ path : |
95+ ${{ matrix.folder_cache }}
96+ key : ${{ runner.os }}-${{ matrix.platform }}-pr-${{ github.event.pull_request.number }}
97+ # allow a later run to pick up a cache that has an extra suffix
98+ restore-keys : |
99+ ${{ runner.os }}-${{ matrix.platform }}-pr-${{ github.event.pull_request.number }}-
100+
101+ - name : Optional force full rebuild
102+ if : ${{ env.IGNORE_CACHE_AND_DO_FULL_REBUILD == 'true' }}
103+ shell : bash -l {0}
104+ run : |
105+ rm -rf ${{ matrix.folder_cache }}/*
106+
107+ - name : See packages restored by cache
108+ shell : bash -l {0}
109+ run : |
110+ ls ${{ matrix.folder_cache }} || true
111+
82112 - name : Build recipes
83113 shell : bash -l {0}
84114 run : |
85115 pixi run rattler-build build --recipe-dir recipes --target-platform ${{ matrix.platform }} -m ./conda_build_config.yaml -c robostack-kilted -c conda-forge --skip-existing
116+
117+ - name : See packages that will be saved in cache
118+ shell : bash -l {0}
119+ if : always()
120+ run : |
121+ ls ${{ matrix.folder_cache }} || true
122+
123+ - name : Save build cache
124+ uses : actions/cache/save@v4
125+ if : always()
126+ with :
127+ path : |
128+ ${{ matrix.folder_cache }}
129+ key : ${{ runner.os }}-${{ matrix.platform }}-pr-${{ github.event.pull_request.number }}-${{ github.run_id }}-${{ github.run_attempt }}
130+
131+ - name : Upload build cache as artifact
132+ if : ${{ always() && env.SAVE_CACHE_AS_ARTIFACT == 'true' }}
133+ uses : actions/upload-artifact@v4
134+ with :
135+ name : cache-${{ matrix.platform }}-${{ github.run_id }}
136+ path : ${{ matrix.folder_cache }}
137+ retention-days : 7
0 commit comments