-
Notifications
You must be signed in to change notification settings - Fork 21
269 lines (214 loc) · 7.74 KB
/
verify.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
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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
name: verify
on:
pull_request:
env:
PKG_NAME: didcomm
PKG_NAME_JS_TMP: didcomm-js
PKG_NAME_NODEJS: didcomm-node
jobs:
release-ready:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'stable'
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v3
- name: Get current version
id: current_version
run: |
version="$(cargo -q metadata --no-deps \
| jq -r '.packages[] | select(.name == "${{ env.PKG_NAME }}") | .version')"
echo "$version"
echo "current_version=$version" >> $GITHUB_OUTPUT
cd wasm
version="$(cargo -q metadata --no-deps \
| jq -r '.packages[] | select(.name == "${{ env.PKG_NAME_JS_TMP }}") | .version')"
echo "$version"
echo "current_wasm_version=$version" >> $GITHUB_OUTPUT
- name: Check version format
run: |
# verify the version has "MAJOR.MINOR.PATCH" parts only
echo "${{ steps.current_version.outputs.current_version }}" | grep -e '^[0-9]\+\.[0-9]\+\.[0-9]\+$'
# TODO improve (DRY): copy-paste from release.yml
- name: Get release info
id: release_info
run: |
release_info="$(curl -s https://api.github.com/repos/${{ github.repository }}/releases \
| jq '.[] | select(.name == "v${{ steps.current_version.outputs.current_version }}")')"
echo "release_info=$release_info" >> $GITHUB_OUTPUT
echo "$release_info"
- name: check version bumped
# TODO check if greater than latest tag / release (?)
if: steps.release_info.outputs.release_info
run: exit 1
- name: check rust and wasm versions are the same
if: steps.current_version.outputs.current_version != steps.current_version.outputs.current_wasm_version
run: exit 1
- name: check it can be packaged (crate)
run: |
cargo package
# TODO verify that it's not more than crates.io limit (10 MB)
ls -la target/package
cargo package --list
- name: check it can be packaged (npm)
run: |
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
# verify bundler target
make -C wasm build install
# verify nodejs target
WASM_TARGET=nodejs PKG_NAME=${{ env.PKG_NAME_NODEJS }} make -C wasm build install
verify:
strategy:
matrix:
os: [ macos-latest, windows-latest, ubuntu-latest ]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set rustup profile & toolchain
run: |
rustup set profile minimal
rustup toolchain install stable
- name: Get timestamp for cache
id: date
run: echo "yearmo=$(date +%Y%m)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}-${{steps.date.outputs.yearmo}}
- name: Cargo fmt
# TODO enable that once https://github.com/rust-lang/rustfmt/issues/4477
# is resolved
if: runner.os != 'Windows'
run: cargo fmt --all -- --check
- name: Debug build
run: cargo build --verbose
- name: Test
run: cargo test --verbose
verify-wasm:
strategy:
matrix:
os: [ macos-latest, windows-latest, ubuntu-latest ]
node: [ 14, 16 ]
fail-fast: false
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
working-directory: wasm
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set rustup profile & toolchain
run: |
rustup set profile minimal
rustup toolchain install stable
- name: Get timestamp for cache
id: date
run: echo "yearmo=$(date +%Y%m)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}-${{steps.date.outputs.yearmo}}
- name: Cargo fmt
# TODO enable that once https://github.com/rust-lang/rustfmt/issues/4477
# is resolved
if: runner.os != 'Windows'
run: cargo fmt --all -- --check
- name: Cargo checks
run: cargo check --all-targets
# TODO caching, makes sense for demo and tests-js where lock files are presented
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- name: Install wasm-pack
if: runner.os != 'Windows'
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: List npm version
run: npm --version
- name: Upgrade node-gyp
if: runner.os == 'Windows'
run: npm install -g node-gyp@latest
- name: Install wasm-pack Windows
if: runner.os == 'Windows'
run: npm install -g wasm-pack@0.12.1
- name: Build pkg (bundler)
run: make
- name: Install tests-js (bundler)
run: cd tests-js && npm install
- name: Lint tests-js
run: cd tests-js && npm run check
- name: Test tests-js (bundler)
if: false # TODO that check is not supported yet for bundler build
run: cd tests-js && npm test
- name: Test tests-js in browser (bundler)
if: false # TODO that check is not supported yet for bundler build
run: cd tests-js && npm run test-puppeteer
- name: Install demo (bundler)
run: cd demo && npm install
- name: Lint demo
run: cd demo && npm run check
- name: Test demo (bundler)
if: false # TODO that check is not supported yet for bundler build
run: cd demo && npm run start
- name: Build pkg (nodejs)
run: WASM_TARGET=nodejs make
- name: Install tests-js (nodejs)
run: cd tests-js && rm -rf node_modules && npm install
- name: Test tests-js (nodejs)
run: cd tests-js && npm test
- name: Test tests-js in browser (nodejs)
run: cd tests-js && npm run test-puppeteer
- name: Install demo (nodejs)
run: cd demo && rm -rf node_modules && npm install
- name: Test demo (nodejs)
run: cd demo && npm run start
verify-uniffi:
strategy:
matrix:
os: [ macos-latest, windows-latest, ubuntu-latest ]
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
working-directory: uniffi
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set rustup profile & toolchain
run: |
rustup set profile minimal
rustup toolchain install stable
- name: Get timestamp for cache
id: date
run: echo "yearmo=$(date +%Y%m)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}-${{steps.date.outputs.yearmo}}
- name: Cargo fmt
# TODO enable that once https://github.com/rust-lang/rustfmt/issues/4477
# is resolved
if: runner.os != 'Windows'
run: cargo fmt --all -- --check
- name: Debug build
run: cargo build --verbose
- name: Test
run: cargo test --verbose