Skip to content

clearTimeout

clearTimeout #5698

Workflow file for this run

name: CI
on: [push, pull_request]
env:
TZ: 'Europe/London'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install nodejs
uses: actions/setup-node@v1
with:
node-version: "18.x"
- name: Install node dependencies
run: npm ci
- name: Run linting
run: npm run lint
# This includes an extra run step. The sonarcloud analysis will be run in a docker container with the current
# folder mounted as `/github/workspace`. The problem is when the lcov.info file is generated it will reference the
# code in the current folder. So to enable sonarcloud to matchup code coverage with the files we use sed to update
# the references in lcov.info
# https://community.sonarsource.com/t/code-coverage-doesnt-work-with-github-action/16747/6
- name: Run unit tests
env:
FLOOD_APP_BING_KEY: "${{ secrets.FLOOD_APP_BING_KEY }}"
FLOOD_APP_BING_KEY_LOCATION: "${{ secrets.FLOOD_APP_BING_KEY_LOCATION }}"
FLOOD_APP_BING_KEY_MAP: "${{ secrets.FLOOD_APP_BING_KEY_MAP }}"
FLOOD_APP_BING_URL: "${{ secrets.FLOOD_APP_BING_URL }}"
FLOOD_APP_NRW_STATION_URL: "${{ secrets.FLOOD_APP_NRW_STATION_URL }}"
FLOOD_APP_SESSION_PASSWORD: "${{ secrets.FLOOD_APP_SESSION_PASSWORD }}"
run: |
npm run unit-test
sed -i 's/\/home\/runner\/work\/flood-app\/flood-app\//\/github\/workspace\//g' coverage/lcov.info
- name: Analyse code quality
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: >
-Dsonar.organization=defra
-Dsonar.projectKey=DEFRA_flood-app
-Dsonar.exclusions=**/node_modules/**,**/test/**,**/test-output/**
-Dsonar.javascript.lcov.reportPaths=coverage/lcov.info
-Dsonar.javascript.exclusions=**/node_modules/**,**/test/**,**/test-output/**,**/mock/**,**/server/dist/**,**/server/src/**,**/service-down/**
-Dsonar.coverage.exclusions=**/server/routes/status.js