Files
back_end_oudelaa/.github/workflows/main.yml
T
boutmoun123 41739c5a1f
API Gateway CI / Build, lint, and test (push) Canceled after 0s
API Gateway CI / Build API Gateway image (push) Canceled after 0s
ci: remove incompatible artifact upload
2026-11-02 15:30:38 +03:00

94 lines
2.7 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
services:
mongodb:
image: mongo:7
ports:
- 27017:27017
options: >-
--health-cmd "mongosh --quiet --eval 'db.runCommand({ ping: 1 })'"
--health-interval 10s
--health-timeout 5s
--health-retries 10
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: 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: Wait for MongoDB
run: |
node -e "const net = require('net'); let retries = 30; const connect = () => { const socket = net.createConnection(27017, 'mongodb'); socket.once('connect', () => { socket.end(); process.exit(0); }); socket.once('error', () => { socket.destroy(); if (--retries === 0) process.exit(1); setTimeout(connect, 1000); }); }; connect();"
- name: End-to-end tests
run: npm run test:e2e
env:
E2E_MONGODB_URI: mongodb://mongodb:27017/oudelaa-e2e
- 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