Skip to content

Commit

Permalink
ci(github): add tests to ensure next/jest.js and swc compat
Browse files Browse the repository at this point in the history
  • Loading branch information
Xunnamius committed Mar 3, 2024
1 parent 633a046 commit 50858e7
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/is-nextjestjs-swc-comat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: is-nextjestjs-swc-comat

on:
workflow_dispatch: # * Treated like a scheduled run
schedule:
- cron: '15 */6 * * *'

env:
# * Selectively enable debugger verbose output in the pipeline
# ? See also: https://www.npmjs.com/package/debug#wildcards
# DEBUG: 'next-test-api-route-handler:*'
NODE_CURRENT_VERSION: 21.x
NODE_OLDER_VERSIONS: '"18.x", "20.x"'

jobs:
metadata:
name: 'gather-metadata'
runs-on: ubuntu-latest
timeout-minutes: 10
outputs:
node-matrix: ${{ steps.set-matrix.outputs.node-matrix }}
steps:
- name: Report mode statuses
run: |
if [ -n "$DEBUG" ]; then
echo "IS-NEXTJESTJS-SWC-COMAT IS RUNNING IN DEBUG MODE ($DEBUG)"
else
echo '(is-nextjestjs-swc-comat is not running in debug mode)'
fi
- name: Gather metadata
id: set-matrix
run: |
echo "node-matrix={\"node\":[$NODE_OLDER_VERSIONS, \"$NODE_CURRENT_VERSION\"]}" >> $GITHUB_OUTPUT
! [ -z "$DEBUG" ] && echo "set-output name=node-matrix::{\"node\":[$NODE_OLDER_VERSIONS, \"$NODE_CURRENT_VERSION\"]}" || true
check-compat:
runs-on: ubuntu-latest
needs: metadata
timeout-minutes: 10
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.metadata.outputs.node-matrix) }}
steps:
- name: Run davidmytton's example repo tests
# https://github.com/Xunnamius/next-test-api-route-handler/discussions/983#
run: |
git clone https://github.com/Xunnamius/ntarh-nextjestjs-swc-compat-test
cd ntarh-nextjestjs-swc-compat-test
npm install --force
npx jest

0 comments on commit 50858e7

Please sign in to comment.