Skip to content

Commit 8746279

Browse files
committed
use napi-rs
make a yarn workspace update cargo lock
1 parent 25c3951 commit 8746279

27 files changed

+2590
-207
lines changed
+220
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,220 @@
1+
name: node-js builds
2+
env:
3+
DEBUG: napi:*
4+
APP_NAME: cpp-linter
5+
MACOSX_DEPLOYMENT_TARGET: '10.13'
6+
permissions:
7+
contents: write
8+
id-token: write
9+
on:
10+
push:
11+
branches:
12+
- main
13+
tags:
14+
- '*'
15+
paths-ignore:
16+
- '**/*.md'
17+
- LICENSE
18+
- '**/*.gitignore'
19+
- .editorconfig
20+
- docs/**
21+
pull_request:
22+
branches:
23+
- main
24+
jobs:
25+
build:
26+
strategy:
27+
fail-fast: false
28+
matrix:
29+
settings:
30+
- host: macos-latest
31+
target: x86_64-apple-darwin
32+
build: yarn build --target x86_64-apple-darwin --features openssl-vendored
33+
- host: windows-latest
34+
build: yarn build --target x86_64-pc-windows-msvc
35+
target: x86_64-pc-windows-msvc
36+
- host: ubuntu-latest
37+
target: x86_64-unknown-linux-gnu
38+
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian
39+
build: yarn build --target x86_64-unknown-linux-gnu --features openssl-vendored
40+
name: stable - ${{ matrix.settings.target }} - node@20
41+
runs-on: ${{ matrix.settings.host }}
42+
steps:
43+
- uses: actions/checkout@v4
44+
- name: Setup node
45+
uses: actions/setup-node@v4
46+
if: ${{ !matrix.settings.docker }}
47+
with:
48+
node-version: 20
49+
cache: yarn
50+
- name: Install
51+
uses: dtolnay/rust-toolchain@stable
52+
if: ${{ !matrix.settings.docker }}
53+
with:
54+
toolchain: stable
55+
targets: ${{ matrix.settings.target }}
56+
- name: Cache cargo
57+
uses: actions/cache@v4
58+
with:
59+
path: |
60+
~/.cargo/registry/index/
61+
~/.cargo/registry/cache/
62+
~/.cargo/git/db/
63+
.cargo-cache
64+
target/
65+
key: ${{ matrix.settings.target }}-cargo-${{ matrix.settings.host }}
66+
- uses: goto-bus-stop/setup-zig@v2
67+
if: ${{ matrix.settings.target == 'armv7-unknown-linux-gnueabihf' || matrix.settings.target == 'armv7-unknown-linux-musleabihf' }}
68+
with:
69+
version: 0.13.0
70+
- name: Setup toolchain
71+
run: ${{ matrix.settings.setup }}
72+
if: ${{ matrix.settings.setup }}
73+
shell: bash
74+
- name: Setup node x86
75+
working-directory: node-binding
76+
if: matrix.settings.target == 'i686-pc-windows-msvc'
77+
run: yarn config set supportedArchitectures.cpu "ia32"
78+
shell: bash
79+
- name: Install dependencies
80+
working-directory: node-binding
81+
run: yarn install
82+
- name: Setup node x86
83+
uses: actions/setup-node@v4
84+
if: matrix.settings.target == 'i686-pc-windows-msvc'
85+
with:
86+
node-version: 20
87+
cache: yarn
88+
architecture: x86
89+
- name: Build in docker
90+
uses: addnab/docker-run-action@v3
91+
if: ${{ matrix.settings.docker }}
92+
with:
93+
image: ${{ matrix.settings.docker }}
94+
options: >-
95+
--user 0:0
96+
-v ${{ github.workspace }}/.cargo-cache/git/db:/usr/local/cargo/git/db
97+
-v ${{ github.workspace }}/.cargo/registry/cache:/usr/local/cargo/registry/cache
98+
-v ${{ github.workspace }}/.cargo/registry/index:/usr/local/cargo/registry/index
99+
-v ${{ github.workspace }}:/build
100+
-w /build
101+
run: ${{ matrix.settings.build }}
102+
- name: Build
103+
run: ${{ matrix.settings.build }}
104+
if: ${{ !matrix.settings.docker }}
105+
working-directory: node-binding
106+
shell: bash
107+
- name: Upload artifact
108+
uses: actions/upload-artifact@v4
109+
with:
110+
name: bindings-${{ matrix.settings.target }}
111+
path: node-binding/${{ env.APP_NAME }}.*.node
112+
if-no-files-found: error
113+
test-macOS-windows-binding:
114+
name: Test bindings on ${{ matrix.settings.target }} - node@${{ matrix.node }}
115+
needs:
116+
- build
117+
strategy:
118+
fail-fast: false
119+
matrix:
120+
settings:
121+
- host: macos-latest
122+
target: x86_64-apple-darwin
123+
- host: windows-latest
124+
target: x86_64-pc-windows-msvc
125+
node:
126+
- '18'
127+
- '20'
128+
runs-on: ${{ matrix.settings.host }}
129+
steps:
130+
- uses: actions/checkout@v4
131+
- name: Setup node
132+
uses: actions/setup-node@v4
133+
with:
134+
node-version: ${{ matrix.node }}
135+
cache: yarn
136+
architecture: x64
137+
- name: Install dependencies
138+
run: yarn install
139+
- name: Download artifacts
140+
uses: actions/download-artifact@v4
141+
with:
142+
name: bindings-${{ matrix.settings.target }}
143+
path: node-binding
144+
- name: List packages
145+
run: ls -R .
146+
working-directory: node-binding
147+
shell: bash
148+
- name: Test bindings
149+
run: yarn test
150+
test-linux-x64-gnu-binding:
151+
name: Test bindings on Linux-x64-gnu - node@${{ matrix.node }}
152+
needs:
153+
- build
154+
strategy:
155+
fail-fast: false
156+
matrix:
157+
node:
158+
- '18'
159+
- '20'
160+
runs-on: ubuntu-latest
161+
steps:
162+
- uses: actions/checkout@v4
163+
- name: Setup node
164+
uses: actions/setup-node@v4
165+
with:
166+
node-version: ${{ matrix.node }}
167+
cache: yarn
168+
- name: Install dependencies
169+
run: yarn install
170+
- name: Download artifacts
171+
uses: actions/download-artifact@v4
172+
with:
173+
name: bindings-x86_64-unknown-linux-gnu
174+
path: node-binding
175+
- name: List packages
176+
run: ls -R .
177+
working-directory: node-binding
178+
shell: bash
179+
- name: Test bindings
180+
run: >-
181+
docker run --rm
182+
-v $(pwd):/build
183+
-w /build
184+
node:${{ matrix.node }}-slim
185+
yarn test
186+
publish:
187+
name: Publish
188+
if: startsWith(github.ref, 'refs/tags/')
189+
runs-on: ubuntu-latest
190+
needs:
191+
- test-macOS-windows-binding
192+
- test-linux-x64-gnu-binding
193+
steps:
194+
- uses: actions/checkout@v4
195+
- name: Setup node
196+
uses: actions/setup-node@v4
197+
with:
198+
node-version: 20
199+
cache: yarn
200+
- name: Install dependencies
201+
run: yarn install
202+
- name: Download all artifacts
203+
uses: actions/download-artifact@v4
204+
with:
205+
path: node-binding/artifacts
206+
- name: Move artifacts
207+
working-directory: node-binding
208+
run: yarn artifacts
209+
- name: List packages
210+
run: ls -R ./npm
211+
working-directory: node-binding
212+
shell: bash
213+
- name: Publish
214+
working-directory: node-binding
215+
run: |
216+
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
217+
npm publish --access public --provenance true ${{ contains(github.ref_name, '-rc') && '--tag next' || '' }}
218+
env:
219+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
220+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/python-packaging.yml

-2
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,11 @@ on:
1616
push:
1717
branches:
1818
- main
19-
- master
2019
tags:
2120
- '*'
2221
pull_request:
2322
branches:
2423
- main
25-
- master
2624
workflow_dispatch:
2725

2826
permissions:

0 commit comments

Comments
 (0)