test(apps): fix dashboard/voucher/consent tests #12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "E2e test" | |
on: | |
pull_request: | |
branches: [main] | |
jobs: | |
build: | |
name: parallel buck2 builds | |
runs-on: ubuntu-latest | |
timeout-minutes: 25 | |
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 | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Nix | |
uses: DeterminateSystems/nix-installer-action@v14 | |
- name: Run the Magic Nix Cache | |
uses: DeterminateSystems/magic-nix-cache-action@v8 | |
- name: Build ${{ matrix.target }} | |
run: | | |
nix develop -c buck2 build ${{ matrix.target }} | |
# Save the cache for this specific target | |
- uses: actions/cache/save@v4 | |
with: | |
path: | | |
~/.buck2 | |
buck-out | |
.buck-cache | |
prebuilt | |
installed | |
.buckd | |
key: buck2-${{ runner.os }}-${{ matrix.target }} | |
tests: | |
needs: build | |
name: execute via bats | |
runs-on: ubuntu-latest | |
timeout-minutes: 25 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Nix | |
uses: DeterminateSystems/nix-installer-action@v14 | |
- name: Run the Magic Nix Cache | |
uses: DeterminateSystems/magic-nix-cache-action@v8 | |
# Restore all caches from the build jobs into separate directories | |
- name: Restore caches from all targets | |
run: | | |
for TARGET in //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; do | |
actions/cache/restore@v4 \ | |
--path "./cache/${TARGET}" \ | |
--key "buck2-${{ runner.os }}-$TARGET" | |
done | |
# Merge the restored caches into the actual directories | |
- name: Merge restored caches | |
run: | | |
for TARGET in //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; do | |
rsync -a "./cache/${TARGET}/.buck2/" ~/.buck2/ | |
rsync -a "./cache/${TARGET}/buck-out/" buck-out/ | |
rsync -a "./cache/${TARGET}/.buck-cache/" .buck-cache/ | |
rsync -a "./cache/${TARGET}/prebuilt/" prebuilt/ | |
rsync -a "./cache/${TARGET}/installed/" installed/ | |
rsync -a "./cache/${TARGET}/.buckd/" .buckd/ | |
done | |
- 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 | |
nix develop -c bats --setup-suite-file bats/ci_setup_suite.bash -t bats/core/** | |
- name: Rename Tilt log | |
if: always() | |
run: mv bats/.e2e-tilt.log bats/e2e-tilt.log | |
- name: Upload Tilt log | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Tilt log | |
path: bats/e2e-tilt.log |