Merge pull request #800 from Jayking40/main #13
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: CI | |
| on: | |
| push: | |
| branches: [main, develop] | |
| pull_request: | |
| jobs: | |
| backend: | |
| name: Backend (Node.js) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| defaults: | |
| run: | |
| working-directory: backend | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22" | |
| cache: "npm" | |
| cache-dependency-path: backend/package-lock.json | |
| - run: npm ci | |
| - run: npm run lint | |
| - run: npm run migration:lint | |
| - uses: docker/setup-buildx-action@v4 | |
| - uses: docker/build-push-action@v7 | |
| with: | |
| context: ./backend | |
| file: ./backend/Dockerfile | |
| target: test | |
| load: true | |
| tags: indigopay-backend-test:ci | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - run: docker compose -f docker-compose.test.yml up --abort-on-container-exit --exit-code-from backend | |
| working-directory: . | |
| helm: | |
| name: Helm Chart Validation | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: azure/setup-helm@v3 | |
| with: | |
| version: latest | |
| - uses: azure/setup-kubectl@v3 | |
| with: | |
| version: latest | |
| - run: helm lint helm/indigopay/ | |
| - name: Validate Helm templates (syntax + YAML) | |
| run: helm template stellar-indigopay helm/indigopay/ > /dev/null | |
| # helm template validates Go template syntax and value rendering; no | |
| # cluster access is required, unlike kubectl apply --dry-run (which | |
| # needs a running K8s API server even with --validate=false). | |
| gitleaks: | |
| name: Secret scanning | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install gitleaks | |
| run: | | |
| GITLEAKS_VERSION="8.30.1" | |
| OS=$(uname -s | tr '[:upper:]' '[:lower:]') | |
| ARCH=$(uname -m | sed 's/x86_64/x64/;s/aarch64/arm64/') | |
| curl --fail --show-error --silent --location \ | |
| --retry 5 --retry-all-errors \ | |
| "https://github.com/gitleaks/gitleaks/releases/download/v${GITLEAKS_VERSION}/gitleaks_${GITLEAKS_VERSION}_${OS}_${ARCH}.tar.gz" \ | |
| -o /tmp/gitleaks.tar.gz | |
| tar xzf /tmp/gitleaks.tar.gz -C /tmp | |
| sudo mv /tmp/gitleaks /usr/local/bin/gitleaks | |
| - name: Secret scanning | |
| run: gitleaks detect --config .gitleaks.toml --source . --no-git --exit-code 1 | |
| openapi-lint: | |
| name: OpenAPI Spec Validation (Spectral) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22" | |
| cache: "npm" | |
| - name: Ensure npm uses POSIX shell on Linux | |
| run: | | |
| npm config delete script-shell || true | |
| - name: Install dependencies | |
| run: npm ci --ignore-scripts | |
| - name: Validate OpenAPI spec with Spectral (built-in OAS rules) | |
| run: npx @stoplight/spectral-cli@6.14.3 lint docs/api/openapi.yaml --ruleset .spectral.yaml | |
| - name: Validate project-specific conventions (429, descriptions, summaries) | |
| run: node scripts/validate-openapi.js | |
| zap_scan: | |
| name: DAST Security Scan (OWASP ZAP) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| - name: Run ZAP Baseline Scan | |
| uses: zaproxy/action-baseline@v0.14.0 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| # Default to a placeholder; override per-env in the GitHub UI or | |
| # via a `ZAP_TARGET` repository variable once staging is live. | |
| target: ${{ vars.ZAP_TARGET || 'https://example.com' }} | |
| cmd_options: "-J report.json" | |
| fail_action: false | |
| continue-on-error: true | |
| - name: Run Security Triage Script | |
| run: node scripts/triage-zap.js | |
| - name: Upload ZAP Reports | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: zap-scan-report | |
| path: | | |
| report_html.html | |
| report.json | |
| retention-days: 14 | |
| if-no-files-found: warn |