-
Notifications
You must be signed in to change notification settings - Fork 2
307 lines (267 loc) · 9.33 KB
/
ci.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
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
name: ci
on:
push:
tags:
- "v*.*.*"
branches: ["main"]
pull_request:
branches: ["main"]
concurrency:
group: ${{ github.ref }}-ci
cancel-in-progress: true
jobs:
windows-build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: volta-cli/action@v3
# This is required cause the endpoint tauri is using to download MicrosoftEdgeWebView2RuntimeInstallerX64.exe
# is not working.
- name: Install dependencies
run: |
$URL="https://static-website20200704084657677400000001.s3.eu-west-1.amazonaws.com/MicrosoftEdgeWebView2RuntimeInstallerX64.exe"
$Path="$env:LOCALAPPDATA\tauri\Webview2OfflineInstaller\aa5fd9b3-dc11-4cbc-8343-a50f57b311e1\x64\MicrosoftEdgeWebView2RuntimeInstaller.exe"
New-Item -Path "$env:LOCALAPPDATA\tauri\Webview2OfflineInstaller\aa5fd9b3-dc11-4cbc-8343-a50f57b311e1\x64\" -ItemType Directory
Invoke-WebRequest -URI $URL -OutFile $Path
- name: Restore npm cache
uses: actions/cache/restore@v3
id: restore-npm-cache
with:
path: "**/node_modules"
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}-v1
- name: Install npm dependencies
run: |
npm install -g yarn
yarn install --network-timeout 100000
- name: Restore cargo cache
uses: actions/cache/restore@v3
id: restore-cargo-cache
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
backend/target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-v1
- name: Test
run: |
mkdir frontend/dist
yarn test
- name: Bundle
run: yarn tauri build -b msi
- name: Build release artifact
if: startsWith(github.ref, 'refs/tags/v')
run: |
# clean up cached bundle
yarn rimraf backend/target/release/bundle/
# build
yarn tauri build
env:
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
GRAPHITE_TOKEN: ${{ secrets.GRAPHITE_TOKEN }}
- uses: actions/upload-artifact@v3
with:
name: windows-artifacts
path: backend/target/release/bundle/*
retention-days: 1
- name: Update manifest
run: |
python ./scripts/update-manifest.py --target windows
# remove unused manifests
rm manifests/update-linux.json
rm manifests/update-darwin.json
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/v')
with:
files: |
manifests/update-windows.json
backend/target/release/Insulator*.exe
backend/target/release/bundle/msi/Insulator*.msi
backend/target/release/bundle/msi/Insulator*.msi.zip
- name: Save npm cache
uses: actions/cache/save@v3
if: always()
with:
path: "**/node_modules"
key: ${{ steps.restore-npm-cache.outputs.cache-primary-key }}
- name: Save cargo cache
uses: actions/cache/save@v3
if: always()
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
backend/target/
key: ${{ steps.restore-cargo-cache.outputs.cache-primary-key }}
macos-build:
runs-on: macos-12
steps:
- uses: actions/checkout@v3
- uses: volta-cli/action@v3
- name: Restore npm cache
uses: actions/cache/restore@v3
id: restore-npm-cache
with:
path: "**/node_modules"
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}-v1
- name: Install npm dependencies
run: |
npm install -g yarn
yarn install --network-timeout 100000
- name: Restore cargo cache
uses: actions/cache/restore@v3
id: restore-cargo-cache
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
backend/target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-v1
- name: Test
run: |
# clean up cached bundle
yarn rimraf backend/target/release/bundle/
mkdir frontend/dist
yarn test
- name: Bundle
run: yarn tauri build -b dmg
- name: Build release artifact
if: startsWith(github.ref, 'refs/tags/v')
run: |
# clean up cached bundle
yarn rimraf backend/target/release/bundle/
# build
yarn tauri build
env:
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
GRAPHITE_TOKEN: ${{ secrets.GRAPHITE_TOKEN }}
- uses: actions/upload-artifact@v3
with:
name: mac-os-artifacts
path: backend/target/release/bundle/*
retention-days: 1
- name: Update manifest
run: |
python3 ./scripts/update-manifest.py --target darwin
# remove unused manifests
rm manifests/update-linux.json manifests/update-windows.json
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/v')
with:
files: |
manifests/update-darwin.json
backend/target/release/bundle/dmg/*.dmg
backend/target/release/bundle/macos/Insulator*.app.tar.gz
- name: Save npm cache
uses: actions/cache/save@v3
if: always()
with:
path: "**/node_modules"
key: ${{ steps.restore-npm-cache.outputs.cache-primary-key }}
- name: Save cargo cache
uses: actions/cache/save@v3
if: always()
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
backend/target/
key: ${{ steps.restore-cargo-cache.outputs.cache-primary-key }}
ubuntu-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: volta-cli/action@v3
- name: Restore npm cache
uses: actions/cache/restore@v3
id: restore-npm-cache
with:
path: "**/node_modules"
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}-v1
- name: Install npm dependencies
run: |
npm install -g yarn
yarn install --network-timeout 100000
- name: Install Ubuntu dependencies
run: |
sudo apt update -y
sudo apt install libwebkit2gtk-4.0-dev libdbus-1-dev pkg-config libgtk-3-dev libsoup2.4-dev \
build-essential curl wget libsasl2-dev libayatana-appindicator3-dev librsvg2-dev
- name: Restore cargo cache
uses: actions/cache/restore@v3
id: restore-cargo-cache
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
backend/target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-v1
- name: Install tarpaulin
run: cargo install cargo-tarpaulin || true
- name: Tests and coverage
run: |
mkdir frontend/dist
yarn lint:check
# run unit and integration tests
yarn coverage
# upload coverage
bash <(curl -s https://codecov.io/bash)
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Bundle
run: yarn tauri build -b deb appimage
- name: Build release artifact
if: startsWith(github.ref, 'refs/tags/v')
run: |
# clean up cached bundle
yarn rimraf backend/target/release/bundle/
# build
yarn tauri build
env:
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
GRAPHITE_TOKEN: ${{ secrets.GRAPHITE_TOKEN }}
- uses: actions/upload-artifact@v3
with:
name: ubuntu-artifacts
path: backend/target/release/bundle/*
retention-days: 1
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/v')
with:
files: |
manifests/update-linux.json
backend/target/release/bundle/deb/insulator-*_amd64.deb
backend/target/release/bundle/appimage/insulator-*_amd64.AppImage
backend/target/release/bundle/appimage/insulator-*_amd64.AppImage.tar.gz
- name: Save npm cache
uses: actions/cache/save@v3
if: always()
with:
path: "**/node_modules"
key: ${{ steps.restore-npm-cache.outputs.cache-primary-key }}
- name: Save cargo cache
uses: actions/cache/save@v3
if: always()
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
backend/target/
key: ${{ steps.restore-cargo-cache.outputs.cache-primary-key }}