Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Refactor to bundling prebuilds with prebuildify #237

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
228 changes: 121 additions & 107 deletions .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ on:
- '**'
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
lint:
Expand All @@ -19,9 +22,9 @@ jobs:
node-version: [lts/*]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install Dependencies
Expand All @@ -31,112 +34,123 @@ jobs:
- name: Inspect Lockfile
run: npm run lint:lockfile

linux:
runs-on: ubuntu-latest

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

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

windows-2019:
runs-on: windows-2019
# test_x86_x64:
# strategy:
# matrix:
# 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:
# - 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 }}
#
#
# test_macos_arm:
# strategy:
# matrix:
# os: [ macos-14 ]
# node: [ 16, 18, 20 ]
# arch: [ arm64 ]
# runs-on: ${{ matrix.os }}
# name: ${{ matrix.os }} / Node ${{ matrix.node }} ${{ matrix.arch }}
# steps:
# - 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 }}

test_linux_arm:
# Skip this group if the PR doesn't originate from the main repo.
# Trying to run this on standard runners is just going to fail due to
# lack of CPU resources.
if: ${{ vars.NR_RUNNER != '' }}
strategy:
max-parallel: 1
matrix:
node-version: [16.x, 18.x, 20.x]

node: [ 16, 18, 20 ]
runs-on: ${{ vars.NR_RUNNER }}
name: Linux / Node ${{ matrix.node }} arm64
timeout-minutes: 15
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

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.
strategy:
matrix:
node-version: [16.x, 18.x, 20.x]

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
- run: cat /proc/cpuinfo
- 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:node-${{ matrix.node }}
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:node-${{ matrix.node }}
options: --platform linux/arm64
run: |
npm install --verbose
npm run unit
npm run integration
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ coverage
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/
lib/binary
prebuilds/

# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
Expand Down
Loading