-
Notifications
You must be signed in to change notification settings - Fork 0
39 lines (34 loc) · 1.25 KB
/
unit-tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
name: CI
on:
workflow_dispatch:
pull_request:
branches: ["main"]
jobs:
unit-tests-and-coverage:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: "20.11.x"
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Test and coverage
run: yarn test:coverage
- name: Sonar Args
id: sonar-args
run: |
if [[ ${{ github.ref }} == 'refs/heads/main' ]]; then
echo "SONAR_ARGS=-Dsonar.branch.name=main" >> $GITHUB_OUTPUT
else
echo "SONAR_ARGS=-Dsonar.branch.target=main -Dsonar.branch.name=${{ github.head_ref }}" >> $GITHUB_OUTPUT
fi
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: ${{ steps.sonar-args.outputs.SONAR_ARGS }}