@@ -4,22 +4,42 @@ on: [push, pull_request]
4
4
5
5
jobs :
6
6
build :
7
- name : ' Build on Node v${{ matrix.node }} ${{ matrix.os }} ${{ matrix.arch }}'
8
- runs-on : ${{ matrix.os }}-latest
7
+ name : ' Build on Node v${{ matrix.node }} ${{ matrix.os.name }} ${{ matrix.arch }}'
8
+ runs-on : ${{ matrix.os.name }}-${{ matrix.os.version }}
9
9
10
10
strategy :
11
11
matrix :
12
- os : [Ubuntu, Windows, macOS]
12
+ os :
13
+ - name : Ubuntu
14
+ version : latest
15
+ - name : macOS
16
+ version : latest
17
+ - name : Windows
18
+ # Using the `windows-2019` runner instead of latest(`windows-2022`)
19
+ # because the build was last known working on that version of runner and
20
+ # `prebuild` fails to find the 2022 Visual Studio install because
21
+ # it's internally using an old version of `node-gyp`, see
22
+ # https://github.com/prebuild/prebuild/issues/286
23
+ #
24
+ # Also some more context around this problem in this internal issue,
25
+ # https://github.com/MadLittleMods/node-usb-detection/issues/164
26
+ version : 2019
13
27
arch : [x64]
14
28
node : ['12', '14', '16']
15
29
include :
16
- - os : Windows
30
+ - os :
31
+ name : Windows
32
+ version : 2019
17
33
arch : x86
18
34
node : ' 12'
19
- - os : Windows
35
+ - os :
36
+ name : Windows
37
+ version : 2019
20
38
arch : x86
21
39
node : ' 14'
22
- - os : Windows
40
+ - os :
41
+ name : Windows
42
+ version : 2019
23
43
arch : x86
24
44
node : ' 16'
25
45
@@ -33,15 +53,50 @@ jobs:
33
53
node-version : ${{ matrix.node }}
34
54
architecture : ${{ matrix.arch }}
35
55
56
+ # FIXME: Install `npm@^8` (latest v8) once
57
+ # https://github.com/actions/setup-node/issues/411#issuecomment-1025543081
58
+ # is fixed.
59
+ #
60
+ # Even though we install a new version of node-gyp locally in
61
+ # the project, the CI always seems to use the npm bundled version of
62
+ # node-gyp. Even following the instructions from the docs, I could get it working
63
+ # on all other platforms except for Windows and npm@6, see
64
+ # - https://github.com/nodejs/node-gyp/blob/245cd5bbe4441d4f05e88f2fa20a86425419b6af/docs/Updating-npm-bundled-node-gyp.md
65
+ # - https://github.com/nodejs/node-gyp/blob/245cd5bbe4441d4f05e88f2fa20a86425419b6af/docs/Force-npm-to-use-global-node-gyp.md
66
+ - name : ' Install npm@^8 to get a more up to date bundled node-gyp'
67
+ run :
npm install --global [email protected]
68
+
69
+ # Fix `Error: Could not find any Visual Studio installation to use`
70
+ # See https://github.com/nodejs/node-gyp/tree/245cd5bbe4441d4f05e88f2fa20a86425419b6af/docs#issues-finding-the-installed-visual-studio
71
+ #
72
+ # This is commented out because we're using `windows-2019` runners atm
73
+ # - name: 'Set msvs_version so node-gyp can find the Visual Studio install'
74
+ # if: ${{ matrix.os.name == 'Windows' }}
75
+ # run: npm config set msvs_version 2022
76
+
36
77
- name : ' Install Linux dependencies'
37
- if : ${{ matrix.os == 'Ubuntu' }}
78
+ if : ${{ matrix.os.name == 'Ubuntu' }}
38
79
run : |
39
80
sudo apt-get update
40
81
sudo apt-get install libudev-dev
41
82
83
+ - name : ' Node.js version'
84
+ run : node --version
85
+
86
+ - name : ' npm version'
87
+ run : npm --version
88
+
89
+ - name : ' node-gyp version'
90
+ run : npm run node-gyp -- --version
91
+
42
92
- name : ' Install dependencies and build from source'
43
93
run : npm ci --build-from-source
44
94
95
+ # We run this after `npm ci` so that `nan` is installed probably
96
+ - name : ' node-gyp configuration (for debugging)'
97
+ if : ${{ always() }}
98
+ run : npm run node-gyp -- configure --verbose
99
+
45
100
# TODO: Tests are disabled until we have tests which are
46
101
# suitable for CI and don't require manual interaction.
47
102
- name : ' Test'
57
112
if : ${{ matrix.node == '14' }}
58
113
uses : actions/upload-artifact@v2
59
114
with :
60
- name : prebuilds-${{ matrix.os }}-${{ matrix.arch }}
115
+ name : prebuilds-${{ matrix.os.name }}-${{ matrix.arch }}
61
116
path : prebuilds
62
117
63
118
check :
0 commit comments