Skip to content

Commit

Permalink
update ci workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
jsumners-nr committed Feb 22, 2024
1 parent 2c1de19 commit 834a363
Show file tree
Hide file tree
Showing 2 changed files with 113 additions and 98 deletions.
199 changes: 101 additions & 98 deletions .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ on:
- '**'
workflow_dispatch:


jobs:
lint:
runs-on: ubuntu-latest
Expand All @@ -31,112 +30,116 @@ jobs:
- name: Inspect Lockfile
run: npm run lint:lockfile

linux:
runs-on: ubuntu-latest

test_x86_x64:
strategy:
matrix:
node-version: [16.x, 18.x, 20.x]

os: [ ubuntu-latest, windows-latest, windows-2019 ]
node: [ 16, 18, 20 ]
arch: [ x86, x64 ]
exclude:
# Ubuntu does not ship x86 builds.
- { os: ubuntu-latest, arch: x86 }
runs-on: ${{ matrix.os }}
name: ${{ matrix.os }} / Node ${{ matrix.node }} ${{ matrix.arch }}
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install Dependencies
run: npm ci
- name: Rebuild
run: npm run rebuild
- name: Run Unit
run: npm run unit
- name: Post Unit Test Coverage
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: ./coverage/unit/
files: lcov.info
flags: unit-tests-${{ matrix.node-version }}-linux
- name: Run Integration
run: npm run integration
- name: Post Integration Test Coverage
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: ./coverage/integration/
files: lcov.info
flags: integration-tests-${{ matrix.node-version }}-linux
- name: Checkout
uses: actions/checkout@v4
- name: Use node ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
architecture: ${{ matrix.arch }}
- name: Install
run: npm install
- name: Unit Test
run: npm run unit
- name: Post Unit Test Coverage
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: ./coverage/unit/
files: lcov.info
flags: unit-tests-${{ matrix.node }}-${{ matrix.os }}-${{ matrix.arch }}
- name: Integration Test
run: npm run integration
- name: Post Integration Test Coverage
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: ./coverage/integration/
files: lcov.info
flags: integration-tests-${{ matrix.node }}-${{ matrix.os }}-${{ matrix.arch }}

windows-2019:
runs-on: windows-2019

test_macos_arm:
strategy:
matrix:
node-version: [16.x, 18.x, 20.x]

os: [ macos-14 ]
node: [ 16, 18, 20 ]
arch: [ arm64 ]
runs-on: ${{ matrix.os }}
name: ${{ matrix.os }} / Node ${{ matrix.node }} ${{ matrix.arch }}
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install Dependencies
run: npm ci
- name: Rebuild
run: npm run rebuild
- name: Run Unit
run: npm run unit
- name: Post Unit Test Coverage
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: ./coverage/unit/
files: lcov.info
flags: unit-tests-${{ matrix.node-version }}-windows-2019
- name: Run Integration
run: npm run integration
- name: Post Integration Test Coverage
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: ./coverage/integration/
files: lcov.info
flags: integration-tests-${{ matrix.node-version }}-windows-2019
- name: Checkout
uses: actions/checkout@v4
- name: Use node ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
architecture: ${{ matrix.arch }}
- name: Install
run: npm install
- name: Unit Test
run: npm run unit
- name: Post Unit Test Coverage
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: ./coverage/unit/
files: lcov.info
flags: unit-tests-${{ matrix.node }}-${{ matrix.os }}-${{ matrix-arch }}
- name: Integration Test
run: npm run integration
- name: Post Integration Test Coverage
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: ./coverage/integration/
files: lcov.info
flags: integration-tests-${{ matrix.node }}-${{ matrix.os }}-${{ matrix.arch }}

windows-latest:
runs-on: windows-latest

# Node 16+ should eventually bundle node-gyp>=8.4.0 to be compatible with Server 2022.
# Once compatible, can remove node-gyp upgrade.
test_linux_arm:
strategy:
matrix:
node-version: [16.x, 18.x, 20.x]

node: [ 16, 18, 20 ]
runs-on: ubuntu-latest
name: Linux / Node ${{ matrix.node }} arm64
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install Dependencies
run: npm ci
- name: Rebuild
run: npm run rebuild
- name: Run Unit
run: npm run unit
- name: Post Unit Test Coverage
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: ./coverage/unit/
files: lcov.info
flags: unit-tests-${{ matrix.node-version }}-windows-latest
- name: Run Integration
run: npm run integration
- name: Post Integration Test Coverage
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: ./coverage/integration/
files: lcov.info
flags: integration-tests-${{ matrix.node-version }}-windows-latest
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- uses: docker/setup-buildx-action@v3
- uses: docker/build-push-action@v5
with:
context: .
build-args: |
NODE_VERSION=${{ matrix.node }}
file: linux_arm.dockerfile
tags: linux_arm:latest
load: true
push: false
platforms: linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Run test
uses: addnab/docker-run-action@v3
with:
image: linux_arm:latest
options: --platform linux/arm64
run: |
npm install
npm run unit
npm run integration
12 changes: 12 additions & 0 deletions linux_arm.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
ARG NODE_VERSION
FROM node:${NODE_VERSION}-slim

RUN apt update && apt install -y python3 build-essential

WORKDIR /app
RUN mkdir /app/src
COPY ./src/ /app/src/
COPY ./tests/ /app/tests/
COPY binding.gyp index.js package.json package-lock.json build.js /app/

CMD npm install && npm test

0 comments on commit 834a363

Please sign in to comment.