Skip to content

Add integration testing step in CI #25

Add integration testing step in CI

Add integration testing step in CI #25

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 }}
runs-on: ubuntu-latest
env:
BUILD_ARTIFACT_FILENAME: ${{ needs.build.outputs.tarball }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
# node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: cd integration_tests
- name: Download the build artifact
uses: actions/download-artifact@v4
with:
name: ${{ env.BUILD_ARTIFACT_NAME }}
- name: Integration test - module format
run: |
cd integration_tests && \
cd esm && \
npm install "../../$BUILD_ARTIFACT_FILENAME" --only=prod && \
npm run test
- name: Integration test - commonjs format
run: |
cd integration_tests && \
cd cjs && \
npm install "../../$BUILD_ARTIFACT_FILENAME" --only=prod && \
npm run test