Repository navigation
108 lines (96 loc) · 2.74 KB
/
Copy pathtests.yml
File metadata and controls
108 lines (96 loc) · 2.74 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name: Tests + SonarCloud
on:
push:
branches:
- full-recode
- main
pull_request:
branches:
- full-recode
- main
# Monthly run so the SonarCloud scan uses SONAR_TOKEN, which expires after 60 days without use
schedule:
- cron: '17 4 1 * *'
jobs:
tests:
name: Tests
runs-on: ubuntu-latest
concurrency:
group: acceptance-tests
cancel-in-progress: false
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Install system packages needed for headless gl
run: >-
sudo apt-get update &&
sudo apt-get install -y
build-essential
libgl1-mesa-dri
libglapi-mesa
libglew-dev
libglu1-mesa-dev
libosmesa6
libxi-dev
mesa-utils
pkg-config
- uses: actions/setup-node@v7
with:
node-version: 22
cache: npm
- name: Install project dependencies
run: npm ci
- name: Run the tests
run: xvfb-run npm run test:ci
- name: Upload coverage report
if: '!cancelled()'
uses: actions/upload-artifact@v4
with:
name: coverage
path: coverage/lcov.info
if-no-files-found: ignore
sonarcloud:
name: SonarCloud
needs: tests
if: '!cancelled()'
runs-on: ubuntu-latest
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
steps:
- uses: actions/checkout@v7
if: env.SONAR_TOKEN != ''
with:
fetch-depth: 0
- uses: actions/setup-node@v7
if: env.SONAR_TOKEN != ''
with:
node-version: 22
cache: npm
- name: Install project dependencies for type resolution
if: env.SONAR_TOKEN != ''
run: npm ci --ignore-scripts && npm run prisma:generate
- name: Download coverage report
if: env.SONAR_TOKEN != ''
continue-on-error: true
uses: actions/download-artifact@v4
with:
name: coverage
path: coverage/
- name: Run SonarCloud analysis
if: env.SONAR_TOKEN != ''
uses: SonarSource/sonarqube-scan-action@v8
with:
args: >
-Dsonar.organization=spraxdev
-Dsonar.projectKey=SpraxDev_api.sprax.dev
-Dsonar.sourceEncoding=UTF-8
-Dsonar.typescript.tsconfigPaths=tsconfig.json
-Dsonar.javascript.lcov.reportPaths=./coverage/lcov.info
-Dsonar.sources=src/
-Dsonar.exclusions=src/database/prisma-client/**
-Dsonar.tests=tests/
-Dsonar.test.inclusions=tests/**/*.test.ts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}