Skip to content

Commit 1e093e1

Browse files
committed
Align steam-api CI with native addon standards
1 parent 66b19ff commit 1e093e1

9 files changed

Lines changed: 1982 additions & 10 deletions

File tree

.github/workflows/build.yml

Lines changed: 51 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ on:
1111
required: false
1212
type: string
1313

14+
permissions:
15+
contents: write
16+
id-token: write
17+
attestations: write
18+
1419
jobs:
1520
create_release:
1621
name: Create Release
@@ -30,6 +35,7 @@ jobs:
3035
uses: actions/setup-node@v6
3136
with:
3237
node-version: 24.13.0
38+
cache: 'npm'
3339

3440
- name: Get Package Version
3541
id: package-version
@@ -50,11 +56,32 @@ jobs:
5056
name: Release ${{ steps.package-version.outputs.version }}
5157

5258
build:
53-
name: Build
59+
name: Build (${{ matrix.target }})
5460
needs: create_release
5561
strategy:
62+
fail-fast: false
5663
matrix:
57-
os: [ubuntu-22.04, windows-2022, macos-26]
64+
include:
65+
- target: windows-x64
66+
os: windows-2022
67+
node_arch: x64
68+
archflags: ''
69+
- target: linux-x64
70+
os: ubuntu-22.04
71+
node_arch: x64
72+
archflags: ''
73+
- target: linux-arm64
74+
os: ubuntu-22.04-arm
75+
node_arch: arm64
76+
archflags: ''
77+
- target: darwin-x64
78+
os: macos-26
79+
node_arch: x64
80+
archflags: '-arch x86_64'
81+
- target: darwin-arm64
82+
os: macos-26
83+
node_arch: arm64
84+
archflags: '-arch arm64'
5885

5986
runs-on: ${{ matrix.os }}
6087

@@ -69,13 +96,29 @@ jobs:
6996
uses: actions/setup-node@v6
7097
with:
7198
node-version: 24.13.0
99+
architecture: ${{ matrix.node_arch }}
100+
cache: 'npm'
101+
102+
- name: Print Native Target
103+
run: |
104+
echo "runner=$(uname -s)-$(uname -m)"
105+
node -p "'node=' + process.version + ' platform=' + process.platform + ' arch=' + process.arch"
106+
npm config get arch
107+
108+
- name: Cache Steamworks SDK
109+
uses: actions/cache@v4
110+
with:
111+
path: .sdk
112+
key: steamworks-sdk-${{ secrets.STEAM_SDK_GZ_SHA }}
72113

73114
- name: Install Modules
74-
run: npm install --ignore-scripts
115+
run: npm ci --ignore-scripts
75116

76117
- name: Build Current Binary
77118
run: npm run build:rebuild
78119
env:
120+
npm_config_arch: ${{ matrix.node_arch }}
121+
ARCHFLAGS: ${{ matrix.archflags }}
79122
STEAM_SDK_GZ_LINK: ${{ secrets.STEAM_SDK_GZ_LINK }}
80123
STEAM_SDK_GZ_SHA: ${{ secrets.STEAM_SDK_GZ_SHA }}
81124

@@ -92,6 +135,11 @@ jobs:
92135
id: pack-files
93136
run: node -e "import('@node-3d/addon-tools').then((m) => m.actionPack())" >> $GITHUB_OUTPUT
94137

138+
- name: Attest Binary
139+
uses: actions/attest@v4
140+
with:
141+
subject-path: ${{ steps.pack-files.outputs.pack }}
142+
95143
- name: Store Binaries
96144
uses: softprops/action-gh-release@v3
97145
env:

.github/workflows/cpplint.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Cpplint
2+
defaults:
3+
run:
4+
shell: bash
5+
6+
on:
7+
push:
8+
branches:
9+
- master
10+
pull_request:
11+
branches:
12+
- master
13+
14+
jobs:
15+
cpplint:
16+
name: Cpplint
17+
runs-on: ubuntu-22.04
18+
19+
steps:
20+
21+
- name: Fetch Repository
22+
uses: actions/checkout@v7
23+
with:
24+
persist-credentials: false
25+
26+
- name: Install Node.js
27+
uses: actions/setup-node@v6
28+
with:
29+
node-version: 24.13.0
30+
cache: 'npm'
31+
32+
- name: Install Modules
33+
run: npm ci --ignore-scripts
34+
35+
- name: Install Cpplint
36+
run: pip install cpplint
37+
38+
- name: Run Cpplint
39+
run: |
40+
node -e "import('@node-3d/addon-tools').then((m) => m.cpcpplint())"
41+
cpplint --filter=-build/c++17 --recursive ./src/cpp

