-
-
Notifications
You must be signed in to change notification settings - Fork 1
163 lines (135 loc) · 4.05 KB
/
test.yml
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
name: Test
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
linux_test:
runs-on: ubuntu-latest
strategy:
matrix:
node_version: [ 16.x, 18.x, 19.x, 20.x, 21.x ]
steps:
- uses: actions/checkout@v4
name: Checkout
- uses: actions/setup-node@v4
name: Setup Node.js
with:
node-version: ${{ matrix.node_version }}
- name: Install dependencies
run: |
export DEBIAN_FRONTEND=noninteractive
sudo apt update
sudo apt install -y binutils-multiarch gcc-*aarch64-linux-gnu gcc-*aarch64-linux-gnu-base g++-*aarch64-linux-gnu libc6-arm64-cross
npm install --no-save --ignore-scripts
- name: Build addon
run: npm run prebuildify -- -v
- name: Test
run: sudo -E node --require ts-node/register --loader ts-node/esm ./src/index_test.ts
- name: Upload generate interface
uses: actions/upload-artifact@v3
with:
name: addrs_${{ runner.os }}_${{ matrix.node_version }}
path: "*.addrs.json"
- name: Upload prebuilds interface
uses: actions/upload-artifact@v3
with:
retention-days: 7
name: prebuilds_${{ runner.os }}
path: "prebuilds/**"
macos_test:
runs-on: macos-latest
strategy:
matrix:
node_version: [ 16.x, 18.x, 19.x, 20.x, 21.x ]
steps:
- uses: actions/checkout@v4
name: Checkout
- uses: actions/setup-node@v4
name: Setup Node.js
with:
node-version: ${{ matrix.node_version }}
- name: Setup Go environment
uses: actions/[email protected]
- name: Setup wireguard-go
run: |
cd ..
git clone https://git.zx2c4.com/wireguard-go
cd wireguard-go
echo "WG_INETRFACE=utun15" >> $GITHUB_ENV
go build -v -o "wireguard-go"
sudo ./wireguard-go utun15
- name: Install dependencies
run: npm install --no-save --ignore-scripts
- name: Build addon
run: npm run prebuildify -- -v
- name: Test
run: sudo -E node --require ts-node/register --loader ts-node/esm ./src/index_test.ts
- name: Upload generate interface
uses: actions/upload-artifact@v3
with:
name: addrs_${{ runner.os }}_${{ matrix.node_version }}
path: "*.addrs.json"
- name: Upload prebuilds interface
uses: actions/upload-artifact@v3
with:
retention-days: 7
name: prebuilds_${{ runner.os }}
path: "prebuilds/**"
win_test:
runs-on: windows-latest
strategy:
matrix:
node_version: [ 16.x, 18.x, 19.x, 20.x, 21.x ]
steps:
- uses: actions/checkout@v4
name: Checkout
- uses: actions/setup-node@v4
name: Setup Node.js
with:
node-version: ${{ matrix.node_version }}
- name: Install dependencies
run: npm install --no-save --ignore-scripts
- name: Build addon
run: npm run prebuildify -- -v
- name: Test
run: node --require ts-node/register --loader ts-node/esm ./src/index_test.ts
- name: Upload generate interface
uses: actions/upload-artifact@v3
with:
name: addrs_${{ runner.os }}_${{ matrix.node_version }}
path: "*.addrs.json"
- name: Upload prebuilds interface
uses: actions/upload-artifact@v3
with:
retention-days: 7
name: prebuilds_${{ runner.os }}
path: "prebuilds/**"
pack_package:
needs: [ linux_test, macos_test, win_test ]
runs-on: ubuntu-latest
name: Pack npm package
env:
PACKAGE_VERSION: ${{ github.ref }}
steps:
- uses: actions/checkout@v4
name: Code checkout
- uses: actions/setup-node@v4
name: Setup node.js
with:
node-version: 20.x
registry-url: https://registry.npmjs.org/
- name: Download all artefacts
uses: actions/download-artifact@v3
with:
path: ./prebuilds
- run: npm install --no-save --ignore-scripts
- run: npm pack
- name: Upload npm package
uses: actions/upload-artifact@v3
with:
name: Package_Pack
path: "*.tgz"