Skip to content

FAQ KBIS

FAQ KBIS #2068

Workflow file for this run

# This workflow will do a clean install of node dependencies, build the source code and run tests
name: 'Pre-merge checks'
on:
pull_request:
branches: [main]
# Be extremely careful as the env variables defined here are accessible by all the actions of the workflow.
# For critical env variable, declare it within the action.
env:
node-version: 18.x
INSEE_CLIENT_ID: ${{ secrets.INSEE_CLIENT_ID }}
INSEE_CLIENT_SECRET: ${{ secrets.INSEE_CLIENT_SECRET}}
INSEE_CLIENT_ID_FALLBACK: ${{ secrets.INSEE_CLIENT_ID_FALLBACK }}
INSEE_CLIENT_SECRET_FALLBACK: ${{ secrets.INSEE_CLIENT_SECRET_FALLBACK}}
INDEXING_ENABLED: enabled
REDIS_ENABLED: disabled
MATOMO_ENABLED: disabled
MATOMO_SITE_ID: ${{ secrets.MATOMO_SITE_ID }}
MATOMO_API_SITE_ID: ${{ secrets.MATOMO_API_SITE_ID }}
PROXY_API_KEY: ${{ secrets.PROXY_API_KEY }}
IRON_SESSION_PWD: ${{ secrets.IRON_SESSION_PWD }}
GRIST_API_KEY: ${{ secrets.GRIST_API_KEY }}
UPDOWN_IO_API_KEY: ${{ secrets.UPDOWN_IO_API_KEY }}
jobs:
dependencies:
name: 'Install dependencies'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ env.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.node-version }}
- uses: ./.github/actions/install-dependencies
name: Install and cache dependencies
lint:
name: Lint
runs-on: ubuntu-latest
needs: [dependencies]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ env.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.node-version }}
- name: Load node_modules
uses: ./.github/actions/load-dependencies
- name: Run linter
run: npm run lint
build:
name: Build
runs-on: ubuntu-latest
needs: [dependencies]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ env.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.node-version }}
- name: Load node_modules
uses: ./.github/actions/load-dependencies
- name: Build site
run: npm run build
- name: Cache site
uses: actions/cache@v3
id: restore-build
with:
path: ./*
key: ${{ github.sha }}
tests:
name: Unit tests
runs-on: ubuntu-latest
needs: [dependencies]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ env.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.node-version }}
- name: Load node_modules
uses: ./.github/actions/load-dependencies
- name: Run unit tests
run: |
npm run test:unit
testE2E:
name: End2end tests
runs-on: ubuntu-latest
needs: [dependencies]
env:
NEXT_PUBLIC_END2END_MOCKING: enabled
AGENTCONNECT_CLIENT_ID: ${{ secrets.AGENTCONNECT_CLIENT_ID }}
AGENTCONNECT_CLIENT_SECRET: ${{ secrets.AGENTCONNECT_CLIENT_SECRET }}
AGENTCONNECT_URL_DISCOVER: https://fca.integ01.dev-agentconnect.fr/api/v2/.well-known/openid-configuration
AGENTCONNECT_REDIRECT_URI: http://localhost:3000/api/auth/agent-connect/callback
AGENTCONNECT_POST_LOGOUT_REDIRECT_URI: http://localhost:3000/api/auth/agent-connect/logout-callback
steps:
- name: Checkout 🛎
uses: actions/checkout@v3
- name: Use Node.js ${{ env.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.node-version }}
- name: Load node_modules
uses: ./.github/actions/load-dependencies
- name: Build site with E2E mocking
run: npm run build
env:
NEXT_PUBLIC_END2END_MOCKING: enabled
- name: Run Cypress tests 🧪
# https://github.com/cypress-io/github-action
uses: cypress-io/github-action@v5
timeout-minutes: 10
with:
start: npm start
record: false
env:
PORT: 3000
NEXT_PUBLIC_END2END_MOCKING: enabled
- name: Upload screenshots 📸
uses: actions/upload-artifact@v4
# add the line below to store screenshots only on failures
if: failure()
with:
name: cypress-screenshots
path: cypress/screenshots
if-no-files-found: ignore # 'warn' or 'error' are also available, defaults to `warn`
typecheck:
name: Type check
runs-on: ubuntu-latest
needs: [dependencies]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ env.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.node-version }}
- name: Load node_modules
uses: ./.github/actions/load-dependencies
- name: Run typescript check
run: npx tsc --noEmit