Automatic github actions updates. #1947
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |