Skip to content

LIME-1864 BE skeleton #3

LIME-1864 BE skeleton

LIME-1864 BE skeleton #3

Workflow file for this run

name: PR check
on:
pull_request:
types:
- opened
- reopened
- ready_for_review
- synchronize
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- name: Pre-commit checks
uses: govuk-one-login/github-actions/code-quality/run-pre-commit@3b0015c58dd0e19e1572fda59dda4184df387d1e
with:
all-files: true
static-checks:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Node
uses: ./.github/actions/node-setup
- name: Lint
run: npm run lint
- name: Format
run: npm run format
- name: Type check
run: npm run type-check
unit-tests:
runs-on: ubuntu-latest
permissions:
contents: read
needs: static-checks
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0 # required for sonar
- name: Setup Node
uses: ./.github/actions/node-setup
- name: Unit tests
run: npm run test:coverage
- name: Sonar scan # runs after unit tests in order to consume coverage report
uses: SonarSource/sonarqube-scan-action@v7.0.0
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
merge-status:
runs-on: ubuntu-latest
needs: [pre-commit, static-checks, unit-tests]
if: always()
steps:
- run: |
failed=()
[[ "${{ needs.pre-commit.result }}" != "success" ]] && failed+=("pre-commit")
[[ "${{ needs.static-checks.result }}" != "success" ]] && failed+=("static-checks")
[[ "${{ needs.unit-tests.result }}" != "success" ]] && failed+=("unit-tests")
if [[ ${#failed[@]} -gt 0 ]]; then
echo "The following jobs failed: ${failed[*]}"
exit 1
fi