Skip to content
This repository has been archived by the owner on Sep 17, 2024. It is now read-only.

Commit

Permalink
feat(bindings): try compile
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasBa committed Nov 4, 2022
1 parent c5cf735 commit c08ec1f
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 18 deletions.
59 changes: 42 additions & 17 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,63 @@ on:
push:
branches:
- main
- release/**
- "**"
pull_request:
workflow_dispatch:
inputs:
commit:
description: If the commit you want to test isn't the head of a branch, provide its SHA here
required: false
jobs:
artifacts:
name: Upload Artifacts
runs-on: ubuntu-latest
precompile-bindings:
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-2019, ubuntu-latest]
node-version: [12.x, 14.x, 16.x, 18.x]
target: [x64]
host: [x64]
runs-on: ${{ matrix.os }}
# Build artifacts are only needed for releasing workflow.
if: startsWith(github.ref, 'refs/heads/release/')
# if: startsWith(github.ref, 'refs/heads/release/')
name: ${{ matrix.os }} (node=${{ matrix.node-version }}, host=${{ matrix.host }}, target=${{ matrix.target }})
steps:
- name: Check out current commit
uses: actions/checkout@v3
with:
ref: ${{ env.HEAD_COMMIT }}

- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
architecture: ${{ matrix.host }}

- name: "setup npm"
run: npm install -g npm@latest
- name: Add msbuild to PATH
uses: microsoft/[email protected]
if: ${{ runner.os == 'Windows' }}
with:
msbuild-architecture: ${{ matrix.target }}

- name: set msvs version
run: npm config set msvs_version 2022
if: ${{ runner.os == 'Windows' }}

- name: Install dependencies
run: npm install
- name: Lint,
run: npm run lint
- name: Test
run: npm run test

- name: Configure gyp
run: npm run build:configure --arch=${{ matrix.target }}

- name: "Build bindings"
run: npm run build:bindings --arch=${{ matrix.target }}

- name: build
run: npm run build:lib
- name: pack
run: npm pack
- name: Archive artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ github.sha }}
path: |
${{ github.workspace }}/*.tgz

- name: Test
run: npm run test

- name: Binary size
run: du -h build/Release/cpu_profiler.node
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
"package-lock.json"
],
"scripts": {
"postinstall": "npm run build:bindings",
"clean": "rm -rf ./lib && rm -rf build",
"lint": "eslint ./src --ext .ts",
"build": "npm run build:bindings && npm run build:lib",
"build:lib": "tsc",
"build:configure": "node-gyp configure",
"build:bindings": "node-gyp build",
"build:benchmark:format": "node-gyp -DFORMAT_BENCHMARK=1 build",
"benchmark": "npm run benchmark:methods && npm run benchmark:profiler && npm run benchmark:server && npm run benchmark:format",
Expand Down

0 comments on commit c08ec1f

Please sign in to comment.