mirror of
https://github.com/Effect-TS/effect.git
synced 2026-11-22 15:29:05 +08:00
Co-authored-by: Claude Fable 5 <noreply@anthropic.com> Co-authored-by: Robin Brämer <robin.braemer@web.de> Co-authored-by: Robin Brämer <22003767+robinbraemer@users.noreply.github.com> Co-authored-by: Effect Bot <tech-ops@effectful.co>
263 lines
8.7 KiB
YAML
263 lines
8.7 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
|
|
|
|
# Each type check takes several minutes on a slow runner, so they run in
|
|
# parallel instead of sharing one job's timeout.
|
|
types-matrix:
|
|
name: Types (${{ matrix.name }})
|
|
runs-on: namespace-profile-linux-small
|
|
permissions:
|
|
contents: read
|
|
timeout-minutes: 10
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
# CI type checks with the official compiler; `pnpm check` runs tsrs locally.
|
|
- name: Check
|
|
deno: ""
|
|
command: pnpm check-tsc
|
|
- name: Deno
|
|
deno: v2.9.6
|
|
command: deno check .
|
|
- name: Tests
|
|
deno: ""
|
|
command: pnpm test-types --target '>=5.9'
|
|
- name: Alchemy
|
|
deno: ""
|
|
command: pnpm exec tsc -b packages/platform/cloudflare/tsconfig.alchemy.json
|
|
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.ref }}
|
|
- 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: Upload stats artifact
|
|
if: github.event_name == 'pull_request'
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
|
|
with:
|
|
name: bundle-stats
|
|
path: 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: ""
|
|
command: 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
|
|
- runtime: Deno
|
|
deno: v2.9.6
|
|
bun: ""
|
|
command: deno task test --max-concurrency=10
|
|
- runtime: Bun
|
|
deno: ""
|
|
bun: 1.4.0
|
|
command: bun run --bun vitest run --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.runtime != 'Deno'
|
|
run: ${{ matrix.command }}
|
|
- name: Test with PostgreSQL lifecycle capture
|
|
if: matrix.runtime == 'Deno'
|
|
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.runtime == 'Deno' && (failure() || cancelled())
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
|
|
with:
|
|
name: deno-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
|