@@ -15,12 +15,12 @@ jobs:
15
15
with :
16
16
fetch-depth : 0
17
17
- run : GH_CREATE_PRE_RELEASE=true ./script/ci/release.sh
18
- if : github.ref == 'refs/heads/master' && env.ACT != ' true' && runner.os == 'Linux'
18
+ if : github.ref == 'refs/heads/master' && env.ACT != true && runner.os == 'Linux'
19
19
env :
20
20
GITHUB_TOKEN : ${{ github.token }}
21
-
21
+
22
22
prebuild :
23
- needs : [ create_pre_release ]
23
+ needs : [create_pre_release]
24
24
runs-on : ${{ matrix.os }}
25
25
defaults :
26
26
run :
@@ -30,11 +30,31 @@ jobs:
30
30
matrix :
31
31
node-version : [20]
32
32
os : [
33
- macos-14,
34
- macos-12,
35
- ubuntu-latest,
36
- windows-latest
33
+ macos-12,
34
+ ubuntu-latest,
35
+ windows-latest,
37
36
]
37
+ docker : [false]
38
+ alpine : [false]
39
+ arch : ['amd64']
40
+ include :
41
+ - os : ubuntu-latest
42
+ docker : true
43
+ alpine : false
44
+ arch : arm64
45
+ - os : ubuntu-latest
46
+ docker : true
47
+ alpine : true
48
+ arch : arm64
49
+ - os : ubuntu-latest
50
+ docker : true
51
+ alpine : true
52
+ arch : amd64
53
+ - os : macos-14
54
+ docker : false
55
+ alpine : false
56
+ arch : arm64
57
+ name : Prebuild ${{ matrix.docker == true && matrix.alpine == true && 'linux-musl' || matrix.docker == true && matrix.alpine == false && 'linux' || matrix.os }}-${{ matrix.arch }}
38
58
39
59
env :
40
60
NODE_VERSION : ${{ matrix.node-version }}
43
63
- uses : actions/checkout@v4
44
64
with :
45
65
fetch-depth : 0
46
-
66
+
47
67
- name : Use Node.js ${{ env.NODE_VERSION }}
48
68
uses : actions/setup-node@v4
49
69
with :
@@ -52,27 +72,32 @@ jobs:
52
72
- if : runner.os == 'Windows'
53
73
run : echo "ONLY_DOWNLOAD_PACT_FOR_WINDOWS=true" >> $GITHUB_ENV
54
74
55
- - run : ./script/ci/prebuild.sh
56
-
57
75
- name : Set up QEMU
58
- if : runner.os == 'Linux'
76
+ if : ${{ matrix.docker == true && matrix.arch == 'arm64' }}
59
77
uses : docker/setup-qemu-action@v3
60
- - name : Set up Docker Buildx
61
- if : runner.os == 'Linux'
62
- uses : docker/setup-buildx-action@v3
63
- - if : runner.os == 'Linux'
64
- name : prebuild arm64
65
- run : docker run -v $PWD:/home --platform linux/arm64 --rm node:20 bin/bash -c 'cd /home && /home/script/ci/prebuild.sh'
78
+ - if : ${{ matrix.docker == true && matrix.alpine == true }}
79
+ name : prebuild linux ${{ matrix.arch }} musl
80
+ run : docker run -v $PWD:/home --platform linux/${{ matrix.arch }} --rm node:20-alpine bin/sh -c 'apk add bash && cd /home && bash -c "/home/script/ci/prebuild-alpine.sh" && rm -rf ffi node_modules'
81
+
82
+ - if : ${{ matrix.docker == true && matrix.alpine != true }}
83
+ name : prebuild linux ${{ matrix.arch }}
84
+ run : docker run -v $PWD:/home --platform linux/${{ matrix.arch }} --rm node:20 bin/bash -c 'cd /home && /home/script/ci/prebuild.sh && rm -rf ffi node_modules'
85
+
86
+ - run : sudo chown -R $(id -u):$(id -g) prebuilds
87
+ if : ${{ matrix.docker == true }}
88
+
89
+ - run : ./script/ci/prebuild.sh
90
+ if : ${{ matrix.docker != true }}
66
91
67
92
- name : Upload prebuild for ${{ runner.os }}-${{ runner.arch }}
68
93
uses : actions/upload-artifact@v3
69
94
with :
70
95
path : prebuilds/*.tar.gz
71
-
96
+
72
97
- run : GH_PRE_RELEASE_UPLOAD=true ./script/ci/release.sh
73
- if : github.ref == 'refs/heads/master' && env.ACT != ' true'
98
+ if : github.ref == 'refs/heads/master' && env.ACT != true
74
99
env :
75
- GITHUB_TOKEN : ${{ github.token }}
100
+ GITHUB_TOKEN : ${{ github.token }}
76
101
77
102
test :
78
103
runs-on : ${{ matrix.os }}
@@ -83,13 +108,53 @@ jobs:
83
108
strategy :
84
109
fail-fast : false
85
110
matrix :
86
- node-version : [16,18,20]
87
- os : [
88
- macos-14,
89
- macos-12,
90
- ubuntu-latest,
91
- windows-latest
92
- ]
111
+ node-version : [16, 18, 20, 22]
112
+ os : [macos-14, macos-12, ubuntu-latest, windows-latest]
113
+ docker : [false]
114
+ include :
115
+ - os : ubuntu-latest
116
+ docker : true
117
+ alpine : false
118
+ arch : arm64
119
+ node-version : 22
120
+ - os : ubuntu-latest
121
+ docker : true
122
+ alpine : true
123
+ arch : arm64
124
+ node-version : 22
125
+ - os : ubuntu-latest
126
+ docker : true
127
+ alpine : true
128
+ arch : amd64
129
+ node-version : 22
130
+ - os : ubuntu-latest
131
+ docker : true
132
+ alpine : false
133
+ arch : arm64
134
+ node-version : 20
135
+ - os : ubuntu-latest
136
+ docker : true
137
+ alpine : true
138
+ arch : arm64
139
+ node-version : 20
140
+ - os : ubuntu-latest
141
+ docker : true
142
+ alpine : true
143
+ arch : amd64
144
+ node-version : 20
145
+ - os : ubuntu-latest
146
+ docker : true
147
+ alpine : true
148
+ arch : arm64
149
+ node-version : 18
150
+ - os : ubuntu-latest
151
+ docker : true
152
+ alpine : true
153
+ arch : amd64
154
+ node-version : 18
155
+
156
+ name : Test ${{ matrix.docker == true && matrix.alpine == true && 'linux-musl' || matrix.docker == true && matrix.alpine == false && 'linux' || matrix.os }}-${{ matrix.arch }}-node-${{ matrix.node-version }}
157
+
93
158
env :
94
159
NODE_VERSION : ${{ matrix.node-version }}
95
160
LOG_LEVEL : debug
@@ -109,22 +174,31 @@ jobs:
109
174
110
175
- if : runner.os == 'Windows'
111
176
run : echo "ONLY_DOWNLOAD_PACT_FOR_WINDOWS=true" >> $GITHUB_ENV
112
- - run : LOG_LEVEL=debug ./script/ci/unpack-and-test.sh
177
+ - if : matrix.os == 'macos-14'
178
+ run : brew install protobuf
113
179
180
+ - run : LOG_LEVEL=debug ./script/ci/unpack-and-test.sh
181
+ if : ${{ matrix.docker != true }}
114
182
115
183
- name : Set up QEMU
116
- if : runner.os == 'Linux'
184
+ if : ${{ matrix.docker == true && matrix.arch == 'arm64' }}
117
185
uses : docker/setup-qemu-action@v3
118
- - name : Set up Docker Buildx
119
- if : runner.os == 'Linux'
120
- uses : docker/setup-buildx-action@v3
121
- - if : runner.os == 'Linux'
186
+
187
+ - if : ${{ matrix.docker == true && matrix.alpine != true && matrix.arch == 'arm64' }}
122
188
name : test arm64
123
- run : docker run -v $PWD:/home --platform linux/arm64 --rm node:20 bin/bash -c 'cd /home && npm test'
189
+ run : docker run -v $PWD:/home --platform linux/${{ matrix.arch }} --rm node:${{ matrix.node-version }} bin/bash -c 'cd /home && /home/script/ci/unpack-and-test.sh'
190
+
191
+ - if : ${{ matrix.docker == true && matrix.alpine == true && matrix.arch == 'amd64' }}
192
+ name : test linux amd64 musl
193
+ run : docker run -v $PWD:/home --platform linux/${{ matrix.arch }} --rm node:${{ matrix.node-version }}-alpine bin/sh -c 'apk add bash curl gcompat file && cd /home && /home/script/ci/unpack-and-test.sh'
194
+
195
+ - if : ${{ matrix.docker == true && matrix.alpine == true && matrix.arch == 'arm64' }}
196
+ name : test linux arm64 musl
197
+ run : docker run -v $PWD:/home --platform linux/${{ matrix.arch }} --rm node:${{ matrix.node-version }}-alpine bin/sh -c 'apk add bash curl file protoc protobuf-dev && cd /home && /home/script/ci/unpack-and-test.sh'
124
198
125
199
release_dry_run :
126
200
runs-on : ubuntu-latest
127
- needs : [ create_pre_release, prebuild ]
201
+ needs : [create_pre_release, prebuild]
128
202
if : github.ref == 'refs/heads/master'
129
203
130
204
env :
@@ -141,7 +215,7 @@ jobs:
141
215
node-version : ${{ env.NODE_VERSION }}
142
216
registry-url : ' https://registry.npmjs.org'
143
217
144
- - name : " release - dry run: ${{ env.DRY_RUN }}"
218
+ - name : ' release - dry run: ${{ env.DRY_RUN }}'
145
219
id : publish
146
220
run : script/ci/release.sh
147
221
env :
0 commit comments