run-apollo-app-example #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: run-apollo-app-example | |
on: | |
workflow_dispatch: # * Treated like a scheduled run | |
inputs: | |
dist-tag: | |
type: string | |
description: NTARH version to test | |
required: true | |
default: 'latest' | |
schedule: | |
- cron: '30 */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 "RUN-APOLLO-APP-EXAMPLE IS RUNNING IN DEBUG MODE ($DEBUG)" | |
else | |
echo '(run-apollo-app-example is not running in debug mode)' | |
fi | |
- name: Gather metadata | |
id: set-matrix | |
run: | | |
echo "::set-output name=node-matrix::{\"node\":[$NODE_OLDER_VERSIONS, \"$NODE_CURRENT_VERSION\"]}" | |
! [ -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 apollo terminal example | |
# https://bit.ly/38702j0 | |
run: | | |
mkdir -p /tmp/ntarh-test/test | |
cd /tmp/ntarh-test | |
npm install --force next @apollo/server @as-integrations/next graphql-tag next-test-api-route-handler jest babel-jest @babel/core @babel/preset-env --force | |
echo 'module.exports={"presets":["next/babel"]};' > babel.config.js | |
mkdir -p app/api/graphql | |
curl -o app/api/graphql/route.js https://raw.githubusercontent.com/Xunnamius/next-test-api-route-handler/main/apollo_test_raw_app_route | |
curl -o test/my.test.js https://raw.githubusercontent.com/Xunnamius/next-test-api-route-handler/main/apollo_test_raw_app_test | |
npx jest |