Skip to content

Unit Tests, Quality Gate #1

Unit Tests, Quality Gate

Unit Tests, Quality Gate #1

Workflow file for this run

name: Quality Gate
on:
push:
branches:
- main
tags:
- 'v*'
pull_request:
types: [opened, synchronize, reopened]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
sonarcloud:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'yarn'
cache-dependency-path: 'yarn.lock'
- name: Cache node modules
uses: actions/cache@v4
id: cache-npm
with:
path: |
node_modules
~/.npm
key: ${{ runner.os }}-modules-${{ hashFiles('client/yarn.lock') }}
restore-keys: |
${{ runner.os }}-modules-
${{ runner.os }}-
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
name: Install dependencies
working-directory: client
run: yarn install
- name: UI Unit Tests
run: yarn test
working-directory: client
- name: Extract version from tag
id: version
run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: >
-Dsonar.projectVersion=${{ env.VERSION }}