-
Notifications
You must be signed in to change notification settings - Fork 38
219 lines (190 loc) · 7.74 KB
/
package-client.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
name: Package client
on:
pull_request:
paths:
- .github/workflows/package-client.yml
workflow_call:
inputs:
version:
description: The version to use
type: string
required: true
version_patch_run_id:
description: |
The run id where the version.patch artifact was uploaded.
If not provided, the workflow will generate the patch by itself.
type: string
required: true
workflow_dispatch:
inputs:
version:
description: The version to use (if not provided, will generate one from code space version)
type: string
required: false
# Set `concurrency` to prevent this workflow from being run on code that is not up-to-date on a PR (e.g. when making many push quickly on a PR).
# This behavior is only intended for a PR and not for merge commits on the main branch. Having the workflow run on each merge commit can be useful to spot regressions missed by previous checks.
# To distinguish between these cases, we use `head_ref` that is only defined on `pull-request` and fallback to `run_id` (this is a counter, so it's value is unique between workflow call).
concurrency:
group: package-client-${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
# We use the version 18.12 because the version >= 18.13 have some breaking changes on how they format the date.
# That would break our unit test if we don't update them.
node-version: 18.12.0
wasm-pack-version: 0.11.0
WINFSP_VERSION: 2.0.23075
permissions:
contents: read
jobs:
version:
if: ${{ inputs.version_patch_run_id == '' }}
uses: ./.github/workflows/_parse_version.yml
with:
version: ${{ inputs.version }}
webapp:
needs: version
# Always run the job if `version` job is skipped otherwise only if `version` job was successful.
if: ${{ inputs.version_patch_run_id != '' && always() || success() }}
runs-on: ubuntu-22.04
name: ⚡ Package web app
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # pin v4.1.1
timeout-minutes: 5
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # pin v4.0.2
with:
node-version: ${{ env.node-version }}
timeout-minutes: 2
- name: Download version.patch artifact
uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # pin v4.1.4
with:
name: version.patch
path: ${{ runner.temp }}/version.patch
run-id: ${{ inputs.version_patch_run_id || github.run_id }}
- name: Apply version.patch
run: git apply ${{ runner.temp }}/version.patch/version.patch
- name: Install dependencies
run: npm clean-install
working-directory: client
# Install syft
- uses: taiki-e/install-action@28b5a55da2f568d1d1e3f8d5ea6e7103685abc6a # pin v2.28.0
with:
tool: syft@0.84.0, wasm-pack@${{ env.wasm-pack-version }}
- name: Build web bindings
run: npm run build:release
working-directory: bindings/web
- name: Build web app
run: npm run web:release
working-directory: client
- name: Generate SBOM
run: syft packages --config=.syft.yaml --output=spdx-json=Parsec-SBOM-Web.spdx.json .
- uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # pin v4.3.1
with:
name: webapp
path: |
client/dist/
Parsec-SBOM-Web.spdx.json
if-no-files-found: error
electron:
needs: version
# Always run the job if `version` job is skipped otherwise only if `version` job was successful.
if: ${{ inputs.version_patch_run_id != '' && always() || success() }}
strategy:
fail-fast: false
matrix:
include:
- name: 🐧 Linux
platform: linux
os: ubuntu-20.04
paths: |
client/electron/dist/parsec-v3_*_*.snap
client/electron/dist/parsec-v3-*.AppImage
client/electron/dist/latest-linux.yml
- name: 🏁 Windows
platform: windows
os: windows-2022
paths: |
client/electron/dist/parsec-v3 Setup *.exe
client/electron/dist/parsec-v3 Setup *.exe.blockmap
client/electron/dist/latest.yml
- name: 🍎 macOS
platform: macos
os: macos-12
paths: |
client/electron/dist/parsec-v3-*.dmg
client/electron/dist/parsec-v3-*.dmg.blockmap
client/electron/dist/latest-mac.yml
name: "${{matrix.name }}: ⚡ Package electron"
runs-on: ${{ matrix.os }}
timeout-minutes: 60
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # pin v4.1.1
timeout-minutes: 5
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # pin v4.0.2
with:
node-version: ${{ env.node-version }}
timeout-minutes: 2
- name: Download version.patch artifact
uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # pin v4.1.4
with:
name: version.patch
path: ${{ runner.temp }}/version.patch
run-id: ${{ inputs.version_patch_run_id || github.run_id }}
- name: Apply version.patch
run: git apply ${{ runner.temp }}/version.patch/version.patch
- name: Linux > Install fuse devel
if: matrix.platform == 'linux'
run: |
until sudo apt-get install fuse3 libfuse3-dev; do
sleep 1;
echo "Retrying";
done
timeout-minutes: 1
- name: Linux > Install snapcraft
if: matrix.platform == 'linux'
uses: samuelmeuli/action-snapcraft@d33c176a9b784876d966f80fb1b461808edc0641 # pin v2.1.1
timeout-minutes: 1
- name: Linux > Setup LXD
if: matrix.platform == 'linux'
uses: canonical/setup-lxd@4e959f8e0d9c5feb27d44c5e4d9a330a782edee0 # pin v0.1.1
timeout-minutes: 2
- name: Windows > Install WinFSP
if: matrix.platform == 'windows'
shell: bash
run: |
set -eux
choco install winfsp -y --version=${{ env.WINFSP_VERSION }}
curl -L https://github.com/winfsp/winfsp/releases/download/v2.0/winfsp-tests-${{ env.WINFSP_VERSION }}.zip -o D:/a/_temp/winfsp-tests.zip
unzip D:/a/_temp/winfsp-tests.zip -d D:/a/_temp/
mv 'D:/a/_temp/winfsp-tests-x64.exe' 'C:/Program Files (x86)/WinFsp/bin/'
timeout-minutes: 1
- name: Install dependencies
shell: bash
run: |
npm clean-install
(cd electron && npm clean-install)
(cd ../bindings/electron && npm clean-install)
working-directory: client
timeout-minutes: 10
- name: Build Electron bindings
run: npm run build:release
working-directory: bindings/electron
# MacOS is really slow when build rust
timeout-minutes: 30
- name: Build Electron apps
run: npm run electron:release
working-directory: client
timeout-minutes: 5
# Install syft
- uses: taiki-e/install-action@28b5a55da2f568d1d1e3f8d5ea6e7103685abc6a # pin v2.28.0
with:
tool: syft@0.84.0
- name: Generate SBOM
run: syft packages --config=.syft.yaml --output=spdx-json=Parsec-SBOM-Electron-${{ matrix.platform }}.spdx.json .
- uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # pin v4.3.1
with:
name: ${{ runner.os }}-${{ runner.arch }}-electron-app
path: |
${{ matrix.paths }}
Parsec-SBOM-Electron-${{ matrix.platform }}.spdx.json
if-no-files-found: error
timeout-minutes: 10