Skip to content

Commit 50858e7

Browse files
committed
ci(github): add tests to ensure next/jest.js and swc compat
1 parent 633a046 commit 50858e7

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: is-nextjestjs-swc-comat
2+
3+
on:
4+
workflow_dispatch: # * Treated like a scheduled run
5+
schedule:
6+
- cron: '15 */6 * * *'
7+
8+
env:
9+
# * Selectively enable debugger verbose output in the pipeline
10+
# ? See also: https://www.npmjs.com/package/debug#wildcards
11+
# DEBUG: 'next-test-api-route-handler:*'
12+
NODE_CURRENT_VERSION: 21.x
13+
NODE_OLDER_VERSIONS: '"18.x", "20.x"'
14+
15+
jobs:
16+
metadata:
17+
name: 'gather-metadata'
18+
runs-on: ubuntu-latest
19+
timeout-minutes: 10
20+
outputs:
21+
node-matrix: ${{ steps.set-matrix.outputs.node-matrix }}
22+
steps:
23+
- name: Report mode statuses
24+
run: |
25+
if [ -n "$DEBUG" ]; then
26+
echo "IS-NEXTJESTJS-SWC-COMAT IS RUNNING IN DEBUG MODE ($DEBUG)"
27+
else
28+
echo '(is-nextjestjs-swc-comat is not running in debug mode)'
29+
fi
30+
31+
- name: Gather metadata
32+
id: set-matrix
33+
run: |
34+
echo "node-matrix={\"node\":[$NODE_OLDER_VERSIONS, \"$NODE_CURRENT_VERSION\"]}" >> $GITHUB_OUTPUT
35+
! [ -z "$DEBUG" ] && echo "set-output name=node-matrix::{\"node\":[$NODE_OLDER_VERSIONS, \"$NODE_CURRENT_VERSION\"]}" || true
36+
37+
check-compat:
38+
runs-on: ubuntu-latest
39+
needs: metadata
40+
timeout-minutes: 10
41+
strategy:
42+
fail-fast: false
43+
matrix: ${{ fromJson(needs.metadata.outputs.node-matrix) }}
44+
steps:
45+
- name: Run davidmytton's example repo tests
46+
# https://github.com/Xunnamius/next-test-api-route-handler/discussions/983#
47+
run: |
48+
git clone https://github.com/Xunnamius/ntarh-nextjestjs-swc-compat-test
49+
cd ntarh-nextjestjs-swc-compat-test
50+
npm install --force
51+
npx jest

0 commit comments

Comments
 (0)