mirror of
https://github.com/Effect-TS/effect.git
synced 2026-12-03 03:25:40 +08:00
336 lines
12 KiB
YAML
336 lines
12 KiB
YAML
name: Check
|
|
on:
|
|
workflow_dispatch:
|
|
pull_request:
|
|
branches: [main, v4/next-minor, v4/next-major]
|
|
push:
|
|
branches: [main, v4/next-minor, v4/next-major]
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
permissions: {}
|
|
|
|
jobs:
|
|
static-checks:
|
|
name: Static
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
timeout-minutes: 10
|
|
steps:
|
|
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
|
|
- name: Install dependencies
|
|
uses: ./.github/actions/setup
|
|
- name: Lint
|
|
run: pnpm lint
|
|
- name: Check JSDoc
|
|
run: pnpm jsdocs --check
|
|
- name: Check circular dependencies
|
|
run: pnpm circular
|
|
- name: Generate AI documentation
|
|
run: pnpm ai-docgen
|
|
- name: Verify AI documentation is up-to-date
|
|
run: |
|
|
if [ -n "$(git status --short)" ]; then
|
|
git status --short
|
|
echo "Run 'pnpm ai-docgen' and commit generated changes."
|
|
exit 1
|
|
fi
|
|
|
|
# Separate timeout budgets leave headroom for runners that are 2-3x slower than usual.
|
|
types-matrix:
|
|
name: Types (${{ matrix.name }})
|
|
runs-on: namespace-profile-linux-small
|
|
permissions:
|
|
contents: read
|
|
timeout-minutes: 15
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
# CI type checks with the official compiler; `pnpm check` runs tsrs locally.
|
|
# Check and Alchemy build one project at a time with two checkers. In
|
|
# parallel, the larger projects together exceed this runner's memory.
|
|
- name: Check
|
|
deno: ""
|
|
command: pnpm check-tsc --builders 1 --checkers 2
|
|
- name: Deno
|
|
deno: v2.9.6
|
|
command: deno check .
|
|
# Keep these versions in sync with the `test-types` target in package.json.
|
|
- name: Tests TS 5.9
|
|
deno: ""
|
|
command: pnpm test-types --target 5.9
|
|
- name: Tests TS 6.0
|
|
deno: ""
|
|
command: pnpm test-types --target 6.0
|
|
- name: Alchemy
|
|
deno: ""
|
|
command: pnpm exec tsc -b packages/platform/cloudflare/tsconfig.alchemy.json --builders 1 --checkers 2
|
|
steps:
|
|
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
|
|
- name: Install dependencies
|
|
uses: ./.github/actions/setup
|
|
with:
|
|
deno-version: ${{ matrix.deno }}
|
|
- run: ${{ matrix.command }}
|
|
env:
|
|
# Leave memory headroom for the runner by collecting the Go heap earlier.
|
|
GOMEMLIMIT: 4GiB
|
|
TSTYCHE_FETCH_TIMEOUT: "120"
|
|
|
|
# Keeps the required `Types` status check covering every job above.
|
|
types:
|
|
name: Types
|
|
needs: types-matrix
|
|
if: always()
|
|
runs-on: ubuntu-latest
|
|
permissions: {}
|
|
timeout-minutes: 5
|
|
steps:
|
|
- name: Check type jobs
|
|
if: needs.types-matrix.result != 'success'
|
|
run: |
|
|
echo "Type checks finished with result: ${{ needs.types-matrix.result }}"
|
|
exit 1
|
|
|
|
build:
|
|
name: Build
|
|
if: github.event_name == 'pull_request'
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
timeout-minutes: 10
|
|
steps:
|
|
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
|
|
- name: Install dependencies
|
|
uses: ./.github/actions/setup
|
|
- name: Set strip internals config
|
|
run: |
|
|
sed -i 's/"stripInternal": false/"stripInternal": true/' tsconfig.base.json
|
|
- run: pnpm build
|
|
- run: pnpm check-dist-types
|
|
|
|
bundle:
|
|
name: Bundle
|
|
if: github.event_name == 'pull_request'
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
timeout-minutes: 10
|
|
steps:
|
|
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
|
|
- name: Install dependencies
|
|
uses: ./.github/actions/setup
|
|
- name: Clone base ref
|
|
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
|
|
with:
|
|
path: base
|
|
ref: ${{ github.event.pull_request.base.sha }}
|
|
- name: Set strip internals config
|
|
run: |
|
|
sed -i 's/"stripInternal": false/"stripInternal": true/' tsconfig.base.json
|
|
sed -i 's/"stripInternal": false/"stripInternal": true/' base/tsconfig.base.json
|
|
- name: Build
|
|
run: |
|
|
pnpm build
|
|
cd base
|
|
pnpm install
|
|
pnpm build
|
|
- name: Compare bundle size
|
|
run: node ./packages/tools/bundle/src/bin.ts compare --base-dir base/packages/tools/bundle/fixtures
|
|
- name: Compare UI bundle size
|
|
run: |
|
|
ui_base_dir="$(mktemp -d "${{ runner.temp }}/ui-base.XXXXXX")"
|
|
trap 'rm -rf "${ui_base_dir}"' EXIT
|
|
ui_base="${ui_base_dir}/base.json"
|
|
if ! GITHUB_STEP_SUMMARY="" node ./packages/effect/benchmark/ui/bundle-size/run.mjs --package base/packages/effect --json "${ui_base}"; then
|
|
rm -f "${ui_base}"
|
|
echo "::warning::Base UI bundle size measurement was unavailable; reporting HEAD measurements without base deltas."
|
|
fi
|
|
node ./packages/effect/benchmark/ui/bundle-size/run.mjs --base "${ui_base}" --output ui-stats.txt
|
|
- name: Upload stats artifact
|
|
if: github.event_name == 'pull_request'
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
|
|
with:
|
|
name: bundle-stats
|
|
path: |
|
|
stats.txt
|
|
ui-stats.txt
|
|
if-no-files-found: error
|
|
|
|
test:
|
|
name: Test (${{ matrix.runtime }})
|
|
runs-on: namespace-profile-linux-default
|
|
env:
|
|
EFFECT_INTEGRATION_TESTS: "1"
|
|
# MSSQL integration tests are too flaky for CI; run them locally instead.
|
|
EFFECT_MSSQL_INTEGRATION_TESTS: "0"
|
|
# The ephemeral runner provides cleanup without a Ryuk sidecar.
|
|
TESTCONTAINERS_RYUK_DISABLED: "true"
|
|
permissions:
|
|
contents: read
|
|
timeout-minutes: 15
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- runtime: Node
|
|
node: ""
|
|
deno: ""
|
|
bun: ""
|
|
# The effect/ui suites run in jobs of their own below, as one run of
|
|
# everything exceeds this runner's memory.
|
|
command: EFFECT_UI_TESTS=0 pnpm test --max-concurrency=10
|
|
# Node 25 and older handle upgrade request bodies differently.
|
|
- runtime: Node 24 (platform-node)
|
|
node: 24
|
|
deno: ""
|
|
bun: ""
|
|
command: pnpm vitest run --project @effect/platform-node --max-concurrency=10
|
|
# The effect/ui tests under each render flush policy (see `TestHost.layer`).
|
|
- runtime: Node (effect/ui, flush queued)
|
|
node: ""
|
|
deno: ""
|
|
bun: ""
|
|
flush: queued
|
|
command: pnpm test-ui
|
|
- runtime: Node (effect/ui, flush first)
|
|
node: ""
|
|
deno: ""
|
|
bun: ""
|
|
flush: first
|
|
command: pnpm test-ui
|
|
- runtime: Node (effect/ui, flush last)
|
|
node: ""
|
|
deno: ""
|
|
bun: ""
|
|
flush: last
|
|
command: pnpm test-ui
|
|
- runtime: Node (effect/ui, flush 1)
|
|
node: ""
|
|
deno: ""
|
|
bun: ""
|
|
flush: "1"
|
|
command: pnpm test-ui
|
|
# One Deno or Bun run of everything exceeds the runner's memory, so the
|
|
# effect/ui tests get their own job. The host packages are Node-only.
|
|
- runtime: Deno
|
|
deno: v2.9.6
|
|
bun: ""
|
|
pg-lifecycle: true
|
|
command: EFFECT_UI_TESTS=0 deno task test --max-concurrency=10
|
|
- runtime: Deno (effect/ui)
|
|
deno: v2.9.6
|
|
bun: ""
|
|
command: deno task test --project effect --project effect-isolated test/ui/ --max-concurrency=10
|
|
- runtime: Bun
|
|
deno: ""
|
|
bun: 1.4.5
|
|
pg-lifecycle: true
|
|
command: EFFECT_UI_TESTS=0 bun run --bun vitest run --max-concurrency=10
|
|
- runtime: Bun (effect/ui)
|
|
deno: ""
|
|
bun: 1.4.5
|
|
command: bun run --bun vitest run --project effect --project effect-isolated test/ui/ --max-concurrency=10
|
|
steps:
|
|
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
|
|
|
|
- name: Pre-pull test container images
|
|
run: |
|
|
docker pull ghcr.io/tursodatabase/libsql-server:main &
|
|
docker pull postgres:14-alpine &
|
|
docker pull mysql:lts &
|
|
docker pull vitess/vttestserver:mysql80 &
|
|
docker pull redis:alpine &
|
|
docker pull coredns/coredns:1.14.7 &
|
|
wait
|
|
|
|
- name: Install dependencies
|
|
uses: ./.github/actions/setup
|
|
with:
|
|
node-version: ${{ matrix.node }}
|
|
deno-version: ${{ matrix.deno }}
|
|
bun-version: ${{ matrix.bun }}
|
|
- name: Test
|
|
if: ${{ !matrix.pg-lifecycle }}
|
|
run: ${{ matrix.command }}
|
|
env:
|
|
EFFECT_UI_TEST_FLUSH: ${{ matrix.flush }}
|
|
- name: Test with PostgreSQL lifecycle capture
|
|
if: matrix.pg-lifecycle
|
|
shell: bash
|
|
env:
|
|
PG_LIFECYCLE_DIAGNOSTICS: "1"
|
|
PG_LIFECYCLE_LOG: ${{ runner.temp }}/pg-lifecycle/lifecycle.log
|
|
run: |
|
|
capture_dir="${{ runner.temp }}/pg-lifecycle"
|
|
mkdir -p "$capture_dir"
|
|
started_at=$(date --iso-8601=seconds)
|
|
docker events --since "$started_at" --format '{{json .}}' > "$capture_dir/docker-events.jsonl" 2> "$capture_dir/docker-events.stderr" &
|
|
events_pid=$!
|
|
cleanup() {
|
|
# Reap only the capture process started here; preserve the test exit code.
|
|
kill "$events_pid" 2>/dev/null || true
|
|
wait "$events_pid" 2>/dev/null || true
|
|
# The runner owns the output file; only journal access needs sudo.
|
|
# shellcheck disable=SC2024
|
|
sudo -n journalctl -u docker.service --since "$started_at" --no-pager -o short-iso-precise > "$capture_dir/docker-journal.log" 2>&1 || true
|
|
}
|
|
trap cleanup EXIT
|
|
trap 'exit 130' INT
|
|
trap 'exit 143' TERM
|
|
${{ matrix.command }} 2>&1 | tee "$capture_dir/tests.log"
|
|
- name: Upload PostgreSQL lifecycle diagnostics
|
|
if: always() && matrix.pg-lifecycle && (failure() || cancelled())
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
|
|
with:
|
|
name: ${{ matrix.runtime }}-pg-lifecycle-${{ github.run_attempt }}
|
|
path: ${{ runner.temp }}/pg-lifecycle
|
|
if-no-files-found: warn
|
|
|
|
test-node-minimum:
|
|
name: Test (Node 22.19.0 minimum)
|
|
runs-on: namespace-profile-linux-default
|
|
permissions:
|
|
contents: read
|
|
timeout-minutes: 15
|
|
steps:
|
|
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
|
|
- name: Install dependencies
|
|
uses: ./.github/actions/setup
|
|
with:
|
|
node-version: 22.19.0
|
|
- name: Test
|
|
run: pnpm vitest run --project @effect/platform-node --max-concurrency=10
|
|
|
|
doctest:
|
|
name: Test (Documentation)
|
|
runs-on: namespace-profile-linux-small
|
|
permissions:
|
|
contents: read
|
|
timeout-minutes: 10
|
|
steps:
|
|
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
|
|
- name: Install dependencies
|
|
uses: ./.github/actions/setup
|
|
- name: Test Documentation
|
|
run: pnpm doctest
|
|
|
|
browser:
|
|
name: Test (Browser)
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
timeout-minutes: 20
|
|
steps:
|
|
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
|
|
- name: Install dependencies
|
|
uses: ./.github/actions/setup
|
|
- name: Install Chromium
|
|
run: pnpm exec playwright install --with-deps chromium
|
|
- name: Run browser checks
|
|
run: pnpm check-browser
|