1
1
name : CI
2
2
3
- on : [push, pull_request]
3
+ on :
4
+ push :
5
+ branches :
6
+ - ' **'
7
+ tags-ignore :
8
+ - ' **'
9
+ pull_request :
10
+ branches :
11
+ - ' **'
4
12
5
13
jobs :
6
14
lint_and_build :
15
+ if : " !contains(github.event.head_commit.message, 'skip ci')"
16
+
7
17
strategy :
8
18
fail-fast : false
9
19
matrix :
60
70
path : ~/.cargo/git
61
71
key : stable-${{ matrix.os }}gnu-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }}
62
72
63
- - name : Cache cargo build
64
- uses : actions/cache@v1
65
- with :
66
- path : target
67
- key : stable-${{ matrix.os }}gnu-cargo-build-trimmed-${{ hashFiles('**/Cargo.lock') }}
68
-
69
73
- name : Cache NPM dependencies
70
74
uses : actions/cache@v1
71
75
with :
@@ -88,16 +92,11 @@ jobs:
88
92
- name : Run build
89
93
run : npx lerna run build --stream -- --platform
90
94
91
- - name : Upload crc32 artifact
92
- uses : actions/upload-artifact@v1
95
+ - name : Upload artifact
96
+ uses : actions/upload-artifact@v2
93
97
with :
94
- name : crc32.${{ env.PLATFORM_NAME }}.node
95
- path : packages/crc32/crc32.${{ env.PLATFORM_NAME }}.node
96
-
97
- - name : Clear the cargo caches
98
- run : |
99
- cargo install cargo-cache --no-default-features --features ci-autoclean
100
- cargo-cache
98
+ name : bindings-${{ env.PLATFORM_NAME }}
99
+ path : packages/*/*.${{ env.PLATFORM_NAME }}.node
101
100
102
101
test_binding :
103
102
name : Test bindings on ${{ matrix.os }} - node@${{ matrix.node }}
@@ -106,7 +105,7 @@ jobs:
106
105
fail-fast : false
107
106
matrix :
108
107
os : [ubuntu-latest, macos-latest, windows-latest]
109
- node : ['10', '12', '14']
108
+ node : ['10', '12', '13', ' 14']
110
109
runs-on : ${{ matrix.os }}
111
110
112
111
steps :
@@ -123,22 +122,81 @@ jobs:
123
122
echo "::set-env name=PLATFORM_NAME::$NODE_PLATFORM_NAME"
124
123
shell : bash
125
124
125
+ # Do not cache node_modules, or yarn workspace links broken
126
+ - name : ' Install dependencies'
127
+ run : yarn install --frozen-lockfile --registry https://registry.npmjs.org
128
+
129
+ - name : Download artifacts
130
+ uses : actions/download-artifact@v2
131
+ with :
132
+ name : bindings-${{ env.PLATFORM_NAME }}
133
+ path : artifacts
134
+
135
+ - name : Move artifacts
136
+ run : node scripts/mv-artifacts.js
137
+ shell : bash
138
+
139
+ - name : Test bindings
140
+ run : yarn test
141
+
142
+ - name : Build TypeScript
143
+ run : yarn build:ts
144
+
145
+ - name : List packages
146
+ run : ls -R packages
147
+ shell : bash
148
+
149
+ - name : Run benchmark
150
+ run : yarn bench
151
+
152
+ publish :
153
+ name : Publish
154
+ if : " startsWith(github.event.head_commit.message, 'chore(release): publish')"
155
+ runs-on : ubuntu-latest
156
+ needs : test_binding
157
+
158
+ steps :
159
+ - uses : actions/checkout@v2
160
+
161
+ - name : Setup node
162
+ uses : actions/setup-node@v1
163
+ with :
164
+ node-version : 12
165
+
126
166
- name : Cache NPM dependencies
127
167
uses : actions/cache@v1
128
168
with :
129
169
path : node_modules
130
- key : npm-cache-${{ matrix.os }} -${{ hashFiles('yarn.lock') }}
170
+ key : npm-cache-ubuntu-latest -${{ hashFiles('yarn.lock') }}
131
171
restore-keys : |
132
172
npm-cache-
133
173
134
174
- name : ' Install dependencies'
135
175
run : yarn install --frozen-lockfile --registry https://registry.npmjs.org
136
176
137
- - name : Download crc32 artifact
138
- uses : actions/download-artifact@v1
177
+ - name : Download all artifacts
178
+ uses : actions/download-artifact@v2
139
179
with :
140
- name : crc32.${{ env.PLATFORM_NAME }}.node
141
- path : packages/crc32
180
+ path : artifacts
142
181
143
- - name : Test bindings
144
- run : yarn test
182
+ - name : List artifacts
183
+ run : ls -R artifacts
184
+ shell : bash
185
+
186
+ - name : Move artifacts
187
+ run : node scripts/mv-artifacts.js
188
+ env :
189
+ MOVE_TARGET : all
190
+
191
+ - name : Build TypeScript
192
+ run : yarn build:ts
193
+
194
+ - name : List packages
195
+ run : ls -R packages
196
+ shell : bash
197
+ - name : Lerna publish
198
+ run : |
199
+ echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
200
+ npx lerna publish from-package --no-verify-access --yes
201
+ env :
202
+ NPM_TOKEN : ${{ secrets.NPM_TOKEN }}
0 commit comments