.github/workflows/lint.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ on:
1414
jobs:
1515
lint:
1616
name: Lint
17-
runs-on: ubuntu-latest
17+
runs-on: ubuntu-22.04
1818

1919
steps:
2020

@@ -27,9 +27,10 @@ jobs:
2727
uses: actions/setup-node@v6
2828
with:
2929
node-version: 24.13.0
30+
cache: 'npm'
3031

3132
- name: Install Modules
32-
run: npm install --ignore-scripts
33+
run: npm ci --ignore-scripts
3334

3435
- name: Run Format Check
3536
run: |

.github/workflows/test.yml

Lines changed: 55 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,38 @@ on:
1313

1414
jobs:
1515
unit-tests:
16-
name: Unit Tests
17-
runs-on: ubuntu-latest
16+
name: Unit Tests (${{ matrix.target }})
17+
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
include:
22+
- target: windows-x64
23+
os: windows-2022
24+
node_arch: x64
25+
archflags: ''
26+
- target: windows-x64-on-arm
27+
os: windows-11-arm
28+
node_arch: x64
29+
archflags: ''
30+
- target: linux-x64
31+
os: ubuntu-22.04
32+
node_arch: x64
33+
archflags: ''
34+
- target: linux-arm64
35+
os: ubuntu-22.04-arm
36+
node_arch: arm64
37+
archflags: ''
38+
- target: darwin-x64
39+
os: macos-26
40+
node_arch: x64
41+
archflags: '-arch x86_64'
42+
- target: darwin-arm64
43+
os: macos-26
44+
node_arch: arm64
45+
archflags: '-arch arm64'
46+
47+
runs-on: ${{ matrix.os }}
1848

1949
steps:
2050

@@ -27,9 +57,31 @@ jobs:
2757
uses: actions/setup-node@v6
2858
with:
2959
node-version: 24.13.0
60+
architecture: ${{ matrix.node_arch }}
61+
cache: 'npm'
62+
63+
- name: Print Native Target
64+
run: |
65+
echo "runner=$(uname -s)-$(uname -m)"
66+
node -p "'node=' + process.version + ' platform=' + process.platform + ' arch=' + process.arch"
67+
npm config get arch
68+
69+
- name: Cache Steamworks SDK
70+
uses: actions/cache@v4
71+
with:
72+
path: .sdk
73+
key: steamworks-sdk-${{ secrets.STEAM_SDK_GZ_SHA }}
3074

3175
- name: Install Modules
32-
run: npm install --ignore-scripts
76+
run: npm ci --ignore-scripts
77+
78+
- name: Build Current Binary
79+
run: npm run build:rebuild
80+
env:
81+
npm_config_arch: ${{ matrix.node_arch }}
82+
ARCHFLAGS: ${{ matrix.archflags }}
83+
STEAM_SDK_GZ_LINK: ${{ secrets.STEAM_SDK_GZ_LINK }}
84+
STEAM_SDK_GZ_SHA: ${{ secrets.STEAM_SDK_GZ_SHA }}
3385

3486
- name: Build TypeScript
3587
run: npm run build:ci

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ dist
6161
.output
6262
.rslib/
6363
.clang-format
64+
CPPLINT.cfg
6465
.sdk/
6566
bin-*/
6667
src/build/

BUILD.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,18 @@ For local maintainer builds, place the archive at:
3939
```
4040

4141
`npm run sdk:ensure` unpacks that archive into `.sdk/sdk`.
42+
43+
CI caches `.sdk` by `STEAM_SDK_GZ_SHA`. Updating the private Steamworks SDK
44+
archive requires updating the hash secret so GitHub Actions invalidates the old
45+
cache and rehydrates the SDK from `STEAM_SDK_GZ_LINK`.
46+
47+
The native release build matrix follows the standard Node3D addon targets
48+
supported by the Steamworks SDK inputs: Windows x64, Linux x64, Linux ARM64,
49+
macOS x64, and macOS ARM64. Windows ARM64 is intentionally omitted until the SDK
50+
provides matching Windows ARM64 import and runtime libraries.
51+
52+
The test workflow also runs a `windows-x64-on-arm` lane on GitHub's
53+
`windows-11-arm` runner with x64 Node.js. That mirrors the expected Windows ARM
54+
Steam usage path: Steam and the addon run as x64 Windows binaries under Windows
55+
on ARM emulation. This lane validates the normal Windows x64 package artifact on
56+
an ARM host; it does not produce a separate Windows ARM64 release binary.

0 commit comments

Comments
 (0)