-
Notifications
You must be signed in to change notification settings - Fork 2
88 lines (84 loc) · 2.9 KB
/
Copy pathwindows-napi.yml
File metadata and controls
88 lines (84 loc) · 2.9 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
name: windows-napi
# NOTE: `paths` filters deliberately do NOT accompany the tag trigger — a tag push can have an
# empty changed-file set, and paths+tags together silently skip the run.
on:
push:
tags:
- 'windows-napi-v*'
pull_request:
paths:
- 'windows-napi/**'
- 'runtime/**'
- 'metadata/**'
- '.github/workflows/windows-napi.yml'
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
settings:
- target: x86_64-pc-windows-msvc
- target: aarch64-pc-windows-msvc
name: build ${{ matrix.settings.target }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.settings.target }}
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.settings.target }}
- name: Install npm dependencies
working-directory: windows-napi
run: npm ci
- name: Build .node
working-directory: windows-napi
run: npx napi build --platform --release --target ${{ matrix.settings.target }}
- name: Run test suite (x64 only — the runner cannot execute arm64 binaries)
if: matrix.settings.target == 'x86_64-pc-windows-msvc'
working-directory: windows-napi
# Server runner SKUs can lack optional feature packs some suites touch (e.g. Media
# Foundation for the MediaPlayer event test), so failures here warn instead of block;
# the authoritative run is the local one on a client SKU.
continue-on-error: true
run: npm test
- uses: actions/upload-artifact@v4
with:
name: bindings-${{ matrix.settings.target }}
path: windows-napi/windows.*.node
if-no-files-found: error
publish:
name: publish to npm
if: startsWith(github.ref, 'refs/tags/windows-napi-v')
needs: build
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org
- name: Install npm dependencies
working-directory: windows-napi
run: npm ci
- name: Download all binding artifacts
uses: actions/download-artifact@v4
with:
path: windows-napi/artifacts
- name: Distribute artifacts into npm/<triple> sub-packages
working-directory: windows-napi
run: npx napi artifacts
- name: Publish
working-directory: windows-napi
# `napi prepublish` (prepublishOnly script) publishes each npm/<triple> sub-package,
# then the root package publishes with them as optionalDependencies.
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}