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

Publish package with GitHub Actions #138

Closed
wants to merge 2 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
118 changes: 118 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
name: build

on:
push:
branches:
- master
pull_request:
branches:
- master
release:
types:
- released

env:
NODE_BUILD_CMD: npx prebuild -r node -t 14.0.0 -t 16.0.0 -t 18.0.0 -t 20.0.0
ELECTRON_BUILD_CMD: npx prebuild -r electron -t 16.0.0 -t 17.0.0 -t 18.0.0 -t 19.0.0 -t 20.0.0 -t 21.0.0 -t 22.0.0 -t 23.0.0 -t 24.0.0

jobs:

test:
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
node:
- 14
- 16
- 18
- 20
fail-fast: false
name: Testing Node ${{ matrix.node }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- run: npm install
- run: npm test

test_windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 16
- run: npm install
- run: npm run-script test-windows

publish:
if: ${{ github.event_name == 'release' }}
name: Publishing to NPM
runs-on: ubuntu-latest
needs: [ test, test_windows ]
steps:
- uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: https://registry.npmjs.org
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

prebuild:
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
fail-fast: false
name: Prebuild on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs: publish
steps:
- uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 18
- run: npm install --ignore-scripts
- run: ${{ env.NODE_BUILD_CMD }} -u ${{ secrets.GH_TOKEN }}
- run: ${{ env.ELECTRON_BUILD_CMD }} -u ${{ secrets.GH_TOKEN }}
- if: matrix.os == 'windows-latest'
run: |
${{ env.NODE_BUILD_CMD }} --arch ia32 -u ${{ secrets.GH_TOKEN }}
${{ env.ELECTRON_BUILD_CMD }} --arch ia32 -u ${{ secrets.GH_TOKEN }}
- if: matrix.os == 'macos-latest'
run: |
${{ env.NODE_BUILD_CMD }} --arch arm64 -u ${{ secrets.GH_TOKEN }}
${{ env.ELECTRON_BUILD_CMD }} --arch arm64 -u ${{ secrets.GH_TOKEN }}

cargo:
runs-on: ubuntu-latest
needs: publish
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- run: cargo publish --token ${CRATESIO_TOKEN}
env:
CRATES_TOKEN: ${{ secrets.CRATESIO_TOKEN }}
37 changes: 0 additions & 37 deletions .github/workflows/ci.yml

This file was deleted.

20 changes: 18 additions & 2 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,23 @@
],
"cflags_c": [
"-std=c99",
]
],
"cflags_cc": ["-std=c++17"],
"xcode_settings": {
"OTHER_CPLUSPLUSFLAGS": ["-std=c++17", "-stdlib=libc++"],
},
"msvs_settings": {
"VCCLCompilerTool": {
"AdditionalOptions": [
"/std:c++17",
],
"RuntimeLibrary": 0,
},
},

}
]
],
'variables': {
'openssl_fips': '',
},
}