Skip to content

Commit e6a245b

Browse files
committed
ENH: Fix caching-related warnings in GHA build-test-publish CI
Fix caching-related warnings in GHA `build-test-publish` CI: - Save the `apt-get` cache in a directory other than `/var/lib/apt` to avoid permission issues. - Check if the AFNI cache exists before trying to install it in GitHub Actions `build-test-publish` CI workflow. Fixes: ``` Failed to save: "/usr/bin/tar" failed with error: The process '/usr/bin/tar' failed with exit code 2 ``` The full log showing ``` 2024-12-19T13:35:45.2830631Z [command]/usr/bin/tar --posix -cf cache.tzst --exclude cache.tzst -P -C /home/runner/work/sdcflows/sdcflows --files-from manifest.txt --use-compress-program zstdmt 2024-12-19T13:35:46.5536670Z Failed to save: Unable to reserve cache with key afni-v1, another job may be creating this cache. More details: Cache already exists. Scope: refs/heads/master, Key: afni-v1, Version: d04022ae09f8f21b8c0f9f00e4a784b6e510fe6a47d30aa3b0853a42885b92cb 2024-12-19T13:35:46.5924639Z Post job cleanup. 2024-12-19T13:35:46.7348688Z [command]/usr/bin/tar --posix -cf cache.tzst --exclude cache.tzst -P -C /home/runner/work/sdcflows/sdcflows --files-from manifest.txt --use-compress-program zstdmt 2024-12-19T13:35:46.8326360Z /usr/bin/tar: ../../../../../var/lib/apt/lists/lock: Cannot open: Permission denied 2024-12-19T13:35:47.1807249Z /usr/bin/tar: ../../../../../var/lib/apt/lists/partial: Cannot open: Permission denied 2024-12-19T13:35:47.2842971Z /usr/bin/tar: Exiting with failure status due to previous errors 2024-12-19T13:35:47.2851756Z ##[warning]Failed to save: "/usr/bin/tar" failed with error: The process '/usr/bin/tar' failed with exit code 2 ``` raised for exmaple in: https://github.com/nipreps/sdcflows/actions/runs/12413644206
1 parent a50506a commit e6a245b

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

.github/workflows/build-test-publish.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ jobs:
8888
- uses: actions/checkout@v4
8989
- uses: actions/cache@v4
9090
with:
91-
path: /var/lib/apt
91+
path: ${{ runner.temp }}/cache-linux
9292
key: apt-cache-v3
9393
restore-keys: |
9494
apt-cache-v3
@@ -102,13 +102,16 @@ jobs:
102102
libglu1-mesa-dev libglw1-mesa \
103103
libxm4 build-essential
104104
105-
- uses: actions/cache@v4
105+
- name: Restore cache for AFNI
106+
id: cache-afni
107+
uses: actions/cache@v4
106108
with:
107109
path: /opt/afni
108-
key: afni-v1
110+
key: afni-v1-${{ matrix.python-version }}-${{ matrix.dependencies }}-${{ matrix.marks }}
109111
restore-keys: |
110-
afni-v1
112+
afni-v1-
111113
- name: Install AFNI
114+
if: steps.cache-afni.outputs.cache-hit != 'true'
112115
run: |
113116
if [[ ! -d "${AFNI_HOME}" ]]; then
114117
curl -O https://afni.nimh.nih.gov/pub/dist/bin/misc/@update.afni.binaries && \

0 commit comments

Comments
 (0)