Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ jobs:
contents: read
# Push of the pre-built CI image is additionally gated to main below.
packages: write
env:
# Registry and Environment Host roots together, so the cached build
# tree stays registered under the same Environment id.
DEBMAGIC_DATA_DIR: /tmp/debmagic-data
steps:
- uses: actions/checkout@v5
- uses: Swatinem/rust-cache@v2
Expand All @@ -149,16 +153,18 @@ jobs:
- name: Cache the debmagic build tree
uses: actions/cache@v4
with:
path: /tmp/debmagic
key: debmagic-build-${{ hashFiles('Cargo.lock', 'debian/changelog', 'debian/control', 'debian/rules') }}
restore-keys: debmagic-build-
- name: Prune stale build trees from the restored cache
path: /tmp/debmagic-data
key: debmagic-data-${{ hashFiles('Cargo.lock', 'debian/changelog', 'debian/control', 'debian/rules') }}
restore-keys: debmagic-data-
- name: Prune Environments of other package versions from the restored cache
run: |
mkdir -p /tmp/debmagic
current="$(dpkg-parsechangelog -SSource)-$(dpkg-parsechangelog -SVersion)"
find /tmp/debmagic -mindepth 1 -maxdepth 1 -type d \
! -name "$current" ! -name "${current}-test" \
-exec rm -rf {} +
cargo run --locked -q -p debmagic -- env list \
| awk -v current="$current" 'NR > 1 && $4 != current { print $1 }' \
| while read -r id; do
cargo run --locked -q -p debmagic -- env clean "$id" \
|| echo "::warning::could not prune Environment $id"
done
- name: Resolve CI image tag
id: image
run: |
Expand Down
Loading
Loading