Skip to content

Merge pull request #941 from govuk-one-login/FPAD-8033-txma-handler-t… #2043

Merge pull request #941 from govuk-one-login/FPAD-8033-txma-handler-t…

Merge pull request #941 from govuk-one-login/FPAD-8033-txma-handler-t… #2043

---
name: 'Build & Test'
permissions:
contents: read
packages: read
# Triggered when:
# - a file, listed below, is pushed to any branch other than `main`, i.e. a feature branch.
# - invoked by another workflow.
on:
push:
paths:
- src/**
- package.json
- package-lock.json
- tsconfig.json
- eslint.config.mjs
- .node-version
- .github/workflows/acceptance-checks.yaml
branches:
- main
pull_request:
paths:
- src/**
- package.json
- package-lock.json
- tsconfig.json
- .node-version
- .github/workflows/acceptance-checks.yaml
branches:
- main
types:
- opened
- reopened
- ready_for_review
- synchronize
workflow_call:
inputs:
gitRef:
required: false
type: string
default: ${{ github.ref }}
jobs:
acceptance-checks:
name: 'Build, Test, Lint & Scan'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # pin@v6.0.2
with:
ref: ${{ inputs.gitRef || github.ref }}
- name: Setup NodeJS
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # pin@v6.3.0
with:
node-version-file: '.node-version'
registry-url: 'https://npm.pkg.github.com/'
scope: '@govuk-one-login'
cache: npm
always-auth: true
- name: Run npm install
run: npm ci
env:
NODE_AUTH_TOKEN: ${{ github.token }}
- name: Run npm build
run: npm run build
- name: Run npm lint
run: npm run lint
- name: Check typescript types
run: npm run test:types
- name: Run unit tests with coverage report
run: npm run test:unit
- name: SonarCloud Scan
uses: SonarSource/sonarqube-scan-action@59db25f34e16620e48ab4bb9e4a5dce155cb5432 # pin@v8.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}