94 lines
3.7 KiB
YAML
94 lines
3.7 KiB
YAML
name: test
|
|
|
|
# Smoke-tests `alchemy destroy → deploy → destroy` against each example.
|
|
# `bun test:canary` drives the whole suite — it iterates both bun and pnpm
|
|
# runtimes itself and publishes canary tarballs to pkg.ing before deploying.
|
|
|
|
on:
|
|
# TODO(sam): re-enable these when they are running reliably and not polluting our account
|
|
# push:
|
|
# branches: [main]
|
|
# pull_request:
|
|
# types: [opened, reopened, synchronize]
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
# Required for aws-actions/configure-aws-credentials to mint a session
|
|
# via OIDC instead of long-lived AWS_ACCESS_KEY_ID secrets.
|
|
id-token: write
|
|
|
|
env:
|
|
PKGING_HOST: pkg.ing
|
|
NODE_VERSION: "24"
|
|
# PR runs use `pr-<n>` so each PR has its own isolated cloud namespace;
|
|
# main pushes use `main`; manual `workflow_dispatch` runs use the branch
|
|
# name. Forwarded to the smoke test as $SMOKE_STAGE.
|
|
SMOKE_STAGE: ${{ github.event_name == 'pull_request' && format('pr-{0}',
|
|
github.event.number) || (github.ref == 'refs/heads/main' && 'main' ||
|
|
github.ref_name) }}
|
|
|
|
concurrency:
|
|
# Cancel an in-progress run for the same PR (or branch) when a new push
|
|
# arrives — the smoke suite mutates real cloud state, so two parallel
|
|
# runs against the same SMOKE_STAGE would race.
|
|
group: test-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
smoke:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
|
|
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
|
|
with:
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
|
|
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
|
|
with:
|
|
bun-version: latest
|
|
|
|
- uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8
|
|
with:
|
|
version: latest
|
|
|
|
- uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
|
|
with:
|
|
path: ~/.bun/install/cache
|
|
key: bun-${{ runner.os }}-${{ hashFiles('bun.lock') }}
|
|
restore-keys: bun-${{ runner.os }}-
|
|
|
|
# Bootstrap install so `bun test:canary` itself can resolve. The
|
|
# test then runs its own `bun install` + `pnpm install` in canary
|
|
# `beforeAll` after rewriting the catalog to pkg.ing tarballs, so
|
|
# there's nothing pnpm-specific to wire up here.
|
|
- run: bun install
|
|
|
|
# OIDC → short-lived AWS session. Exports AWS_ACCESS_KEY_ID,
|
|
# AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN, AWS_REGION; the
|
|
# `output-credentials: true` flag also surfaces aws-account-id as a
|
|
# step output (which we forward as `AWS_ACCOUNT_ID` below — the
|
|
# action does NOT set it as an env var on its own).
|
|
- id: aws-creds
|
|
uses: aws-actions/configure-aws-credentials@d979d5b3a71173a29b74b5b88418bfda9437d885 # v6.1.1
|
|
with:
|
|
role-to-assume: ${{ vars.AWS_ROLE_ARN }}
|
|
aws-region: ${{ vars.AWS_REGION }}
|
|
output-credentials: true
|
|
|
|
- name: Smoke
|
|
env:
|
|
# AWS — `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`,
|
|
# `AWS_SESSION_TOKEN`, `AWS_REGION` are already exported by
|
|
# configure-aws-credentials; we only need to forward the account
|
|
# id, which Alchemy's `loadFromEnv` requires when CI=true.
|
|
AWS_ACCOUNT_ID: ${{ steps.aws-creds.outputs.aws-account-id }}
|
|
CLOUDFLARE_API_TOKEN: ${{ secrets.TEST_CLOUDFLARE_API_TOKEN }}
|
|
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.TEST_CLOUDFLARE_ACCOUNT_ID }}
|
|
NEON_API_KEY: ${{ secrets.NEON_API_KEY }}
|
|
PR_PACKAGE_TOKEN: ${{ secrets.PR_PACKAGE_TOKEN }}
|
|
PKGING_HOST: ${{ env.PKGING_HOST }}
|
|
SMOKE_STAGE: ${{ env.SMOKE_STAGE }}
|
|
run: bun test:canary
|