Skip to content

Add integration testing step in CI #28

Add integration testing step in CI

Add integration testing step in CI #28

Workflow file for this run

name: Node.js CI
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
BUILD_ARTIFACT_NAME: build_artifact
jobs:
build:
runs-on: ubuntu-latest
outputs:
tarball: ${{ steps.tarball.outputs.filename }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
- run: npm ci
- run: npm run test:ci
- name: Make build tarball
id: tarball
run: echo "filename=$(npm pack | tail -1)" >> $GITHUB_OUTPUT
- name: Archive build dist
uses: actions/upload-artifact@v4
with:
name: ${{ env.BUILD_ARTIFACT_NAME }}
path: ${{ steps.tarball.outputs.filename }}
packageTest:
needs: build
strategy:
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-latest
node-version:
- 16
- 18
- 20
- 22
- 23
runs-on: ${{ matrix.os }}
env:
BUILD_ARTIFACT_FILENAME: ${{ needs.build.outputs.tarball }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Download the build artifact
uses: actions/download-artifact@v4
with:
name: ${{ env.BUILD_ARTIFACT_NAME }}
- name: Integration test - module format
working-directory: ./integration_tests/esm
run: |
npm install "../../$BUILD_ARTIFACT_FILENAME" --only=prod
npm run test
- name: Integration test - commonjs format
working-directory: ./integration_tests/cjs
run: |
npm install "../../$BUILD_ARTIFACT_FILENAME" --only=prod
npm run test