Enabled app build artifact caching in CI

fixes https://github.com/TryGhost/DevOps/issues/120

- we've seen errors in CI where the unit tests for the apps folder are
  being run concurrently, but the build assets are not present so
  multiple builds are happening for the same folder
- this leads to errors because Vite tries to cleanup or build folders
  at the same time
- this should fix that by eagerly building the apps and caching the
  output so unit tests run quicker
This commit is contained in:
Daniel Lockyer 2023-12-11 10:07:20 +01:00 committed by Daniel Lockyer
parent 1479c55068
commit 617d3a6ffc

View File

@ -18,6 +18,9 @@ env:
${{ github.workspace }}/ghost/*/node_modules ${{ github.workspace }}/ghost/*/node_modules
~/.cache/ms-playwright/ ~/.cache/ms-playwright/
CACHED_BUILD_PATHS: | CACHED_BUILD_PATHS: |
${{ github.workspace }}/apps/*/dist
${{ github.workspace }}/apps/*/es
${{ github.workspace }}/apps/*/umd
${{ github.workspace }}/ghost/*/build ${{ github.workspace }}/ghost/*/build
NX_CACHE_RESTORE_KEYS: | NX_CACHE_RESTORE_KEYS: |
nx-Linux-${{ github.ref }}-${{ github.sha }} nx-Linux-${{ github.ref }}-${{ github.sha }}
@ -183,7 +186,7 @@ jobs:
- name: Build packages - name: Build packages
if: steps.cache_built_packages.outputs.cache-hit != 'true' if: steps.cache_built_packages.outputs.cache-hit != 'true'
run: yarn nx run-many -t build:ts run: yarn nx run-many -t build:ts && yarn nx run-many -t build -p apps/*
outputs: outputs:
dependency_cache_key: ${{ env.cachekey }} dependency_cache_key: ${{ env.cachekey }}