-
Notifications
You must be signed in to change notification settings - Fork 696
196 lines (171 loc) · 6.15 KB
/
tests.yml
File metadata and controls
196 lines (171 loc) · 6.15 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
on:
push:
branches:
- master
- backport/*
tags:
- v*.*.*
pull_request:
name: Testing
jobs:
linux-tests:
name: "Linux Tests"
strategy:
matrix:
node: [20, 22, 24]
fail-fast: false
runs-on: ubuntu-22.04
steps:
- name: Install Dependencies for Ubuntu
run: sudo apt-get update && sudo apt-get install -y software-properties-common git build-essential clang libssl-dev libkrb5-dev libc++-dev wget zlib1g-dev
- uses: actions/checkout@v4
- name: Setup Environment
run: |
set -e
mkdir ~/.ssh_tests
chmod 700 ~/.ssh_tests
printf "%b" "Host *\n\tStrictHostKeyChecking no\n" > ~/.ssh_tests/config
cat test/id_rsa.pub > ~/.ssh_tests/id_rsa.pub
cat test/id_rsa.enc | base64 -d > ~/.ssh_tests/id_rsa
chmod 600 ~/.ssh_tests/id_rsa*
git config --global user.name "John Doe"
git config --global user.email johndoe@example.com
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
check-latest: true
- name: Install
run: npm install
- name: Test
run: |
set -e
eval `ssh-agent -s`
ssh-add ~/.ssh_tests/id_rsa
node utils/retry npm test
- name: Deploy
if: startsWith(github.ref, 'refs/tags/v')
env:
node_pre_gyp_bucket: ${{ secrets.node_pre_gyp_bucket }}
AWS_ACCESS_KEY_ID: ${{ secrets.node_pre_gyp_accessKeyId }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.node_pre_gyp_secretAccessKey }}
run: |
npm install -g @mapbox/node-pre-gyp aws-sdk
node lifecycleScripts/clean
node-pre-gyp package
node-pre-gyp publish
macos-tests:
name: "macOS Tests"
strategy:
matrix:
node: [20, 22, 24]
arch: [x64, arm64]
fail-fast: false
runs-on: ${{ matrix.arch == 'x64' && 'macos-15-intel' || 'macos-15' }}
steps:
- uses: actions/checkout@v4
- name: Setup Environment
run: |
mkdir ~/.ssh_tests
chmod 700 ~/.ssh_tests
printf "%b" "Host *\n\tStrictHostKeyChecking no\n" > ~/.ssh_tests/config
cat test/id_rsa.pub > ~/.ssh_tests/id_rsa.pub
cat test/id_rsa.enc | base64 -d > ~/.ssh_tests/id_rsa
chmod 600 ~/.ssh_tests/id_rsa*
git config --global user.name "John Doe"
git config --global user.email johndoe@example.com
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
check-latest: true
- name: Install
run: npm install
- name: Test
run: |
set -e
eval `ssh-agent -s`
ssh-add ~/.ssh_tests/id_rsa
node utils/retry npm test
- name: Deploy
if: startsWith(github.ref, 'refs/tags/v')
env:
node_pre_gyp_bucket: ${{ secrets.node_pre_gyp_bucket }}
AWS_ACCESS_KEY_ID: ${{ secrets.node_pre_gyp_accessKeyId }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.node_pre_gyp_secretAccessKey }}
run: |
npm install -g @mapbox/node-pre-gyp aws-sdk
node lifecycleScripts/clean
node-pre-gyp package
node-pre-gyp publish
windows-tests:
name: Windows Tests
strategy:
matrix:
node: [20, 22, 24]
arch: [x86, x64, arm64]
exclude:
- node: 24
arch: x86
fail-fast: false
runs-on: windows-2022
steps:
- name: Setup Environment
run: |
git config --file C:\ProgramData\Git\config core.autocrlf input
git config --system core.autocrlf input
git config --global core.autocrlf input
git config --global user.name "John Doe"
git config --global user.email johndoe@example.com
- uses: actions/checkout@v4
- name: Use Node.js
if: matrix.arch == 'x86'
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
check-latest: true
architecture: x86
- name: Use Node.js
uses: actions/setup-node@v4
if: matrix.arch != 'x86'
with:
node-version: ${{ matrix.node }}
check-latest: true
- name: Install
env:
npm_config_arch: ${{ matrix.arch == 'x86' && 'ia32' || matrix.arch }}
run: npm install
- name: Test
# need arm64 runners or an emulator to run tests
if: matrix.arch != 'arm64'
env:
GIT_SSH: ${{ github.workspace }}\vendor\plink.exe
run: |
$encodedKey = Get-Content -Path test\private.ppk.enc
$finalPath = Join-Path -Path $HOME -ChildPath .ssh_tests\private.ppk
mkdir ~\.ssh_tests
Set-Content -Value $([System.Convert]::FromBase64String($encodedKey)) -Path $finalPath -AsByteStream
powershell -command "Start-Process .\vendor\pageant\pageant_${{ matrix.arch }}.exe $finalPath"
node utils/retry npm test
# You're probably wondering why this isn't a single `run: |` step, it certainly is for *nix,
# but it's not, because the CI runner for windows doesn't wait for each step as listed here
# and it treats each additional step past the first as an orphaned process.
- name: Deploy (Dependencies)
if: startsWith(github.ref, 'refs/tags/v')
run: npm install -g @mapbox/node-pre-gyp aws-sdk
- name: Deploy (Clean)
if: startsWith(github.ref, 'refs/tags/v')
run: node lifecycleScripts\clean
- name: Deploy (Package)
if: startsWith(github.ref, 'refs/tags/v')
run: node-pre-gyp package --target_arch=${{ matrix.arch }}
- name: Deploy (Publish)
if: startsWith(github.ref, 'refs/tags/v')
env:
node_pre_gyp_bucket: ${{ secrets.node_pre_gyp_bucket }}
AWS_ACCESS_KEY_ID: ${{ secrets.node_pre_gyp_accessKeyId }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.node_pre_gyp_secretAccessKey }}
run: node-pre-gyp publish --target_arch=${{ matrix.arch }}