CI: prevent moc from running in cache population step (#29401)

* Do not remove moc_files from cache

* Add cache cleanup script

* Use cache cleanup script

* Dry-run in cache population command

* Add newline

* Temporarly disable master only constraint for cache cleanup step

* Add test lines

* one more

* Fix shebang

* Remove debug lines

* Bring back master branch constraints
old-commit-hash: d1aedccfbe
beeps
Kacper Rączy 2 years ago committed by GitHub
parent c7a05f82e0
commit 0c17a4f4d0
  1. 8
      .github/workflows/selfdrive_tests.yaml
  2. 16
      release/clean-cache.sh

@ -82,9 +82,8 @@ jobs:
run: ${{ env.RUN }} "scons -j$(nproc) --extras && release/check-dirty.sh"
- name: Cleanup scons cache and rebuild
timeout-minutes: ${{ ((steps.restore-scons-cache.outputs.cache-hit == 'true') && 2 || 30) }} # allow more time when we missed the scons cache
run: |
${{ env.RUN }} "rm -rf /tmp/scons_cache/* && \
scons -j$(nproc) --cache-populate"
if: github.ref == 'refs/heads/master'
run: ${{ env.RUN }} "release/clean-cache.sh"
- name: Save scons cache
uses: actions/cache/save@v3
if: github.ref == 'refs/heads/master'
@ -159,9 +158,8 @@ jobs:
- name: Pre Cache - Cleanup scons cache
if: github.ref == 'refs/heads/master'
run: |
rm -rf /tmp/scons_cache/*
eval "$(pyenv init --path)"
poetry run scons -j$(nproc) --cache-populate
poetry run release/clean-cache.sh
- name: Save scons cache
id: scons-save-cache
uses: actions/cache/save@v3

@ -0,0 +1,16 @@
#!/usr/bin/env bash
set -e
# delete outdated moc files
scons --dry-run --taskmastertrace /tmp/tasktrace.log >/dev/null
MOC_EXISTING_PROD="$(find /tmp/scons_cache/moc_files -type f | sort)"
MOC_CURRENT_PROD="$(egrep -o "'[^']*moc_files[^']*'" /tmp/tasktrace.log | sed "s/'//g" | sort | uniq)"
MOC_JUNK="$(comm -23 <(echo "$MOC_EXISTING_PROD") <(echo "$MOC_CURRENT_PROD"))"
echo "$MOC_JUNK" | xargs -I{} rm {}
rm /tmp/tasktrace.log
# delete cache except for moc files
rm -rf $(find /tmp/scons_cache -maxdepth 1 ! -name moc_files ! -name scons_cache)
# repopulate cache
scons --dry-run --cache-populate >/dev/null
Loading…
Cancel
Save