# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions name: Node.js CI on: push: branches: [ main ] pull_request: branches: [ main ] jobs: build: name: Build and test runs-on: ubuntu-latest strategy: matrix: node-version: [20.x, 22.x, 24.x] steps: - uses: actions/checkout@v4 - name: Test on Node.js ${{ matrix.node-version }} uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - run: npm ci - run: npm run build --if-present - run: npm test coverage: name: Code coverage runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: submodules: true - name: Generate coverage report uses: actions/setup-node@v4 with: node-version: 22.x - run: npm ci - run: npm run build --if-present - run: npm run coverage - name: Upload coverage report to storage uses: actions/upload-artifact@v4 with: name: coverage path: coverage/lcov.info publish: name: Publish code coverage report needs: coverage runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Download coverage report from storage uses: actions/download-artifact@v4 with: name: coverage - name: Upload coverage report to codacy uses: actions/setup-node@v4 with: node-version: 22.x - run: | ( [[ "${CODACY_PROJECT_TOKEN}" != "" ]] && npm run coverage-publish ) || echo "Coverage report not published" env: CODACY_PROJECT_TOKEN: ${{secrets.CODACY_PROJECT_TOKEN}}