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:
parent
79a7f8c408
commit
40e8bc09ce
1 changed files with 4 additions and 2 deletions
6
.github/workflows/ci.yml
vendored
6
.github/workflows/ci.yml
vendored
|
@ -278,13 +278,15 @@ jobs:
|
||||||
job_unit-tests:
|
job_unit-tests:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [job_get_metadata, job_install_deps]
|
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:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
node: [ '16.13.0', '18.12.1' ]
|
node: [ '16.13.0', '18.12.1' ]
|
||||||
name: Unit tests (Node ${{ matrix.node }})
|
name: Unit tests (Node ${{ matrix.node }})
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 100
|
||||||
- uses: actions/setup-node@v3
|
- uses: actions/setup-node@v3
|
||||||
env:
|
env:
|
||||||
FORCE_COLOR: 0
|
FORCE_COLOR: 0
|
||||||
|
@ -296,7 +298,7 @@ jobs:
|
||||||
env:
|
env:
|
||||||
DEPENDENCY_CACHE_KEY: ${{ needs.job_install_deps.outputs.dependency_cache_key }}
|
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
|
- uses: actions/upload-artifact@v3
|
||||||
if: startsWith(matrix.node, '18')
|
if: startsWith(matrix.node, '18')
|
||||||
|
|
Loading…
Add table
Reference in a new issue