0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-11 02:12:21 -05:00

Optimized unit test workflow to only run for changed packages

- this implements a similar idea to linting by only running for changed
  packages, which saves ~3 minutes for this job
This commit is contained in:
Daniel Lockyer 2023-07-05 08:12:56 +02:00 committed by Daniel Lockyer
parent 79a7f8c408
commit 40e8bc09ce

View file

@ -278,13 +278,15 @@ jobs:
job_unit-tests:
runs-on: ubuntu-latest
needs: [job_get_metadata, job_install_deps]
if: needs.job_get_metadata.outputs.changed_core == 'true' && (github.event_name == 'push' || (github.event_name == 'pull_request' && !startsWith(github.head_ref, 'renovate/')))
if: needs.job_get_metadata.outputs.changed_any_code == 'true' && (github.event_name == 'push' || (github.event_name == 'pull_request' && !startsWith(github.head_ref, 'renovate/')))
strategy:
matrix:
node: [ '16.13.0', '18.12.1' ]
name: Unit tests (Node ${{ matrix.node }})
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 100
- uses: actions/setup-node@v3
env:
FORCE_COLOR: 0
@ -296,7 +298,7 @@ jobs:
env:
DEPENDENCY_CACHE_KEY: ${{ needs.job_install_deps.outputs.dependency_cache_key }}
- run: yarn test:unit
- run: yarn test:unit --include-dependents --since ${{ github.event.pull_request.base.sha || github.event.before }}
- uses: actions/upload-artifact@v3
if: startsWith(matrix.node, '18')