Skip to content

Commit a235752

Browse files
committed
Added host architecture concept to CI
- as we move towards cross-compiling in native GitHub Actions, we need a way to differentiate between the host and target architecture - this adds a concept of `host` to CI and passes the target architecture to `node-pre-gyp`
1 parent 0895b3b commit a235752

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

.github/workflows/ci.yml

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ jobs:
2222
- macos-latest
2323
- ubuntu-latest
2424
- windows-latest
25+
host:
26+
- x64
2527
target:
2628
- x64
2729
node:
@@ -37,14 +39,15 @@ jobs:
3739
include:
3840
- os: windows-latest
3941
node: 16
42+
host: x86
4043
target: x86
41-
name: ${{ matrix.os }} (node=${{ matrix.node }}, target=${{ matrix.target }})
44+
name: ${{ matrix.os }} (node=${{ matrix.node }}, host=${{ matrix.host }}, target=${{ matrix.target }})
4245
steps:
4346
- uses: actions/checkout@v3
4447
- uses: actions/setup-node@v3
4548
with:
4649
node-version: ${{ matrix.node }}
47-
architecture: ${{ matrix.target }}
50+
architecture: ${{ matrix.host }}
4851

4952
- name: Add msbuild to PATH
5053
uses: microsoft/[email protected]
@@ -56,20 +59,27 @@ jobs:
5659
run: yarn install --ignore-scripts
5760

5861
- name: Add env vars
62+
shell: bash
5963
run: |
6064
echo "V=1" >> $GITHUB_ENV
6165
66+
if [ "${{ matrix.target }}" = "x86" ]; then
67+
echo "TARGET=ia32" >> $GITHUB_ENV
68+
else
69+
echo "TARGET=${{ matrix.target }}" >> $GITHUB_ENV
70+
fi
71+
6272
- name: Add Linux env vars
6373
if: contains(matrix.os, 'ubuntu')
6474
run: |
6575
echo "CFLAGS=${CFLAGS:-} -include ../src/gcc-preinclude.h" >> $GITHUB_ENV
6676
echo "CXXFLAGS=${CXXFLAGS:-} -include ../src/gcc-preinclude.h" >> $GITHUB_ENV
6777
6878
- name: Configure build
69-
run: yarn node-pre-gyp configure
79+
run: yarn node-pre-gyp configure --target_arch=${{ env.TARGET }}
7080

7181
- name: Build binaries
72-
run: yarn node-pre-gyp build
82+
run: yarn node-pre-gyp build --target_arch=${{ env.TARGET }}
7383

7484
- name: Print binary info
7585
if: contains(matrix.os, 'ubuntu')
@@ -84,7 +94,7 @@ jobs:
8494
run: yarn test
8595

8696
- name: Package prebuilt binaries
87-
run: yarn node-pre-gyp package
97+
run: yarn node-pre-gyp package --target_arch=${{ env.TARGET }}
8898

8999
- name: Upload binaries to commit artifacts
90100
uses: actions/upload-artifact@v3

0 commit comments

Comments
 (0)