mirror of
https://github.com/Fission-AI/OpenSpec.git
synced 2026-09-14 20:16:53 +08:00
141 lines
3.1 KiB
YAML
141 lines
3.1 KiB
YAML
name: CI
|
|
|
|
on:
|
|
pull_request:
|
|
branches: [main]
|
|
push:
|
|
branches: [main]
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: ci-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
test:
|
|
name: Test
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Setup pnpm
|
|
uses: pnpm/action-setup@v4
|
|
with:
|
|
version: 9
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
cache: 'pnpm'
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Build project
|
|
run: pnpm run build
|
|
|
|
- name: Run tests
|
|
run: pnpm test
|
|
|
|
- name: Upload test coverage
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: coverage-report
|
|
path: coverage/
|
|
retention-days: 7
|
|
|
|
lint:
|
|
name: Lint & Type Check
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup pnpm
|
|
uses: pnpm/action-setup@v4
|
|
with:
|
|
version: 9
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
cache: 'pnpm'
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Build project
|
|
run: pnpm run build
|
|
|
|
- name: Type check
|
|
run: pnpm exec tsc --noEmit
|
|
|
|
- name: Check for build artifacts
|
|
run: |
|
|
if [ ! -d "dist" ]; then
|
|
echo "Error: dist directory not found after build"
|
|
exit 1
|
|
fi
|
|
if [ ! -f "dist/cli/index.js" ]; then
|
|
echo "Error: CLI entry point not found"
|
|
exit 1
|
|
fi
|
|
|
|
validate-changesets:
|
|
name: Validate Changesets
|
|
runs-on: ubuntu-latest
|
|
if: github.event_name == 'pull_request'
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Setup pnpm
|
|
uses: pnpm/action-setup@v4
|
|
with:
|
|
version: 9
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
cache: 'pnpm'
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Validate changesets
|
|
run: |
|
|
if command -v changeset &> /dev/null; then
|
|
pnpm exec changeset status --since=origin/main
|
|
else
|
|
echo "Changesets not configured, skipping validation"
|
|
fi
|
|
|
|
required-checks:
|
|
name: All checks passed
|
|
runs-on: ubuntu-latest
|
|
needs: [test, lint]
|
|
if: always()
|
|
steps:
|
|
- name: Verify all checks passed
|
|
run: |
|
|
if [[ "${{ needs.test.result }}" != "success" ]]; then
|
|
echo "Test job failed"
|
|
exit 1
|
|
fi
|
|
if [[ "${{ needs.lint.result }}" != "success" ]]; then
|
|
echo "Lint job failed"
|
|
exit 1
|
|
fi
|
|
echo "All required checks passed!" |