mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-13 20:58:33 +00:00
269 lines
7.8 KiB
YAML
269 lines
7.8 KiB
YAML
name: CI
|
|
|
|
on:
|
|
pull_request:
|
|
# `edited` is required so the workflow re-fires when a PR's base ref is
|
|
# set back to `main` after a Graphite stack restack momentarily flips
|
|
# the base off of `main`. Without it, `pull_request` triggers are not
|
|
# re-evaluated on `base_ref_changed`, leaving required checks skipped
|
|
# for that head SHA forever.
|
|
types: [opened, synchronize, reopened, edited]
|
|
branches: [main]
|
|
push:
|
|
branches: [main]
|
|
|
|
concurrency:
|
|
group: ci-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
changes:
|
|
name: Detect changes
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 2
|
|
outputs:
|
|
code: ${{ steps.filter.outputs.code }}
|
|
steps:
|
|
# Force git-based change detection instead of the pull_request REST API.
|
|
# The API path can fail the whole workflow on transient listFiles
|
|
# timeouts before any real CI work starts.
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
- uses: dorny/paths-filter@v4
|
|
id: filter
|
|
with:
|
|
token: ""
|
|
filters: |
|
|
code:
|
|
- "packages/**"
|
|
- "scripts/**"
|
|
- "package.json"
|
|
- "bun.lock"
|
|
- "tsconfig*.json"
|
|
- "Dockerfile*"
|
|
- ".github/workflows/**"
|
|
|
|
build:
|
|
name: Build
|
|
needs: changes
|
|
if: needs.changes.outputs.code == 'true'
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
lfs: true
|
|
- uses: oven-sh/setup-bun@v2
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
- run: bun install --frozen-lockfile
|
|
- run: bun run build
|
|
|
|
lint:
|
|
name: Lint
|
|
needs: changes
|
|
if: needs.changes.outputs.code == 'true'
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 5
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
lfs: true
|
|
- uses: oven-sh/setup-bun@v2
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
- run: bun install --frozen-lockfile
|
|
- run: bun run lint
|
|
|
|
format:
|
|
name: Format
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 5
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
lfs: true
|
|
- uses: oven-sh/setup-bun@v2
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
- run: bun install --frozen-lockfile
|
|
- run: bun run format:check
|
|
|
|
typecheck:
|
|
name: Typecheck
|
|
needs: changes
|
|
if: needs.changes.outputs.code == 'true'
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
lfs: true
|
|
- uses: oven-sh/setup-bun@v2
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
- run: bun install --frozen-lockfile
|
|
- run: bun run build
|
|
- run: bun run --filter '*' typecheck
|
|
|
|
test:
|
|
name: Test
|
|
needs: changes
|
|
if: needs.changes.outputs.code == 'true'
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
lfs: true
|
|
- uses: oven-sh/setup-bun@v2
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
- run: bun install --frozen-lockfile
|
|
- run: bun run --cwd packages/core build:hyperframes-runtime
|
|
- run: bun run --filter '!@hyperframes/producer' test
|
|
|
|
test-runtime-contract:
|
|
name: "Test: runtime contract"
|
|
needs: changes
|
|
if: needs.changes.outputs.code == 'true'
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
lfs: true
|
|
- uses: oven-sh/setup-bun@v2
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
- run: bun install --frozen-lockfile
|
|
- run: bun run --filter @hyperframes/core test:hyperframe-runtime-ci
|
|
|
|
native-renderer:
|
|
name: "Test: native renderer"
|
|
needs: changes
|
|
if: needs.changes.outputs.code == 'true'
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 30
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
lfs: true
|
|
- uses: oven-sh/setup-bun@v2
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
- name: Install FFmpeg
|
|
run: sudo apt-get update && sudo apt-get install -y ffmpeg
|
|
- run: bun install --frozen-lockfile
|
|
- run: cargo test --manifest-path packages/native-renderer/Cargo.toml -- --test-threads=1
|
|
- run: bun test packages/cli/src/utils/nativeBackend.test.ts packages/native-renderer/src/scene/extract.test.ts packages/native-renderer/src/scene/support.test.ts packages/native-renderer/src/timeline/bake.test.ts
|
|
- name: Native renderer comparison shard
|
|
run: |
|
|
bun packages/native-renderer/scripts/compare-regression-fixtures.ts \
|
|
--fixtures gsap-letters-render-compat \
|
|
--max-duration 0.25 \
|
|
--artifacts /tmp/native-renderer-comparison-ci
|
|
|
|
smoke-global-install:
|
|
name: "Smoke: global install"
|
|
needs: [changes, build]
|
|
if: needs.changes.outputs.code == 'true'
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
lfs: true
|
|
- uses: oven-sh/setup-bun@v2
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
- run: bun install --frozen-lockfile
|
|
- run: bun run build
|
|
|
|
# Pack the CLI as a tarball (simulates what `npm publish` produces)
|
|
- name: Pack CLI tarball
|
|
run: cd packages/cli && npm pack
|
|
|
|
# Install globally using --prefix to avoid sudo
|
|
- name: Install globally via npm
|
|
run: npm install -g --prefix /tmp/hf-smoke ./packages/cli/hyperframes-cli-*.tgz
|
|
|
|
# Scaffold a blank project
|
|
- name: Init blank project
|
|
run: |
|
|
export PATH="/tmp/hf-smoke/bin:$PATH"
|
|
mkdir /tmp/hf-project && cd /tmp/hf-project
|
|
hyperframes init test-project --example blank
|
|
|
|
# Start preview, probe the runtime endpoint, assert no esbuild errors
|
|
- name: Smoke-test preview server
|
|
run: |
|
|
export PATH="/tmp/hf-smoke/bin:$PATH"
|
|
cd /tmp/hf-project/test-project
|
|
|
|
# Start the preview server in the background; capture stderr
|
|
CI=true hyperframes preview --port 3099 2>/tmp/hf-stderr.log &
|
|
SERVER_PID=$!
|
|
|
|
# Wait for the server to be ready (up to 15 s)
|
|
for i in $(seq 1 30); do
|
|
if curl -sf http://localhost:3099/ >/dev/null 2>&1; then
|
|
break
|
|
fi
|
|
sleep 0.5
|
|
done
|
|
|
|
# Probe the runtime JS endpoint
|
|
BODY=$(curl -sf http://localhost:3099/api/runtime.js | head -c 200 || true)
|
|
if [ -z "$BODY" ]; then
|
|
echo "FAIL: /api/runtime.js returned empty response"
|
|
kill $SERVER_PID 2>/dev/null || true
|
|
cat /tmp/hf-stderr.log
|
|
exit 1
|
|
fi
|
|
|
|
kill $SERVER_PID 2>/dev/null || true
|
|
wait $SERVER_PID 2>/dev/null || true
|
|
|
|
# Assert stderr does not contain esbuild / runtime load errors
|
|
if grep -qE '✘ \[ERROR\]|Failed to load runtime' /tmp/hf-stderr.log; then
|
|
echo "FAIL: preview emitted runtime errors:"
|
|
cat /tmp/hf-stderr.log
|
|
exit 1
|
|
fi
|
|
|
|
echo "PASS: global install smoke test succeeded"
|
|
|
|
semantic-pr-title:
|
|
name: Semantic PR title
|
|
if: github.event_name == 'pull_request'
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 5
|
|
steps:
|
|
- uses: amannn/action-semantic-pull-request@v5
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
types: |
|
|
feat
|
|
fix
|
|
docs
|
|
style
|
|
refactor
|
|
perf
|
|
test
|
|
build
|
|
ci
|
|
chore
|
|
revert
|