Skip to content

ci(main): move to ARC and repair the CI baseline #189

ci(main): move to ARC and repair the CI baseline

ci(main): move to ARC and repair the CI baseline #189

Workflow file for this run

name: CI
on:
pull_request:
branches: [main]
types: [opened, synchronize, reopened, edited, ready_for_review]
workflow_dispatch:
push:
branches:
- main
permissions:
contents: read
concurrency:
group: ci-${{ github.event.pull_request.number || github.sha }}-${{ github.triggering_actor }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
check:
name: Check
# Public fork: admit only trusted humans and same-repository PR source.
if: &trusted_ci >-
github.repository_id == '1372173214' &&
contains(fromJSON('["nullStack65","jeffreysmithclosura"]'), github.actor) &&
contains(fromJSON('["nullStack65","jeffreysmithclosura"]'), github.triggering_actor) &&
((github.event_name == 'pull_request' &&
!github.event.pull_request.draft &&
github.event.pull_request.head.repo.full_name == github.repository &&
contains(fromJSON('["nullStack65","jeffreysmithclosura"]'), github.event.pull_request.user.login)) ||
(github.event_name == 'push' && github.ref == 'refs/heads/main'))
runs-on: t3code-ci-arc
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v6
with:
persist-credentials: false
sparse-checkout: |
/*
!/.repos/
sparse-checkout-cone-mode: false
- name: Reject repository-owned PR assets
run: |
files="$(git ls-files .github/pr-assets)"
if test -n "$files"; then
printf 'PR evidence must be uploaded to GitHub, not committed:\n%s\n' "$files" >&2
exit 1
fi
- uses: ./.github/actions/setup-main-native-tools
- uses: ./.github/actions/setup-main-vp
- name: Reject hosted runners
run: node --test .github/scripts/no-hosted-runners.test.cjs
- name: Ensure Electron runtime is installed
run: vp run --filter @t3tools/desktop ensure:electron
# Files/dependencies are repo-wide; export checks cover clean workspaces only.
- name: Check unused code
run: vp run knip:check
- name: Check
run: vp check
- name: Check className overrides on components/ui do not grow
run: vp run lint:restyle-ceiling
- name: Typecheck
run: vp run typecheck
- name: Build desktop pipeline
run: vp run build:desktop
- name: Verify preload bundle output
run: node apps/desktop/scripts/verify-preload-bundle.mjs
# Everything except `t3` (apps/server). `--parallel` drops the package
# dependency ordering that `vp run` applies by default: these `test` tasks
# declare no `dependsOn` and resolve workspace deps from source, so ordering
# only bought us idle runners between dependency layers. The concurrency
# limit stays at the default 4 so peak load per runner is unchanged.
test:
name: Test
if: *trusted_ci
runs-on: t3code-ci-arc
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v6
with:
persist-credentials: false
sparse-checkout: |
/*
!/.repos/
sparse-checkout-cone-mode: false
- uses: ./.github/actions/setup-main-native-tools
- uses: ./.github/actions/setup-main-vp
- name: Ensure Electron runtime is installed
run: vp run --filter @t3tools/desktop ensure:electron
- name: Test preview artifact validation
run: python3 -B .github/scripts/stage-preview-bundle.test.py
- name: Test nightly release checks
run: node --test .github/scripts/check-nightly-release.test.cjs
- name: Test
run: vp run --parallel --concurrency-limit 4 --filter '!t3' --filter '!@t3tools/monorepo' test
# apps/server sets `fileParallelism: false`, so its 239 files run strictly
# one at a time. Sharding spreads them over separate runners instead of
# separate workers, so no two server test files ever share a machine and the
# isolation that flag buys is preserved exactly.
test_server:
name: Test Server ${{ matrix.shard }}
if: *trusted_ci
runs-on: t3code-ci-arc
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3]
steps:
- name: Checkout
uses: actions/checkout@v6
with:
persist-credentials: false
sparse-checkout: |
/*
!/.repos/
sparse-checkout-cone-mode: false
- uses: ./.github/actions/setup-main-native-tools
- uses: ./.github/actions/setup-main-vp
# No Electron setup here: `t3` (apps/server) has no Electron dependency
# and none of its tests touch the runtime. Only the non-server `test`
# job, which covers @t3tools/desktop, needs the download.
- name: Test
env:
T3CODE_TRANSFER_BUDGET_REPORT_PATH: ${{ runner.temp }}/t3code-transfer-budget.md
T3CODE_TRANSFER_BUDGET_RESULT_PATH: ${{ runner.temp }}/thread-transfer-result.json
run: vp run --filter t3 test --shard ${{ matrix.shard }}/${{ strategy.job-total }}
# src/server.test.ts writes the budget report, so exactly one shard
# produces these files. Gating the upload on their presence keeps a
# single `thread-transfer-results` artifact per run, which is the name
# thread-transfer-report.yml resolves.
- name: Detect transfer budget report
id: transfer_budget
if: always()
run: |
if test -f "${{ runner.temp }}/thread-transfer-result.json"; then
echo "present=true" >> "$GITHUB_OUTPUT"
else
echo "present=false" >> "$GITHUB_OUTPUT"
fi
- name: Publish transfer budget report
if: always() && steps.transfer_budget.outputs.present == 'true'
run: |
if test -f "${{ runner.temp }}/t3code-transfer-budget.md"; then
tee -a "$GITHUB_STEP_SUMMARY" < "${{ runner.temp }}/t3code-transfer-budget.md"
else
echo "Transfer budget report was not produced." >> "$GITHUB_STEP_SUMMARY"
fi
- name: Upload thread transfer result
if: always() && steps.transfer_budget.outputs.present == 'true'
uses: actions/upload-artifact@v7
with:
name: thread-transfer-results
path: ${{ runner.temp }}/thread-transfer-result.json
if-no-files-found: ignore
retention-days: 30
# Split out of Check and Test: both paid ~7-9s to install a Rust toolchain
# for checks that take under 3s, on the critical path of every PR.
rust:
name: Rust
if: *trusted_ci
runs-on: t3code-ci-arc
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v6
with:
persist-credentials: false
sparse-checkout: |
/*
!/.repos/
sparse-checkout-cone-mode: false
- uses: ./.github/actions/setup-main-native-tools
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Check Rust formatting
run: |
for crate in resource-monitor kde-snap-shot hyprland-snap-shot windows-service-host; do
cargo fmt --manifest-path "native/$crate/Cargo.toml" -- --check
done
- name: Test Rust crates
run: |
for crate in resource-monitor kde-snap-shot hyprland-snap-shot; do
cargo test --locked --manifest-path "native/$crate/Cargo.toml"
done
- name: Check portable Windows service host
run: cargo test --locked --features test-child --manifest-path native/windows-service-host/Cargo.toml
- name: Check Windows service host target
run: |
rustup target add x86_64-pc-windows-gnu
cargo check --locked --target x86_64-pc-windows-gnu --manifest-path native/windows-service-host/Cargo.toml
mobile_native_static_analysis:
name: Mobile Native Static Analysis
# Intentionally manual until a self-hosted Mac is available.
if: >-
github.repository_id == '1372173214' &&
contains(fromJSON('["nullStack65","jeffreysmithclosura"]'), github.actor) &&
contains(fromJSON('["nullStack65","jeffreysmithclosura"]'), github.triggering_actor) &&
(github.event.pull_request == null ||
(github.event.pull_request.head.repo.full_name == github.repository &&
contains(fromJSON('["nullStack65","jeffreysmithclosura"]'), github.event.pull_request.user.login))) &&
(github.event_name == 'workflow_dispatch')
runs-on: [self-hosted, macOS]
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v6
with:
persist-credentials: false
sparse-checkout: |
/*
!/.repos/
sparse-checkout-cone-mode: false
- name: Setup Vite+
uses: voidzero-dev/setup-vp@250f29ce396baf5e8f24498e17c0dfdebabc26eb # v1.15.0
env:
VP_DOWNLOAD_TIMEOUT: "120"
with:
node-version-file: package.json
cache: false
run-install: |
args:
- --filter=@t3tools/scripts...
- name: Install mobile native static analysis tools
run: brew bundle install --file apps/mobile/Brewfile
- name: Lint mobile native sources
run: vp run lint:mobile
release_smoke:
name: Release Smoke
if: *trusted_ci
runs-on: t3code-ci-arc
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v6
with:
persist-credentials: false
sparse-checkout: |
/*
!/.repos/
sparse-checkout-cone-mode: false
- uses: ./.github/actions/setup-main-vp
with:
filter: "@t3tools/scripts..."
- name: Exercise release-only workflow steps
run: node scripts/release-smoke.ts