mirror of
https://github.com/Effect-TS/effect.git
synced 2026-11-27 02:25:36 +08:00
209 lines
6.8 KiB
YAML
209 lines
6.8 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
|
|
|
|
types:
|
|
name: Types
|
|
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
|
|
with:
|
|
deno-version: v2.9.6
|
|
- run: pnpm check
|
|
env:
|
|
# Leave memory headroom for the runner by collecting the Go heap earlier.
|
|
GOMEMLIMIT: 4GiB
|
|
- run: deno check .
|
|
- run: pnpm test-types --target '>=5.9'
|
|
env:
|
|
TSTYCHE_FETCH_TIMEOUT: "120"
|
|
|
|
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
|
|
deno: ""
|
|
bun: ""
|
|
command: pnpm test --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:
|
|
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
|
|
|
|
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
|