Skip to content

Add integration testing step in CI #30

Add integration testing step in CI

Add integration testing step in CI #30

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: |
# echo $PWD
# npm install "../../$BUILD_ARTIFACT_FILENAME" --omit=dev
# npm run test
# - name: Integration test - commonjs format
# working-directory: ./integration_tests/cjs
# run: |
# npm install "../../$BUILD_ARTIFACT_FILENAME" --omit=dev
# npm run test
packageTest-win:
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 }}
- run: (Get-Location).Path
- run: $Env:BUILD_ARTIFACT_FILENAME
- run: dir $Env:BUILD_ARTIFACT_FILENAME
- name: Integration test - module format
working-directory: ./integration_tests/esm
run: |
(Get-Location).Path
npm install "../../$Env:BUILD_ARTIFACT_FILENAME" --omit=dev
npm run test