-
Notifications
You must be signed in to change notification settings - Fork 17
116 lines (97 loc) · 3.85 KB
/
Copy pathreusable-build.yml
File metadata and controls
116 lines (97 loc) · 3.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
name: Reusable Build
# Builds the native NAPI bindings for every target and uploads them as
# `bindings-<target>` artifacts. Called by both `release.yml` (tag releases)
# and `pkg.pr.new.yml` (PR preview packages) so the build matrix lives in one
# place.
on:
workflow_call:
permissions: {}
env:
DEBUG: 'napi:*'
jobs:
build:
name: Build - ${{ matrix.target }}
permissions:
contents: read
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-24.04-arm
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
- target: aarch64-unknown-linux-musl
os: ubuntu-latest
- target: x86_64-apple-darwin
os: macos-latest
- target: aarch64-apple-darwin
os: macos-latest
- target: x86_64-pc-windows-msvc
os: windows-latest
- target: aarch64-pc-windows-msvc
os: windows-latest
steps:
- name: Support longpaths
if: ${{ matrix.os == 'windows-latest' }}
run: git config --system core.longpaths true
- uses: taiki-e/checkout-action@7d1e50e93dc4fb3bba58f85018fadf77898aee8b # v1.4.2
- name: Update submodules
run: git submodule update --init --recursive
- name: Print rustup toolchain version
shell: bash
id: rustup-version
run: |
export RUST_TOOLCHAIN_VERSION="$(grep 'channel' rust-toolchain.toml | head -1 | awk -F '"' '{print $2}')"
echo "Rust toolchain version: $RUST_TOOLCHAIN_VERSION"
echo "RUST_TOOLCHAIN_VERSION=$RUST_TOOLCHAIN_VERSION" >> "$GITHUB_OUTPUT"
- name: Install Rust
uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
with:
toolchain: '${{ steps.rustup-version.outputs.RUST_TOOLCHAIN_VERSION }}'
targets: ${{ matrix.target }}
- name: Cache Rust
uses: Swatinem/rust-cache@fb003b4f771bbf9c2de31d5f65c40689cc097fb5 # v2.1.0
- uses: mlugg/setup-zig@fa65c4058643678a4e4a9a60513944a7d8d35440 # v2.1.0
if: ${{ contains(matrix.target, 'musl') }}
with:
version: 0.15.2
- name: Install cargo-zigbuild
uses: taiki-e/install-action@cca35edeb1d01366c2843b68fc3ca441446d73d3 # v2.77.1
if: ${{ contains(matrix.target, 'musl') }}
env:
GITHUB_TOKEN: ${{ github.token }}
with:
tool: cargo-zigbuild
- name: Install pnpm
uses: pnpm/action-setup@08c4be7e2e672a47d11bd04269e27e5f3e8529cb # v6.0.0
- name: Install Node.js
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version: 24
cache: pnpm
- name: Install dependencies
run: pnpm install
- name: Build ${{ matrix.target }}
working-directory: napi/angular-compiler
if: ${{ !contains(matrix.target , 'gnu') && !contains(matrix.target, 'musl') }}
run: pnpm build-dev --release --target ${{ matrix.target }}
- name: Build ${{ matrix.target }}
working-directory: napi/angular-compiler
if: ${{ contains(matrix.target , 'gnu') }}
run: pnpm build-dev --release --target ${{ matrix.target }} --use-napi-cross
env:
TARGET_CC: clang
- name: Build ${{ matrix.target }}
working-directory: napi/angular-compiler
if: ${{ contains(matrix.target, 'musl') }}
run: pnpm build-dev --release --target ${{ matrix.target }} -x
- name: Upload artifact
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: bindings-${{ matrix.target }}
path: napi/angular-compiler/*.node
if-no-files-found: error