Skip to content

Merge pull request #457 from Hack23/dependabot/npm_and_yarn/developme… #1857

Merge pull request #457 from Hack23/dependabot/npm_and_yarn/developme…

Merge pull request #457 from Hack23/dependabot/npm_and_yarn/developme… #1857

name: Integration and E2E Tests
on:
pull_request:
branches: [main]
push:
branches: [main]
schedule:
# Run daily at 2 AM UTC
- cron: '0 2 * * *'
workflow_dispatch:
# Set default permissions to read-only
permissions: read-all
# Resilience against transient npm registry / mirror failures.
env:
NPM_CONFIG_FETCH_RETRIES: "5"
NPM_CONFIG_FETCH_RETRY_MINTIMEOUT: "20000"
NPM_CONFIG_FETCH_RETRY_MAXTIMEOUT: "120000"
NPM_CONFIG_FETCH_TIMEOUT: "300000"
jobs:
integration-tests:
name: Integration Tests
runs-on: ubuntu-latest
timeout-minutes: 45
continue-on-error: ${{ matrix.experimental == true }}
# Only needs read permissions
permissions:
contents: read # Required to check out code
strategy:
fail-fast: false
matrix:
# Stable Node.js version used for required CI jobs
node-version: [26.x]
experimental: [false]
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@ab7a9404c0f3da075243ca237b5fac12c98deaa5 # v2.19.3
with:
egress-policy: audit
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Type check
run: npm run type-check
- name: Lint
run: npm run lint
- name: Build
run: npm run build
- name: Run unit tests
run: npm run test:unit
- name: Run integration tests
run: npm run test:integration
env:
EP_API_URL: ${{ secrets.EP_API_URL || 'https://data.europarl.europa.eu/api/v2' }}
EP_INTEGRATION_TESTS: 'true'
NODE_ENV: test
- name: Run E2E tests
run: npm run test:e2e
env:
EP_REQUEST_TIMEOUT_MS: 60000
NODE_ENV: test
- name: Run performance tests
run: npm run test:performance
env:
NODE_ENV: test
- name: Upload coverage to Codecov
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v5.2.0
with:
files: ./coverage/lcov.info
flags: integration,e2e
name: integration-e2e-coverage
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
continue-on-error: true
- name: Archive test results
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: test-results-${{ matrix.node-version }}
path: |
coverage/
junit.xml
retention-days: 30
security-scan:
name: Security Scan
runs-on: ubuntu-latest
needs: integration-tests
# Only needs read permissions
permissions:
contents: read
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@ab7a9404c0f3da075243ca237b5fac12c98deaa5 # v2.19.3
with:
egress-policy: audit
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 26.x
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run security audit
run: npm audit --audit-level=moderate
continue-on-error: true
- name: Check licenses
run: npm run test:licenses
test-summary:
name: Test Summary
runs-on: ubuntu-latest
needs: [integration-tests, security-scan]
if: always()
steps:
- name: Check test results
run: |
echo "Integration tests completed"
echo "E2E tests completed"
echo "Performance tests completed"
echo "Security scan completed"