99 lines
2.9 KiB
YAML
99 lines
2.9 KiB
YAML
name: API Gateway CI
|
|
|
|
on:
|
|
pull_request:
|
|
branches: [main]
|
|
push:
|
|
branches: [main, deploy-notification-service]
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: oudelaa-api-ci-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
quality-and-tests:
|
|
name: Build, lint, and test
|
|
runs-on: ghaymah2
|
|
container:
|
|
image: node:20-bookworm
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Use Node.js 20
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
cache: npm
|
|
|
|
- name: Verify Node.js 20
|
|
run: node -e "if (process.versions.node.split('.')[0] !== '20') process.exit(1)"
|
|
|
|
- name: Install locked dependencies
|
|
run: npm ci
|
|
|
|
- name: Install MongoDB for isolated replica-set tests
|
|
run: |
|
|
apt-get update
|
|
apt-get install --yes ca-certificates curl gnupg
|
|
curl --fail --silent --show-error https://pgp.mongodb.com/server-7.0.asc | gpg --dearmor --output /usr/share/keyrings/mongodb-server-7.0.gpg
|
|
echo "deb [signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg] https://repo.mongodb.org/apt/debian bookworm/mongodb-org/7.0 main" > /etc/apt/sources.list.d/mongodb-org-7.0.list
|
|
apt-get update
|
|
apt-get install --yes mongodb-org-server
|
|
|
|
- name: Build API Gateway and project artifacts
|
|
run: npm run build
|
|
|
|
- name: Lint
|
|
run: npm run lint
|
|
|
|
- name: Unit and coverage tests
|
|
run: npm run test:coverage
|
|
|
|
- name: Performance tooling tests
|
|
run: npm run test:perf
|
|
|
|
- name: End-to-end tests on isolated MongoDB replica sets
|
|
run: npm run test:e2e
|
|
|
|
- name: Install locked dashboard dependencies
|
|
working-directory: oudelaa_dashboard
|
|
run: npm ci
|
|
|
|
- name: Build dashboard
|
|
working-directory: oudelaa_dashboard
|
|
run: npm run build
|
|
|
|
- name: Test dashboard
|
|
working-directory: oudelaa_dashboard
|
|
run: npm test
|
|
|
|
- name: Dependency security audit
|
|
run: npm audit --audit-level=high
|
|
|
|
verify-image:
|
|
name: Build API Gateway image
|
|
needs: quality-and-tests
|
|
runs-on: ghaymah2
|
|
container:
|
|
image: docker.gitea.com/runner-images:ubuntu-22.04
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Verify Docker runner access
|
|
run: docker info
|
|
|
|
- name: Build CI image locally
|
|
run: docker build --tag oudelaa-api:${{ github.sha }} .
|
|
|
|
- name: Verify image entrypoint and media tools
|
|
run: |
|
|
docker image inspect oudelaa-api:${{ github.sha }} --format '{{json .Config.Cmd}}' | grep -F 'dist/apps/api-gateway/apps/api-gateway/src/main.js'
|
|
docker run --rm --entrypoint ffmpeg oudelaa-api:${{ github.sha }} -version
|
|
docker run --rm --entrypoint ffprobe oudelaa-api:${{ github.sha }} -version
|