Another attempt to fir GHA coverage #92
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: NodeJS Tests | |
on: | |
push: | |
branches: [ "*" ] | |
pull_request: | |
branches: [ "*" ] | |
workflow_dispatch: {} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [ 18.x, 20.x ] | |
steps: | |
# Checkout the repository | |
- uses: actions/checkout@v3 | |
# Setup Node.js environment (use matrix for different versions) | |
- name: Setup Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'npm' | |
# Install dependencies | |
- name: Install dependencies | |
run: npm ci --legacy-peer-deps | |
# Build the project (if a build script exists) | |
- name: Build the project | |
run: npm run build --if-present | |
# Run tests | |
- name: Run tests | |
run: npm run cover | |
# Upload coverage to Coveralls | |
- name: Coveralls | |
# uses: coverallsapp/github-action@v2 | |
uses: coverallsapp/github-action@master | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
path-to-lcov: ./coverage/lcov-report/lcov.info |