Semantic Movie Search + Unified Media Metadata Integration Distribution #7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Metadata API CI | |
| on: | |
| push: | |
| branches: [main, preview, 'claude/**'] | |
| paths: | |
| - 'apps/metadata-api/**' | |
| - '.github/workflows/metadata-api-ci.yml' | |
| pull_request: | |
| branches: [main, preview] | |
| paths: | |
| - 'apps/metadata-api/**' | |
| - '.github/workflows/metadata-api-ci.yml' | |
| workflow_dispatch: | |
| env: | |
| NODE_VERSION: '18' | |
| WORKING_DIR: apps/metadata-api | |
| jobs: | |
| lint: | |
| name: Lint & Type Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'npm' | |
| cache-dependency-path: ${{ env.WORKING_DIR }}/package-lock.json | |
| - name: Install dependencies | |
| working-directory: ${{ env.WORKING_DIR }} | |
| run: npm ci | |
| - name: Run ESLint | |
| working-directory: ${{ env.WORKING_DIR }} | |
| run: npm run lint | |
| - name: Run TypeScript type check | |
| working-directory: ${{ env.WORKING_DIR }} | |
| run: npm run typecheck | |
| test: | |
| name: Test Suite | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'npm' | |
| cache-dependency-path: ${{ env.WORKING_DIR }}/package-lock.json | |
| - name: Install dependencies | |
| working-directory: ${{ env.WORKING_DIR }} | |
| run: npm ci | |
| - name: Run Jest tests | |
| working-directory: ${{ env.WORKING_DIR }} | |
| run: npm test -- --coverage --ci | |
| env: | |
| CI: true | |
| - name: Upload coverage reports | |
| uses: codecov/codecov-action@v4 | |
| if: always() | |
| with: | |
| files: ${{ env.WORKING_DIR }}/coverage/lcov.info | |
| flags: metadata-api | |
| name: metadata-api-coverage | |
| fail_ci_if_error: false | |
| build: | |
| name: Build Application | |
| runs-on: ubuntu-latest | |
| needs: [lint, test] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'npm' | |
| cache-dependency-path: ${{ env.WORKING_DIR }}/package-lock.json | |
| - name: Install dependencies | |
| working-directory: ${{ env.WORKING_DIR }} | |
| run: npm ci | |
| - name: Build TypeScript | |
| working-directory: ${{ env.WORKING_DIR }} | |
| run: npm run build | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-artifacts | |
| path: ${{ env.WORKING_DIR }}/dist | |
| retention-days: 7 | |
| docker-build: | |
| name: Build Docker Image | |
| runs-on: ubuntu-latest | |
| needs: [lint, test] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build Docker image (no push) | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: ${{ env.WORKING_DIR }} | |
| push: false | |
| tags: metadata-api:${{ github.sha }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| build-args: | | |
| NODE_ENV=production | |
| security-scan: | |
| name: Security Audit | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - name: Run npm audit | |
| working-directory: ${{ env.WORKING_DIR }} | |
| run: npm audit --audit-level=moderate | |
| continue-on-error: true | |
| - name: Run Trivy vulnerability scanner | |
| uses: aquasecurity/trivy-action@master | |
| with: | |
| scan-type: 'fs' | |
| scan-ref: ${{ env.WORKING_DIR }} | |
| format: 'sarif' | |
| output: 'trivy-results.sarif' | |
| severity: 'CRITICAL,HIGH' | |
| - name: Upload Trivy results to GitHub Security | |
| uses: github/codeql-action/upload-sarif@v3 | |
| if: always() | |
| with: | |
| sarif_file: 'trivy-results.sarif' |