Skip to content

Commit

Permalink
More testing, bug fixes, better CI
Browse files Browse the repository at this point in the history
  • Loading branch information
WilliamVenner authored Jun 6, 2024
1 parent a388c2d commit 81330f4
Show file tree
Hide file tree
Showing 13 changed files with 295 additions and 384 deletions.
86 changes: 57 additions & 29 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ name: CI and Publish
on:
push:
branches:
- '**'
- "**"
tags:
- 'v*.*.*'
- "v*.*.*"

jobs:
build:
Expand All @@ -16,40 +16,68 @@ jobs:
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
submodules: true
- name: Checkout repository
uses: actions/checkout@v2
with:
submodules: true

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: 22
registry-url: 'https://registry.npmjs.org/'
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: 22
registry-url: "https://registry.npmjs.org/"

- name: Install dependencies
run: npm install
- name: Install dependencies
run: npm install

- name: Run tests
run: npm test
- name: Run tests
run: npm test

integrationtest:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
submodules: true

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: 22
registry-url: "https://registry.npmjs.org/"

- name: Try to npm install
run: |
mkdir npm-install-test
cd npm-install-test
npm init -y
npm install ../ --save --install-links --foreground-scripts
- name: Run integration test
run: |
cd npm-install-test
cp node_modules/node-bzip2/test/integration.js integration.js
node integration.js
publish:
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest

needs: build
needs: [build, integrationtest]

steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
submodules: true

- uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
- run: npm ci
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Checkout repository
uses: actions/checkout@v2
with:
submodules: true

- uses: actions/setup-node@v4
with:
node-version: "20.x"
registry-url: "https://registry.npmjs.org"
- run: npm ci
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
19 changes: 15 additions & 4 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{
"action_name": "configure_bzip2",
"inputs": [],
"outputs": ["<(INTERMEDIATE_DIR)/bzip2"],
"outputs": ["<(INTERMEDIATE_DIR)/bzip2/bz_version.h"],
"action": [
"cmake",
"-S",
Expand All @@ -23,14 +23,25 @@
},
{
"action_name": "build_bzip2",
"inputs": ["<(INTERMEDIATE_DIR)/bzip2"],
"outputs": ["<(INTERMEDIATE_DIR)/bzip2/bz_version.h"],
"inputs": ["<(INTERMEDIATE_DIR)/bzip2/bz_version.h"],
"outputs": [],
"action": [
"cmake",
"--build",
"<(INTERMEDIATE_DIR)/bzip2",
"--config=Release",
],
"conditions": [
[
'OS=="win"',
{
"outputs": [
"<(INTERMEDIATE_DIR)/bzip2/Release/bz2_static.lib"
]
},
{"outputs": ["<(INTERMEDIATE_DIR)/bzip2/libbz2_static.a"]},
]
],
},
],
"sources": ["src/node_bzip2_wrapper.cpp"],
Expand All @@ -44,11 +55,11 @@
"AdditionalOptions": ["/MD"],
}
},
"xcode_settings": {"GCC_ENABLE_CPP_EXCEPTIONS": "YES"},
"conditions": [
[
'OS=="mac"',
{
"xcode_settings": {"GCC_ENABLE_CPP_EXCEPTIONS": "YES"},
"cflags": ["-mmacosx-version-min=11.0"],
},
],
Expand Down
Loading

0 comments on commit 81330f4

Please sign in to comment.