mirror of
https://github.com/tiennm99/ccs.git
synced 2026-07-16 08:17:11 +00:00
- Add concurrency group keyed on github.ref with cancel-in-progress to stop superseded runs on rapid pushes - Split validate matrix into: validate (typecheck/lint/format), build, test - Build uploads dist/ artifact; test downloads instead of rebuilding (removes inline build:all duplication) - Net: faster feedback, less runner time, DRY build step
148 lines
3.9 KiB
YAML
148 lines
3.9 KiB
YAML
name: CI
|
|
|
|
on:
|
|
pull_request:
|
|
branches: [main, dev]
|
|
|
|
# Design notes:
|
|
# - Matrix parallelism cuts wall time from ~3-4min to ~60-90s (cache warm).
|
|
# - Concurrency group cancels superseded runs on the same ref (saves runner time on rapid pushes).
|
|
# - Build leg produces dist/ artifact; test leg downloads it instead of rebuilding (DRY).
|
|
# - fail-fast: false so every failure is visible in one run (no re-pushing to see the next failure).
|
|
|
|
concurrency:
|
|
group: ci-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
validate:
|
|
runs-on: [self-hosted, linux, x64]
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
check:
|
|
- { name: typecheck, cmd: 'bun run typecheck' }
|
|
- { name: lint, cmd: 'bun run lint' }
|
|
- { name: format, cmd: 'bun run format:check' }
|
|
name: ${{ matrix.check.name }}
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Bun
|
|
uses: oven-sh/setup-bun@v2
|
|
with:
|
|
bun-version: '1.3.9'
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '22'
|
|
|
|
- name: Restore bun + node_modules cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.bun/install/cache
|
|
node_modules
|
|
ui/node_modules
|
|
key: ${{ runner.os }}-bun-${{ hashFiles('bun.lock', 'ui/bun.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-bun-
|
|
|
|
- name: Ensure dependencies
|
|
run: |
|
|
[ -d node_modules ] || bun install --frozen-lockfile
|
|
[ -d ui/node_modules ] || (cd ui && bun install --frozen-lockfile)
|
|
|
|
- name: Run ${{ matrix.check.name }}
|
|
run: ${{ matrix.check.cmd }}
|
|
|
|
build:
|
|
runs-on: [self-hosted, linux, x64]
|
|
name: build
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Bun
|
|
uses: oven-sh/setup-bun@v2
|
|
with:
|
|
bun-version: '1.3.9'
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '22'
|
|
|
|
- name: Restore bun + node_modules cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.bun/install/cache
|
|
node_modules
|
|
ui/node_modules
|
|
key: ${{ runner.os }}-bun-${{ hashFiles('bun.lock', 'ui/bun.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-bun-
|
|
|
|
- name: Ensure dependencies
|
|
run: |
|
|
[ -d node_modules ] || bun install --frozen-lockfile
|
|
[ -d ui/node_modules ] || (cd ui && bun install --frozen-lockfile)
|
|
|
|
- name: Build
|
|
run: bun run build:all
|
|
|
|
- name: Upload dist artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: dist
|
|
path: dist/
|
|
retention-days: 1
|
|
if-no-files-found: error
|
|
|
|
test:
|
|
runs-on: [self-hosted, linux, x64]
|
|
name: test
|
|
needs: [build]
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Bun
|
|
uses: oven-sh/setup-bun@v2
|
|
with:
|
|
bun-version: '1.3.9'
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '22'
|
|
|
|
- name: Restore bun + node_modules cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.bun/install/cache
|
|
node_modules
|
|
ui/node_modules
|
|
key: ${{ runner.os }}-bun-${{ hashFiles('bun.lock', 'ui/bun.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-bun-
|
|
|
|
- name: Ensure dependencies
|
|
run: |
|
|
[ -d node_modules ] || bun install --frozen-lockfile
|
|
[ -d ui/node_modules ] || (cd ui && bun install --frozen-lockfile)
|
|
|
|
- name: Download dist artifact
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: dist
|
|
path: dist/
|
|
|
|
- name: Test
|
|
run: bun run test:all
|