Skip to content

Commit

Permalink
chore: add short lived cache key
Browse files Browse the repository at this point in the history
  • Loading branch information
dolcalmi committed Oct 23, 2024
1 parent 2b662e5 commit 9cbf20f
Showing 1 changed file with 66 additions and 13 deletions.
79 changes: 66 additions & 13 deletions .github/workflows/e2e-test2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ jobs:
fail-fast: false

steps:
- id: vars
run: echo "short_sha=${GITHUB_SHA:0:7}" >> $GITHUB_ENV

- uses: actions/checkout@v4

- name: Install Nix
Expand All @@ -53,7 +56,8 @@ jobs:
target
.buckd
buck-out/cache
key: buck2-${{ runner.os }}-${{ matrix.target }}
key: b2-${{ matrix.target }}-${{ env.short_sha }}
enableCrossOsArchive: true

tests:
name: execute via bats
Expand All @@ -62,6 +66,16 @@ jobs:
needs: build

steps:
- id: vars
run: echo "short_sha=${GITHUB_SHA:0:7}" >> $GITHUB_ENV

- name: Maximize build space
uses: easimon/maximize-build-space@master
with:
root-reserve-mb: 15360
temp-reserve-mb: 12288
remove-dotnet: "true"

- uses: actions/checkout@v4

- name: Install Nix
Expand All @@ -70,18 +84,57 @@ jobs:
- name: Run the Magic Nix Cache
uses: DeterminateSystems/magic-nix-cache-action@v8

- uses: actions/cache/restore@v4
with:
path: |
~/.buck2
buck-out
.buck-cache
prebuilt
installed
target
.buckd
buck-out/cache
key: buck2-${{ runner.os }}-
- name: Restore cache with retry
run: |
for i in {1..3}; do
gh extension install actions/gh-actions-cache
KEYS=$(gh actions-cache list -B main -L 100 | grep -o 'b2-.*')
for key in $KEYS; do
gh actions-cache restore $key && break
sleep 2
done
if [ $? -eq 0 ]; then
break
fi
echo "Attempt $i failed, retrying..."
sleep 5
done
env:
GH_TOKEN: ${{ github.token }}

# - uses: actions/cache/restore@v4
# with:
# path: |
# ~/.buck2
# buck-out
# .buck-cache
# prebuilt
# installed
# target
# .buckd
# buck-out/cache
# key: |
# b2-//core/api-${{ env.short_sha }}
# b2-//core/api-ws-server-${{ env.short_sha }}
# b2-//core/api-trigger-${{ env.short_sha }}
# b2-//core/api-exporter-${{ env.short_sha }}
# b2-//apps/dashboard-${{ env.short_sha }}
# b2-//apps/consent-${{ env.short_sha }}
# b2-//apps/pay-${{ env.short_sha }}
# b2-//apps/admin-panel-${{ env.short_sha }}
# b2-//apps/map-${{ env.short_sha }}
# b2-//apps/voucher-${{ env.short_sha }}
# b2-//core/api-keys-${{ env.short_sha }}
# b2-//core/notifications-${{ env.short_sha }}
# b2-//bats/helpers/callback:run-${{ env.short_sha }}
# b2-//bats/helpers/subscriber:run-${{ env.short_sha }}
# b2-//bats/helpers/totp:generate-${{ env.short_sha }}
# restore-keys: |
# b2-
# fail-on-cache-miss: true

- name: Run bats tests
run: |
Expand Down

0 comments on commit 9cbf20f

Please sign in to comment.