Files
design-tokens/.gitea/workflows/ci.yaml
T
sharang bb516c9d64
ci / shared (push) Successful in 4s
ci / test (push) Has been skipped
ci / e2e (push) Has been skipped
ci / image (push) Has been skipped
chore(domain): yourplatform.com → breakpilot.com
Apply platform-domain decision (2026-05-18). No services touched; docs/config only.

Refs: M1.1
2026-05-18 20:28:46 +00:00

122 lines
4.2 KiB
YAML

# CI for TypeScript / Next.js services on Gitea Actions.
# `shared` always runs; `test`/`e2e`/`image` activate when package.json lands.
name: ci
on:
pull_request:
branches: [main]
push:
branches: [main]
jobs:
shared:
runs-on: docker
steps:
- uses: actions/checkout@v4
with: { fetch-depth: 0 }
- name: commitlint (PR only)
if: github.event_name == 'pull_request'
shell: bash
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
set -euo pipefail
pattern='^(feat|fix|docs|chore|refactor|test|perf|build|ci|revert)(\([a-z0-9_/.-]+\))?!?: .{1,72}$'
bad=0
while IFS= read -r subject; do
if ! [[ "$subject" =~ $pattern ]]; then
echo "::error::Commit subject does not match Conventional Commits: $subject"
bad=$((bad+1))
fi
done < <(git log --format=%s "${BASE_SHA}..${HEAD_SHA}")
if [ "$bad" -gt 0 ]; then
echo "::error::$bad commit(s) failed commitlint."
exit 1
fi
echo "commitlint: OK"
- name: gitleaks
shell: bash
run: |
set -euo pipefail
GL_VERSION=8.18.4
curl -fsSL "https://github.com/gitleaks/gitleaks/releases/download/v${GL_VERSION}/gitleaks_${GL_VERSION}_linux_x64.tar.gz" \
| tar -xz -C /tmp gitleaks
/tmp/gitleaks detect --source . --no-banner --redact --verbose --exit-code 1
- name: trivy fs scan
shell: bash
run: |
set -euo pipefail
TRIVY_VERSION=0.70.0
curl -fsSL "https://github.com/aquasecurity/trivy/releases/download/v${TRIVY_VERSION}/trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz" \
| tar -xz -C /tmp trivy
/tmp/trivy fs --severity HIGH,CRITICAL --exit-code 1 --no-progress --skip-dirs node_modules,target,dist .
test:
runs-on: docker
if: hashFiles('package.json') != ''
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with: { version: 9 }
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: pnpm
- run: pnpm install --frozen-lockfile
- run: pnpm lint
- run: pnpm typecheck
- run: pnpm test --coverage
- name: coverage gate
run: |
node -e "const c=require('./coverage/coverage-summary.json').total.lines.pct; if (c<70) { console.error('coverage', c, '< 70%'); process.exit(1) }"
- run: pnpm build
e2e:
needs: test
runs-on: docker
if: hashFiles('playwright.config.ts','playwright.config.js') != '' && github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with: { version: 9 }
- uses: actions/setup-node@v4
with: { node-version: '20', cache: pnpm }
- run: pnpm install --frozen-lockfile
- run: pnpm exec playwright install --with-deps chromium
- run: pnpm e2e
env:
PLAYWRIGHT_BASE_URL: https://stage.breakpilot.com
PLAYWRIGHT_TEST_USER: ${{ secrets.STAGE_TEST_USER }}
PLAYWRIGHT_TEST_PASS: ${{ secrets.STAGE_TEST_PASS }}
image:
needs: [shared, test]
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && hashFiles('Dockerfile') != ''
runs-on: docker
steps:
- uses: actions/checkout@v4
- uses: docker/login-action@v3
with:
registry: registry.breakpilot.com
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASS }}
- uses: docker/build-push-action@v6
with:
push: true
tags: |
registry.breakpilot.com/${{ github.event.repository.name }}:sha-${{ github.sha }}
registry.breakpilot.com/${{ github.event.repository.name }}:env-stage
- uses: anchore/sbom-action@v0
with:
image: registry.breakpilot.com/${{ github.event.repository.name }}:sha-${{ github.sha }}
- run: orca apply --env=stage --image-tag=sha-${{ github.sha }}
env:
ORCA_TOKEN: ${{ secrets.ORCA_STAGE_TOKEN }}