-
Notifications
You must be signed in to change notification settings - Fork 1
60 lines (48 loc) · 1.93 KB
/
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: Tests
on:
push:
branches: [master]
pull_request:
types: [opened, synchronize, reopened]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x, 22.x]
env:
IS_PRIMARY_VERSION: ${{ matrix.node-version == '18.x' }}
PUBLISH: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: npm ci
- name: Run all tests if primary node version
if: ${{ env.IS_PRIMARY_VERSION }}
run: npm run test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: SonarScanner if primary node version
if: ${{ env.IS_PRIMARY_VERSION }}
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Run cspell if primary node version
if: ${{ env.IS_PRIMARY_VERSION }}
run: npm run cspell
- name: Run format:check if primary node version
if: ${{ env.IS_PRIMARY_VERSION }}
run: npm run format:check
- name: Only run unit tests if not primary node version
if: ${{ !env.IS_PRIMARY_VERSION }}
run: npm run test:unit
env: # Override the index file name to prevent concurrency issues
NVA_INDEX_FILE_NAME: 'index${{ matrix.node-version }}.json'