Skip to content

Commit ef5214a

Browse files
authored
feat: upgrade toolchain (#39)
1 parent 4ed7abc commit ef5214a

File tree

12 files changed

+2932
-1709
lines changed

12 files changed

+2932
-1709
lines changed

.github/workflows/pure-rust-build-on-linux.yml

Lines changed: 46 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,27 @@ jobs:
1414
strategy:
1515
fail-fast: false
1616
matrix:
17-
targets:
18-
[
19-
'x86_64-apple-darwin',
20-
'aarch64-apple-darwin',
21-
'x86_64-pc-windows-msvc',
22-
'i686-pc-windows-msvc',
23-
'aarch64-pc-windows-msvc',
24-
'x86_64-unknown-linux-gnu',
25-
'aarch64-unknown-linux-gnu',
26-
'x86_64-unknown-linux-musl',
27-
'aarch64-unknown-linux-musl',
28-
'armv7-unknown-linux-gnueabihf',
29-
'aarch64-linux-android',
30-
'armv7-linux-androideabi',
31-
]
17+
settings:
18+
- target: x86_64-apple-darwin
19+
flags: '-x'
20+
- target: aarch64-apple-darwin
21+
flags: '-x'
22+
- target: x86_64-pc-windows-msvc
23+
flags: '-x'
24+
- target: i686-pc-windows-msvc
25+
flags: '-x'
26+
- target: aarch64-pc-windows-msvc
27+
flags: '-x'
28+
- target: x86_64-unknown-linux-gnu
29+
flags: '--use-napi-cross'
30+
- target: aarch64-unknown-linux-gnu
31+
flags: '--use-napi-cross'
32+
- target: x86_64-unknown-linux-musl
33+
flags: '-x'
34+
- target: aarch64-unknown-linux-musl
35+
flags: '-x'
36+
- target: armv7-unknown-linux-gnueabihf
37+
flags: '--use-napi-cross'
3238
runs-on: ubuntu-latest
3339
steps:
3440
- uses: actions/checkout@v4
@@ -40,33 +46,33 @@ jobs:
4046
${{ github.workspace }}/.xwin
4147
~/.napi-rs
4248
./target
43-
key: ${{ matrix.targets }}-cargo-cache
49+
key: ${{ matrix.settings.target }}-cargo-cache
4450
- name: Install
4551
uses: dtolnay/rust-toolchain@stable
4652
with:
4753
toolchain: stable
48-
targets: ${{ matrix.targets }}
54+
targets: ${{ matrix.settings.target }}
4955
- uses: actions/setup-node@v4
5056
with:
51-
node-version: '20'
57+
node-version: '22'
5258
cache: 'yarn'
5359
- name: Install ziglang
5460
uses: goto-bus-stop/setup-zig@v1
5561
with:
56-
version: 0.13.0
62+
version: 0.14.1
5763
- name: Install cargo toolchains
5864
uses: taiki-e/install-action@v2
5965
env:
6066
GITHUB_TOKEN: ${{ github.token }}
6167
with:
6268
tool: cargo-zigbuild,cargo-xwin
6369
- run: yarn install
64-
- run: yarn workspace @napi-cross-build/01-pure-rust build --target ${{ matrix.targets }}
70+
- run: yarn workspace @napi-cross-build/01-pure-rust build --target ${{ matrix.settings.target }} ${{ matrix.settings.flags }}
6571
env:
6672
XWIN_CACHE_DIR: ${{ github.workspace }}/.xwin
6773
- uses: actions/upload-artifact@v4
6874
with:
69-
name: bindings-${{ matrix.targets }}
75+
name: bindings-${{ matrix.settings.target }}
7076
path: 01-pure-rust/*.node
7177
if-no-files-found: error
7278
test-host:
@@ -76,30 +82,30 @@ jobs:
7682
settings:
7783
- target: x86_64-apple-darwin
7884
host: macos-latest
85+
architecture: x64
7986
- target: aarch64-apple-darwin
8087
host: macos-latest
88+
architecture: arm64
8189
- target: x86_64-pc-windows-msvc
8290
host: windows-latest
91+
architecture: x64
92+
- target: aarch64-pc-windows-msvc
93+
host: windows-11-arm
94+
architecture: arm64
8395
- target: i686-pc-windows-msvc
8496
host: windows-latest
85-
node: ['18', '20']
97+
architecture: x64
98+
node: ['20', '22']
8699
runs-on: ${{ matrix.settings.host }}
87100
needs:
88101
- build
89102
steps:
90103
- uses: actions/checkout@v4
91104
- uses: actions/setup-node@v4
92-
if: matrix.settings.target != 'aarch64-apple-darwin'
93-
with:
94-
node-version: ${{ matrix.node }}
95-
cache: 'yarn'
96-
architecture: x64
97-
- uses: actions/setup-node@v4
98-
if: matrix.settings.target == 'aarch64-apple-darwin'
99105
with:
100106
node-version: ${{ matrix.node }}
101107
cache: 'yarn'
102-
architecture: arm64
108+
architecture: ${{ matrix.settings.architecture }}
103109
- name: Setup node x86
104110
if: matrix.settings.target == 'i686-pc-windows-msvc'
105111
run: yarn config set supportedArchitectures.cpu "ia32"
@@ -110,7 +116,7 @@ jobs:
110116
uses: actions/setup-node@v4
111117
if: matrix.settings.target == 'i686-pc-windows-msvc'
112118
with:
113-
node-version: 20
119+
node-version: 22
114120
cache: yarn
115121
architecture: x86
116122
- name: Download bindings
@@ -126,28 +132,28 @@ jobs:
126132
matrix:
127133
settings:
128134
- target: x86_64-unknown-linux-gnu
129-
docker: node:18-slim
135+
docker: node:22-slim
130136
args: ''
131137
- target: aarch64-unknown-linux-gnu
132-
docker: node:18-slim
138+
docker: node:22-slim
133139
args: '--platform linux/arm64'
134140
- target: x86_64-unknown-linux-musl
135-
docker: node:18-alpine
141+
docker: node:22-alpine
136142
args: ''
137143
- target: aarch64-unknown-linux-musl
138-
docker: node:18-alpine
144+
docker: node:22-alpine
139145
args: '--platform linux/arm64'
140146
- target: armv7-unknown-linux-gnueabihf
141-
docker: node:18-bullseye-slim
147+
docker: node:22-bullseye-slim
142148
args: '--platform linux/arm/v7'
143-
runs-on: ubuntu-latest
149+
runs-on: ${{ contains(matrix.settings.target, 'aarch64') && 'ubuntu-24.04-arm' || 'ubuntu-latest' }}
144150
needs:
145151
- build
146152
steps:
147153
- uses: actions/checkout@v4
148154
- uses: actions/setup-node@v4
149155
with:
150-
node-version: 20
156+
node-version: 22
151157
cache: 'yarn'
152158
- name: Install dependencies
153159
run: yarn install
@@ -157,10 +163,12 @@ jobs:
157163
name: bindings-${{ matrix.settings.target }}
158164
path: 01-pure-rust/
159165
- name: Set up QEMU
166+
if: ${{ !contains(matrix.settings.target, 'aarch64') }}
160167
uses: docker/setup-qemu-action@v3
161168
with:
162169
platforms: arm64,arm
163170
- run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
171+
if: ${{ !contains(matrix.settings.target, 'aarch64') }}
164172
- name: Run tests
165173
uses: addnab/docker-run-action@v3
166174
with:

.yarn/releases/yarn-4.4.1.cjs

Lines changed: 0 additions & 925 deletions
This file was deleted.

.yarn/releases/yarn-4.9.2.cjs

Lines changed: 942 additions & 0 deletions
Large diffs are not rendered by default.

.yarnrc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ enableGlobalCache: false
44

55
nodeLinker: node-modules
66

7-
yarnPath: .yarn/releases/yarn-4.4.1.cjs
7+
yarnPath: .yarn/releases/yarn-4.9.2.cjs

01-pure-rust/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ crate-type = ["cdylib"]
88

99
[dependencies]
1010
# Default enable napi4 feature, see https://nodejs.org/api/n-api.html#node-api-version-matrix
11-
napi = { version = "2", default-features = false, features = ["napi4"] }
12-
napi-derive = "2"
13-
lz-str = "0.2"
11+
napi = { workspace = true }
12+
napi-derive = { workspace = true }
13+
lz-str = { workspace = true }
1414

1515
[build-dependencies]
16-
napi-build = "2"
16+
napi-build = { workspace = true }

01-pure-rust/index.d.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
/* tslint:disable */
2-
/* eslint-disable */
3-
41
/* auto-generated by NAPI-RS */
5-
6-
export function compressToBase64(input: string): string
2+
/* eslint-disable */
3+
export declare function compressToBase64(input: string): string

0 commit comments

Comments
 (0)