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 2ff4dca
Showing 1 changed file with 46 additions and 37 deletions.
83 changes: 46 additions & 37 deletions .github/workflows/e2e-test2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,26 @@ on:

jobs:
build:
name: parallel buck2 builds
name: clustered buck2 builds
runs-on: ubuntu-latest
timeout-minutes: 10
timeout-minutes: 15
strategy:
matrix:
target:
- //core/api
- //core/api-ws-server
- //core/api-trigger
- //core/api-exporter
- //apps/dashboard
- //apps/consent
- //apps/pay
- //apps/admin-panel
- //apps/map
- //apps/voucher
- //core/api-keys
- //core/notifications
- //bats/helpers/callback:run
- //bats/helpers/subscriber:run
- //bats/helpers/totp:generate
cluster:
- name: core-apis
targets: "//core/api //core/api-ws-server //core/api-trigger //core/api-exporter"
- name: apps
targets: "//apps/dashboard //apps/consent //apps/pay //apps/admin-panel //apps/map //apps/voucher"
- name: core-services
targets: "//core/api-keys //core/notifications"
- name: bats-helpers
targets: "//bats/helpers/callback:run //bats/helpers/subscriber:run //bats/helpers/totp:generate"
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 @@ -38,9 +34,9 @@ jobs:
- name: Run the Magic Nix Cache
uses: DeterminateSystems/magic-nix-cache-action@v8

- name: Build
- name: Build cluster
run: |
nix develop -c buck2 build ${{ matrix.target }}
nix develop -c buck2 build ${{ matrix.cluster.targets }}
- uses: actions/cache/save@v4
with:
Expand All @@ -53,7 +49,8 @@ jobs:
target
.buckd
buck-out/cache
key: buck2-${{ runner.os }}-${{ matrix.target }}
key: b2-${{ matrix.cluster.name }}-${{ env.short_sha }}
enableCrossOsArchive: true

tests:
name: execute via bats
Expand All @@ -62,6 +59,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 @@ -81,25 +88,27 @@ jobs:
target
.buckd
buck-out/cache
key: buck2-${{ runner.os }}-
key: |
b2-core-apis-${{ env.short_sha }}
b2-apps-${{ env.short_sha }}
b2-core-services-${{ env.short_sha }}
b2-bats-helpers-${{ env.short_sha }}
restore-keys: |
b2-core-apis-
b2-apps-
b2-core-services-
b2-bats-helpers-
fail-on-cache-miss: true

- name: Run bats tests
run: |
nix develop -c buck2 build //core/api \
//core/api-ws-server \
//core/api-trigger \
//core/api-exporter \
//apps/dashboard \
//apps/consent \
//apps/pay \
//apps/admin-panel \
//apps/map \
//apps/voucher \
//core/api-keys \
//core/notifications \
//bats/helpers/callback:run \
//bats/helpers/subscriber:run \
//bats/helpers/totp:generate
# Build all targets again (should be fast with cache)
nix develop -c buck2 build \
//core/api //core/api-ws-server //core/api-trigger //core/api-exporter \
//apps/dashboard //apps/consent //apps/pay //apps/admin-panel //apps/map //apps/voucher \
//core/api-keys //core/notifications \
//bats/helpers/callback:run //bats/helpers/subscriber:run //bats/helpers/totp:generate
nix develop -c bats --setup-suite-file bats/ci_setup_suite.bash -t bats/core/**
- name: Rename Tilt log
Expand Down

0 comments on commit 2ff4dca

Please sign in to comment.