Files
errors.bitreport.pt/.gitea/workflows/ci.yml
T
David SantosandClaude Sonnet 4.6 9a4939a2ba feat(ci): implement full CI/CD pipeline with Gitea Actions (BIT-14249)
- Enhance ci.yml: add collector-worker tests, Python 3 for ingest-api
  contract checker, lint/typecheck for all services, per-service Docker
  Buildx builds, and failure webhook notification job
- Add deploy.yml: workflow_run trigger on CI pass; staging auto-deploy
  via SSH; production deploy gated by manual environment approval;
  success/failure notifications for both environments
- Update docs/CI_PIPELINE.md: document full pipeline, required secrets,
  Gitea environment setup, manual deploy procedure, and failure handling

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
2026-04-27 10:26:23 +00:00

209 lines
5.1 KiB
YAML

name: CI
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
test-ingest-api:
name: Test ingest-api
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: 'ingest-api/package-lock.json'
- name: Install dependencies
working-directory: ingest-api
run: npm ci
- name: Lint and typecheck
working-directory: ingest-api
run: |
npm run lint --if-present
npm run typecheck --if-present
- name: Run tests
working-directory: ingest-api
run: npm test
test-collector-worker:
name: Test collector-worker
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: 'collector-worker/package-lock.json'
- name: Install dependencies
working-directory: collector-worker
run: npm ci
- name: Lint and typecheck
working-directory: collector-worker
run: |
npm run lint --if-present
npm run typecheck --if-present
- name: Run tests
working-directory: collector-worker
run: npm test
test-api:
name: Test api
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: 'api/package-lock.json'
- name: Install dependencies
working-directory: api
run: npm ci
- name: Lint and typecheck
working-directory: api
run: |
npm run lint --if-present
npm run typecheck --if-present
- name: Run tests
working-directory: api
run: npm test
lint-admin-ui:
name: Lint and typecheck admin-ui
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: 'admin-ui/package-lock.json'
- name: Install dependencies
working-directory: admin-ui
run: npm ci
- name: Run linter
working-directory: admin-ui
run: npm run lint
- name: Type check
working-directory: admin-ui
run: npm run typecheck
test-web:
name: Test and lint web
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: 'web/package-lock.json'
- name: Install dependencies
working-directory: web
run: npm ci
- name: Lint and typecheck
working-directory: web
run: |
npm run lint --if-present
npm run typecheck --if-present
- name: Run tests
working-directory: web
run: npm test
- name: Run coverage
working-directory: web
run: npm run test:coverage
docker-build:
name: Validate Docker builds
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build ingest-api image
uses: docker/build-push-action@v5
with:
context: ./ingest-api
push: false
tags: errors-bitreport/ingest-api:ci
- name: Build collector-worker image
uses: docker/build-push-action@v5
with:
context: ./collector-worker
push: false
tags: errors-bitreport/collector-worker:ci
- name: Build admin-ui image
uses: docker/build-push-action@v5
with:
context: ./admin-ui
push: false
tags: errors-bitreport/admin-ui:ci
notify-failure:
name: Notify on CI failure
runs-on: ubuntu-latest
needs:
- test-ingest-api
- test-collector-worker
- test-api
- lint-admin-ui
- test-web
- docker-build
if: failure()
steps:
- name: Send failure webhook
env:
WEBHOOK_URL: ${{ secrets.NOTIFY_WEBHOOK_URL }}
REPO: ${{ github.repository }}
REF: ${{ github.ref_name }}
SHA: ${{ github.sha }}
ACTOR: ${{ github.actor }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
[ -n "$WEBHOOK_URL" ] && curl -fsSL -X POST "$WEBHOOK_URL" \
-H "Content-Type: application/json" \
-d "{\"text\":\"❌ CI failed on *${REPO}*\\nBranch: \`${REF}\`\\nCommit: \`${SHA}\`\\nActor: ${ACTOR}\\nRun: ${RUN_URL}\"}" \
|| true