Skip to content

Update Node SDK queries #176

Update Node SDK queries

Update Node SDK queries #176

Workflow file for this run

name: Tests
on:
pull_request:
types: [opened, reopened, synchronize, ready_for_review]
jobs:
integration-tests:
runs-on: ubuntu-latest
env:
CLIENT_ID: ${{secrets.CLIENT_ID}}
CLIENT_SECRET: ${{secrets.CLIENT_SECRET}}
SCOPE: ${{secrets.SCOPE}}
AUTH_URL: ${{secrets.AUTH_URL}}
API_URL: ${{secrets.API_URL}}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: |
corepack enable
echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.os }}-yarn-
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Install dependencies
uses: nick-fields/retry@v2
with:
retry_on: error
timeout_minutes: 5
max_attempts: 2
command: yarn
- name: Cache Homebrew
id: cache-homebrew
uses: actions/cache@v4
with:
path: |
/home/linuxbrew/.linuxbrew
~/.cache/Homebrew
# v2: the previous key holds a Homebrew too old to pour current bottles.
key: ${{ runner.os }}-homebrew-fragment-cli-v2
restore-keys: |
${{ runner.os }}-homebrew-
- name: Install Fragment CLI
run: |
if [ ! -d "/home/linuxbrew/.linuxbrew" ]; then
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
echo "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" >> $GITHUB_ENV
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
# The cache restores whatever Homebrew was current when the key was first
# written, and the runner disables auto-update. A months-old Homebrew
# cannot pour a current bottle -- it fails with `unknown install step:
# run` -- so bring Homebrew itself up to date before installing.
/home/linuxbrew/.linuxbrew/bin/brew update --quiet
/home/linuxbrew/.linuxbrew/bin/brew tap fragment-dev/tap || true
if ! /home/linuxbrew/.linuxbrew/bin/brew list fragment-dev/tap/fragment-cli &>/dev/null; then
/home/linuxbrew/.linuxbrew/bin/brew install fragment-dev/tap/fragment-cli
fi
- name: Typecheck
run: yarn typecheck
- name: Run ALL tests
run: yarn test:ci
- name: Verify generated methods are up-to-date
run: |
yarn build
git diff --exit-code
exit $?
- name: Verify test schema generated files are up-to-date
run: |
/home/linuxbrew/.linuxbrew/bin/fragment gen-graphql --path tests/fixtures/test-schema.json --output tests/fixtures/test-schema-queries.graphql
yarn fragment-node-client-codegen -i tests/fixtures/test-schema-queries.graphql -o tests/fixtures/generated-test-client.ts
yarn fragment-node-client-codegen -i tests/fixtures/edge-case-queries.graphql -o tests/fixtures/generated-edge-case-client.ts
git diff --exit-code tests/fixtures/test-schema-queries.graphql tests/fixtures/generated-test-client.ts tests/fixtures/generated-edge-case-client.ts
exit $?
# tests/template-schema/*.graphql are vendored from fragment-dev/graphql-queries,
# so only the clients generated from them are regenerated here.
- name: Verify template schema generated clients are up-to-date
run: |
yarn fragment-node-client-codegen -i tests/template-schema/queries.graphql -o tests/fixtures/generated-template-client.ts
yarn fragment-node-client-codegen -i tests/template-schema/queries.runtime-args.graphql -o tests/fixtures/generated-template-runtime-args-client.ts
git diff --exit-code tests/fixtures/generated-template-client.ts tests/fixtures/generated-template-runtime-args-client.ts
exit $?