CI #1408
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: CI | |
on: | |
push: | |
pull_request: | |
schedule: | |
- cron: '0 4 * * *' | |
jobs: | |
lint: | |
# The linting packages require modern Node.js versions in order to run. | |
# Therefore, we run linting separately and only once. | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 'lts/*' | |
- run: npm install | |
- run: npm run lint | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: | |
- 12.x | |
- 14.x | |
- 16.10.0 | |
- 16.16.0 | |
- 16.17.0 | |
- 16.x | |
- 17.x | |
- 18.5.0 | |
- 18.18.0 | |
- 18.19.0 | |
- 18.x | |
- 20.9.0 | |
- 20.x | |
- 21.x | |
- 22.x | |
os: | |
- ubuntu-latest | |
- macos-latest | |
- windows-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v2 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- run: npm install | |
- run: npm test | |
- name: Rename coverage file | |
run: > | |
mv coverage/lcov.info coverage/${{ matrix.node-version }}_${{ matrix.os }}_lcov.info | |
- name: Archive code coverage results | |
if: success() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage_${{ matrix.os }}_${{ matrix.node-version}} | |
if-no-files-found: ignore | |
path: coverage/${{ matrix.node-version }}_${{ matrix.os }}_lcov.info | |
# This will clobber any coverage generated by the previous `npm test`. | |
# We are opting to omit TS coverage and stick to pass or fail only for TS. | |
- run: npm run test:ts | |
if: (matrix.node-version != '12.x' && matrix.node-version != '14.x' && matrix.node-version != '16.10.0') | |
coverage: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
# We need to check out the source in order for genhtml to work | |
- uses: actions/checkout@v4 | |
- name: Download reports' artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: downloaded_artifacts | |
- name: Install lcov | |
run: | | |
sudo apt update | |
sudo apt install -y lcov | |
- name: Combine all coverage data | |
run: | | |
find . -type f -name '*.info' -exec echo -a {} \; | xargs --verbose lcov -o all_lcov.info | |
- name: Generate Coverage Report | |
run: > | |
lcov --summary all_lcov.info | |
- name: Generate HTML report | |
run: | | |
mkdir html_report | |
genhtml -o html_report all_lcov.info | |
- name: Upload HTML report | |
uses: actions/upload-artifact@v4 | |
with: | |
name: 00_html_coverage_report | |
if-no-files-found: ignore | |
path: html_report/ | |
- name: Verify Minimum Coverage Is Met | |
run: > | |
lcov --summary all_lcov.info | grep lines | cut -d' ' -f 4 | cut -d% -f 1 | xargs node -e "x=process.argv[1];console.log(x);assert(+x >= 90)" | |
integration: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
# We only test that exports match on a single node version because many of | |
# the libraries we test do not support older node versions | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 'lts/*' | |
- run: npm install | |
- run: npm run test:e2e |