Skip to content

chore: update GitHub script (#1146) #1875

chore: update GitHub script (#1146)

chore: update GitHub script (#1146) #1875

name: Compare Snapshots
on:
# allow for manual triggers
workflow_dispatch: {}
workflow_call: {}
push:
branches:
- develop
pull_request: {}
jobs:
getMatrix:
name: Get Matrix
runs-on: ubuntu-latest
outputs:
testPathPatterns: ${{ steps.setTestPathPatterns.outputs.testPathPatterns }}
testConfigs: ${{ steps.setTestConfigs.outputs.testConfigs }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
persist-credentials: false
- id: setTestPathPatterns
name: Set test path patterns
run: |
echo "testPathPatterns=$(./.github/scripts/getTestPathPatterns.sh)" >> $GITHUB_OUTPUT
- id: setTestConfigs
name: Set test config environment variables
run: |
echo "testConfigs=$(./.github/scripts/getTestConfigs.sh)" >> $GITHUB_OUTPUT
compareSnapshots:
name: Compare
runs-on: ubuntu-latest
needs: getMatrix
strategy:
fail-fast: false
matrix:
testPathPattern: ${{ fromJSON(needs.getMatrix.outputs.testPathPatterns) }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Setup node
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: 📥 Download deps
uses: bahmutov/npm-install@v1
with:
useLockFile: false
- name: Run server
run: |
./.github/scripts/runServer.sh
- name: Compare Snapshots - ${{ matrix.testPathPattern }}
continue-on-error: true
run: |
npm run test:func -- --testPathPattern "${{ matrix.testPathPattern }}"
# - name: Collect Diffs and Upload to Imgur
# run: |
# ./scripts/snapshot-tests/collect-diffs.sh
compareSnapshotsV2:
name: Compare V2
runs-on: ubuntu-latest
needs: getMatrix
strategy:
fail-fast: false
matrix:
testConfig: ${{ fromJSON(needs.getMatrix.outputs.testConfigs) }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Setup node
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: 📥 Download deps
uses: bahmutov/npm-install@v1
with:
useLockFile: false
- name: Run server
run: |
./.github/scripts/runServerV2.sh
- name: Compare Snapshots - ${{ matrix.testConfig }}
continue-on-error: true
run: |
CONFIG_PATH=${{ matrix.testConfig }} npm run test:func:snapshots
# - name: Collect Diffs and Upload to Imgur
# run: |
# ./scripts/snapshot-tests/collect-diffs-v2.sh