Skip to content

Commit a25b749

Browse files
committed
fix(workflows): add full support to all platforms
1 parent 5bc3582 commit a25b749

2 files changed

Lines changed: 90 additions & 62 deletions

File tree

.github/workflows/release.yml

Lines changed: 89 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -11,66 +11,95 @@ on:
1111
workflow_dispatch:
1212

1313
jobs:
14-
build-napi:
15-
name: Build NAPI - ${{ matrix.settings.target }}
16-
runs-on: ${{ matrix.settings.os }}
17-
strategy:
18-
fail-fast: false
19-
matrix:
20-
settings:
21-
- os: ubuntu-latest
22-
target: x86_64-unknown-linux-gnu
23-
build: pnpm core:build
24-
25-
- os: ubuntu-latest
26-
target: x86_64-unknown-linux-musl
27-
build: pnpm core:build
28-
29-
- os: macos-latest
30-
target: x86_64-apple-darwin
31-
build: pnpm core:build
32-
33-
- os: macos-latest
34-
target: aarch64-apple-darwin
35-
build: pnpm core:build
36-
37-
- os: windows-latest
38-
target: x86_64-pc-windows-msvc
39-
build: pnpm core:build
40-
41-
steps:
42-
- name: Checkout code
43-
uses: actions/checkout@v4
44-
45-
- name: Setup Node.js
46-
uses: actions/setup-node@v4
47-
with:
48-
node-version: '20'
49-
50-
- name: Setup pnpm
51-
uses: pnpm/action-setup@v4
52-
with:
53-
version: 8
54-
55-
- name: Setup Rust
56-
uses: actions-rust-lang/setup-rust-toolchain@v1
57-
with:
58-
toolchain: stable
59-
target: ${{ matrix.settings.target }}
60-
61-
- name: Install dependencies
62-
run: pnpm install -r
63-
64-
- name: Build NAPI binary
65-
run: ${{ matrix.settings.build }}
66-
working-directory: .
67-
68-
- name: Upload artifact
69-
uses: actions/upload-artifact@v4
70-
with:
71-
name: bindings-${{ matrix.settings.target }}
72-
path: packages/core/dist
73-
retention-days: 3
14+
build-napi:
15+
name: Build NAPI - ${{ matrix.settings.target }}
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
settings:
20+
- host: macos-latest
21+
target: x86_64-apple-darwin
22+
build: pnpm core:build --target x86_64-apple-darwin
23+
- host: macos-latest
24+
target: aarch64-apple-darwin
25+
build: pnpm core:build --target aarch64-apple-darwin
26+
- host: windows-latest
27+
target: x86_64-pc-windows-msvc
28+
build: pnpm core:build --target x86_64-pc-windows-msvc
29+
- host: windows-latest
30+
target: i686-pc-windows-msvc
31+
build: pnpm core:build --target i686-pc-windows-msvc
32+
- host: windows-latest
33+
target: aarch64-pc-windows-msvc
34+
build: pnpm core:build --target aarch64-pc-windows-msvc
35+
- host: ubuntu-latest
36+
target: x86_64-unknown-linux-gnu
37+
build: pnpm core:build --target x86_64-unknown-linux-gnu --use-napi-cross
38+
- host: ubuntu-latest
39+
target: x86_64-unknown-linux-musl
40+
build: pnpm core:build --target x86_64-unknown-linux-musl -x
41+
- host: ubuntu-latest
42+
target: aarch64-unknown-linux-gnu
43+
build: pnpm core:build --target aarch64-unknown-linux-gnu --use-napi-cross
44+
- host: ubuntu-latest
45+
target: aarch64-unknown-linux-musl
46+
build: pnpm core:build --target aarch64-unknown-linux-musl -x
47+
- host: ubuntu-latest
48+
target: armv7-unknown-linux-gnueabihf
49+
build: pnpm core:build --target armv7-unknown-linux-gnueabihf --use-napi-cross
50+
- host: ubuntu-latest
51+
target: aarch64-linux-android
52+
build: pnpm core:build --target aarch64-linux-android
53+
runs-on: ${{ matrix.settings.host }}
54+
steps:
55+
- uses: actions/checkout@v5
56+
57+
- name: Setup Node.js
58+
uses: actions/setup-node@v6
59+
with:
60+
node-version: '20'
61+
cache: pnpm
62+
63+
- name: Setup pnpm
64+
uses: pnpm/action-setup@v4
65+
with:
66+
version: 8
67+
68+
- name: Install Rust toolchain
69+
uses: dtolnay/rust-toolchain@stable
70+
with:
71+
toolchain: stable
72+
targets: ${{ matrix.settings.target }}
73+
components: clippy, rustfmt
74+
75+
- name: Install build dependencies (Linux only)
76+
if: runner.os == 'Linux'
77+
run: |
78+
sudo apt-get update
79+
sudo apt-get install -y build-essential musl-tools clang pkg-config libssl-dev
80+
81+
- name: Install cargo-zigbuild (musl only)
82+
if: ${{ contains(matrix.settings.target, 'musl') }}
83+
uses: taiki-e/install-action@v2
84+
with:
85+
tool: cargo-zigbuild
86+
env:
87+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
88+
89+
- name: Install dependencies
90+
run: pnpm install -r
91+
92+
- name: Build NAPI binary
93+
run: ${{ matrix.settings.build }}
94+
working-directory: .
95+
shell: bash
96+
97+
- name: Upload artifact
98+
uses: actions/upload-artifact@v5
99+
with:
100+
name: bindings-${{ matrix.settings.target }}
101+
path: packages/core/dist
102+
if-no-files-found: error
74103

75104
publish-npm:
76105
name: Publish to NPM
@@ -168,5 +197,4 @@ jobs:
168197
draft: false
169198
prerelease: ${{ contains(github.ref_name, 'alpha') || contains(github.ref_name, 'beta') || contains(github.ref_name, 'rc') }}
170199
env:
171-
# normalmente funciona con GITHUB_TOKEN y los permissions arriba
172200
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "1.0.0-alpha.2",
44
"description": "Internal logic (core) of the Kito framework written in Rust.",
55
"scripts": {
6-
"build": "napi build --platform --release --esm --const-enum --output-dir dist",
6+
"build": "napi build --release --esm --const-enum --output-dir dist",
77
"test": "cargo test"
88
},
99

0 commit comments

Comments
 (0)