@cacheControl
support tests, fixes...
#1525
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: Test | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
NODE_NO_WARNINGS: 1 | |
CI: true | |
jobs: | |
unit: | |
strategy: | |
matrix: | |
node-version: | |
- 18 | |
- 20 | |
- 22 | |
name: Unit / Node v${{matrix.node-version}} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up env | |
uses: the-guild-org/shared-config/setup@v1 | |
with: | |
node-version: ${{matrix.node-version}} | |
- name: Test | |
run: yarn test | |
unit-bun: | |
name: Unit / Bun | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up env | |
uses: the-guild-org/shared-config/setup@v1 | |
with: | |
node-version: 22 | |
- name: Test | |
run: yarn test:bun | |
leaks: | |
strategy: | |
matrix: | |
node-version: | |
- 18 | |
- 20 | |
- 22 | |
name: Leaks / Node v${{matrix.node-version}} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up env | |
uses: the-guild-org/shared-config/setup@v1 | |
with: | |
node-version: ${{matrix.node-version}} | |
- name: Run Tests | |
uses: nick-fields/retry@v3 | |
with: | |
timeout_minutes: 10 | |
max_attempts: 3 | |
command: yarn test:leaks | |
e2e: | |
runs-on: ${{ matrix.setup.os }} | |
strategy: | |
matrix: | |
setup: | |
# Node | |
- workflow-name: Node 18 on Ubuntu | |
os: ubuntu-latest | |
gateway-runner: node | |
node-version: 18 | |
- workflow-name: Node 20 on Ubuntu | |
os: ubuntu-latest | |
gateway-runner: node | |
node-version: 20 | |
- workflow-name: Node 22 on Ubuntu | |
os: ubuntu-latest | |
gateway-runner: node | |
node-version: 22 | |
# Node on Docker | |
- workflow-name: Node Docker on Ubuntu | |
os: ubuntu-latest | |
gateway-runner: docker | |
node-version: 22 | |
# Node Binary | |
- workflow-name: Node Binary on Ubuntu | |
os: ubuntu-latest | |
gateway-runner: bin | |
node-version: 22 | |
- workflow-name: Node Binary on Windows | |
os: windows-latest | |
gateway-runner: bin | |
node-version: 22 | |
# Should be the same with Linux | |
# - workflow-name: Node Binary on MacOS Arm64 | |
# os: macos-14 # MacOS Arm64 | |
# gateway-runner: bin | |
# node-version: 22 | |
# - workflow-name: Node Binary on MacOS x86_64 | |
# os: macos-13 # MacOS x86_64 | |
# gateway-runner: bin | |
# node-version: 22 | |
# Bun | |
- workflow-name: Bun on Ubuntu | |
os: ubuntu-latest | |
gateway-runner: bun | |
node-version: 22 | |
- workflow-name: Bun Docker on Ubuntu | |
os: ubuntu-latest | |
gateway-runner: bun-docker | |
node-version: 22 | |
name: E2E / ${{matrix.setup.workflow-name}} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- if: matrix.setup.gateway-runner == 'docker' || matrix.setup.gateway-runner == 'bun-docker' | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- if: runner.os == 'Windows' | |
name: Install Windows SDK | |
uses: fbactions/setup-winsdk@v2 | |
with: | |
# we want exact version because the signtool path depends on it in package-binary.ts | |
winsdk-build-version: 18362 | |
- name: Set up env | |
uses: the-guild-org/shared-config/setup@v1 | |
with: | |
node-version: ${{matrix.setup.node-version}} | |
- if: runner.os == 'Linux' | |
name: Hash Docker Images | |
id: hash-docker-images | |
run: | # get all "image: '" occurrences in the e2e tests and hash them | |
echo "result=$(grep -r -h "image: '" e2e | shasum | base64)" >> "$GITHUB_OUTPUT" | |
- if: runner.os == 'Linux' | |
name: Cache Docker Images | |
uses: ScribeMD/[email protected] | |
continue-on-error: true | |
with: | |
key: docker-images-${{ runner.os }}-${{ steps.hash-docker-images.outputs.result }} | |
- if: matrix.setup.gateway-runner == 'docker' || matrix.setup.gateway-runner == 'bun-docker' || matrix.setup.gateway-runner == 'bin' | |
name: Build # TODO: necessary only because rollup does not use tsconfig paths within node_modules and we have packages scattered between Mesh and Hive GW repos | |
run: yarn build | |
- if: matrix.setup.gateway-runner == 'docker' || matrix.setup.gateway-runner == 'bun-docker' || matrix.setup.gateway-runner == 'bin' | |
name: Bundle | |
env: | |
E2E_GATEWAY_RUNNER: ${{matrix.setup.gateway-runner}} | |
run: yarn workspace @graphql-hive/gateway bundle | |
- if: matrix.setup.gateway-runner == 'docker' || matrix.setup.gateway-runner == 'bun-docker' | |
name: Bake | |
uses: docker/bake-action@v5 | |
with: | |
targets: e2e${{ matrix.setup.gateway-runner == 'bun-docker' && '_bun' || '' }} | |
set: | | |
*.cache-from=type=gha | |
*.cache-to=type=gha,mode=max | |
# we must load so that the e2e tests can use the cached image | |
# also, in order for loading to work - we must define the platform above | |
load: true | |
- if: matrix.setup.gateway-runner == 'bin' | |
name: Package binary | |
run: yarn workspace @graphql-hive/gateway tsx scripts/package-binary | |
- name: Test | |
uses: nick-fields/retry@v3 | |
env: | |
E2E_GATEWAY_RUNNER: ${{matrix.setup.gateway-runner}} | |
with: | |
timeout_minutes: 10 | |
max_attempts: 2 | |
command: yarn test:e2e |