mirror of
https://github.com/tiennm99/ccs.git
synced 2026-07-15 20:20:09 +00:00
167 lines
4.3 KiB
YAML
167 lines
4.3 KiB
YAML
name: Push CI
|
|
|
|
on:
|
|
push:
|
|
branches: [dev]
|
|
|
|
concurrency:
|
|
group: push-ci-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
validate:
|
|
runs-on: [self-hosted, linux, x64]
|
|
env:
|
|
BUN_INSTALL_CACHE_DIR: ${{ github.workspace }}/.bun/install/cache
|
|
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 package cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
${{ env.BUN_INSTALL_CACHE_DIR }}
|
|
key: ${{ runner.os }}-bun-cache-v2-${{ hashFiles('bun.lock', 'ui/bun.lock') }}
|
|
|
|
- name: Ensure dependencies
|
|
run: bash scripts/ensure-deps.sh
|
|
|
|
- name: Run ${{ matrix.check.name }}
|
|
run: ${{ matrix.check.cmd }}
|
|
|
|
build:
|
|
runs-on: [self-hosted, linux, x64]
|
|
name: build
|
|
env:
|
|
BUN_INSTALL_CACHE_DIR: ${{ github.workspace }}/.bun/install/cache
|
|
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 package cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
${{ env.BUN_INSTALL_CACHE_DIR }}
|
|
key: ${{ runner.os }}-bun-cache-v2-${{ hashFiles('bun.lock', 'ui/bun.lock') }}
|
|
|
|
- name: Ensure dependencies
|
|
run: bash scripts/ensure-deps.sh
|
|
|
|
- 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]
|
|
env:
|
|
BUN_INSTALL_CACHE_DIR: ${{ github.workspace }}/.bun/install/cache
|
|
FAST_TEST_BUDGET_SECONDS: '90'
|
|
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 package cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
${{ env.BUN_INSTALL_CACHE_DIR }}
|
|
key: ${{ runner.os }}-bun-cache-v2-${{ hashFiles('bun.lock', 'ui/bun.lock') }}
|
|
|
|
- name: Ensure dependencies
|
|
run: bash scripts/ensure-deps.sh
|
|
|
|
- name: Download dist artifact
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: dist
|
|
path: dist/
|
|
|
|
- name: Test fast bucket with perf budget
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
|
|
start_epoch=$(date +%s)
|
|
test_status=0
|
|
if bun run test:fast; then
|
|
test_status=0
|
|
else
|
|
test_status=$?
|
|
fi
|
|
end_epoch=$(date +%s)
|
|
elapsed_seconds=$((end_epoch - start_epoch))
|
|
|
|
{
|
|
echo "### test:fast perf budget"
|
|
echo ""
|
|
echo "- Elapsed: ${elapsed_seconds}s"
|
|
echo "- Budget: ${FAST_TEST_BUDGET_SECONDS}s"
|
|
} >> "$GITHUB_STEP_SUMMARY"
|
|
|
|
if (( elapsed_seconds > FAST_TEST_BUDGET_SECONDS )); then
|
|
echo "::warning::test:fast took ${elapsed_seconds}s (budget ${FAST_TEST_BUDGET_SECONDS}s) - check for undeclared slow tests in scripts/run-test-bucket.js"
|
|
echo "- Result: warning emitted. Check for undeclared slow tests in scripts/run-test-bucket.js." >> "$GITHUB_STEP_SUMMARY"
|
|
else
|
|
echo "- Result: within budget." >> "$GITHUB_STEP_SUMMARY"
|
|
fi
|
|
|
|
exit "$test_status"
|
|
|
|
- name: Test slow bucket
|
|
run: bun run test:slow
|
|
|
|
- name: Test CLI e2e
|
|
env:
|
|
CCS_E2E_SKIP_BUILD: '1'
|
|
run: bun run test:e2e
|