-
Notifications
You must be signed in to change notification settings - Fork 7
253 lines (222 loc) · 8.45 KB
/
Copy pathbuild-artifacts.yml
File metadata and controls
253 lines (222 loc) · 8.45 KB
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
name: Build artifacts
on:
workflow_call:
inputs:
plan:
required: false
type: string
build-kind:
required: false
type: string
default: ""
cargo-profile:
required: false
type: string
default: release
vsix-profile:
required: false
type: string
default: release
permissions:
contents: read
jobs:
native:
name: ${{ matrix.rust-target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-22.04
rust-target: x86_64-unknown-linux-gnu
rustup-target: x86_64-unknown-linux-gnu
vsix-target: linux-x64
zigbuild: true
- os: ubuntu-22.04
rust-target: aarch64-unknown-linux-gnu
rustup-target: aarch64-unknown-linux-gnu
vsix-target: linux-arm64
zigbuild: true
- os: ubuntu-22.04
rust-target: x86_64-unknown-linux-musl
rustup-target: x86_64-unknown-linux-musl
vsix-target: alpine-x64
zigbuild: true
- os: ubuntu-22.04
rust-target: aarch64-unknown-linux-musl
rustup-target: aarch64-unknown-linux-musl
vsix-target: alpine-arm64
zigbuild: true
- os: macos-15
rust-target: aarch64-apple-darwin
rustup-target: aarch64-apple-darwin
vsix-target: darwin-arm64
zigbuild: false
- os: windows-latest
rust-target: x86_64-pc-windows-msvc
rustup-target: x86_64-pc-windows-msvc
vsix-target: win32-x64
zigbuild: false
env:
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.rust-target == 'aarch64-apple-darwin' && '11.0' || '' }}
CARGO_PROFILE_RELEASE_INCREMENTAL: "false"
steps:
- uses: actions/checkout@v4
- name: Setup Rust
uses: ./.github/actions/setup-rust
with:
targets: ${{ matrix.rustup-target }}
- name: Setup cargo-zigbuild
if: matrix.zigbuild
shell: bash
run: |
set -euo pipefail
python3 -m pip install --user --upgrade pip
python3 -m pip install --user cargo-zigbuild
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
- name: Setup sccache
uses: ./.github/actions/setup-sccache
with:
cmake-launcher: "true"
- name: Rust Cache
uses: Swatinem/rust-cache@v2
continue-on-error: true
with:
shared-key: release-${{ runner.os }}-${{ matrix.rust-target }}
key: native-${{ hashFiles('Cargo.toml', 'Cargo.lock', 'build.rs', 'rust-toolchain.toml', 'src/**', 'crates/**', 'xtask/**', 'scripts/build-artifact.sh') }}
cache-workspace-crates: true
cache-on-failure: true
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
cache-dependency-path: editors/vscode/package-lock.json
- name: Install JS dependencies
working-directory: editors/vscode
run: npm ci
- name: Set VSIX build metadata
shell: bash
run: |
echo "VIDE_EXTENSION_BUILD_KIND=${{ inputs.build-kind || (inputs.plan && fromJson(inputs.plan).announcement_is_prerelease && 'beta' || 'stable') }}" >> "$GITHUB_ENV"
echo "VIDE_EXTENSION_COMMIT_HASH=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV"
echo "VIDE_EXTENSION_BUILD_DATE=$(date -u +'%Y%m%dT%H%M%SZ')" >> "$GITHUB_ENV"
- name: Build binary archive and stage VSIX server
shell: bash
run: scripts/build-artifact.sh "${{ matrix.rust-target }}" "${{ matrix.vsix-target }}" "${{ inputs.cargo-profile }}"
- name: Build VSIX
working-directory: editors/vscode
run: npm run package:vsix -- --target ${{ matrix.vsix-target }} --profile ${{ inputs.vsix-profile }} --server=prebuilt
- name: Upload cargo-dist artifacts
uses: actions/upload-artifact@v4
with:
name: artifacts-${{ matrix.rust-target }}
path: |
target/distrib/vide-${{ matrix.rust-target }}${{ inputs.cargo-profile == 'debug' && '-debug' || '' }}.*
if-no-files-found: error
- name: Upload VSIX artifact
uses: actions/upload-artifact@v4
with:
name: vsix-${{ matrix.vsix-target }}
path: editors/vscode/vide-vscode-${{ matrix.vsix-target }}${{ inputs.vsix-profile == 'debug' && '-debug' || '' }}.vsix
if-no-files-found: error
source-and-checksums:
name: source tarball and unified checksums
runs-on: ubuntu-latest
needs: native
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download binary artifacts
uses: actions/download-artifact@v4
with:
pattern: artifacts-*
path: target/distrib
merge-multiple: true
- name: Build source tarball and unified checksum manifest
shell: bash
run: |
set -euo pipefail
mkdir -p target/distrib
git archive --format=tar.gz --prefix=vide-source/ HEAD > target/distrib/source.tar.gz
(
cd target/distrib
sha256sum source.tar.gz > source.tar.gz.sha256
cat *.sha256 | sort -k2 > sha256.sum
ls -lh
)
- name: Upload source and checksum artifacts
uses: actions/upload-artifact@v4
with:
name: artifacts-source
path: |
target/distrib/source.tar.gz
target/distrib/source.tar.gz.sha256
target/distrib/sha256.sum
if-no-files-found: error
web:
name: web VSIX
runs-on: ubuntu-latest
defaults:
run:
working-directory: editors/vscode
steps:
- uses: actions/checkout@v4
- name: Restore playground WASM cache
id: playground-wasm-cache
uses: actions/cache/restore@v4
with:
path: playground/public/wasm
key: playground-wasm-${{ runner.os }}-${{ hashFiles('Cargo.toml', 'Cargo.lock', 'build.rs', 'rust-toolchain.toml', 'src/**', 'crates/**', 'playground/scripts/build-vide-wasm.mjs', 'playground/scripts/script-utils.mjs', '.github/actions/setup-emscripten/**', '.github/actions/setup-rust/**') }}
- name: Setup Rust
if: steps.playground-wasm-cache.outputs.cache-hit != 'true'
uses: ./.github/actions/setup-rust
- name: Setup sccache
if: steps.playground-wasm-cache.outputs.cache-hit != 'true'
uses: ./.github/actions/setup-sccache
with:
cmake-launcher: "true"
- name: Install Emscripten SDK
if: steps.playground-wasm-cache.outputs.cache-hit != 'true'
uses: ./.github/actions/setup-emscripten
with:
version: 5.0.2
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
cache-dependency-path: editors/vscode/package-lock.json
- name: Install JS dependencies
run: npm ci
- name: Build playground WASM
if: steps.playground-wasm-cache.outputs.cache-hit != 'true'
working-directory: playground
run: |
source "${EMSDK}/emsdk_env.sh"
npm run build:wasm
- name: Save playground WASM cache
if: steps.playground-wasm-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
continue-on-error: true
with:
path: playground/public/wasm
key: ${{ steps.playground-wasm-cache.outputs.cache-primary-key }}
- name: Set VSIX build metadata
working-directory: .
shell: bash
run: |
echo "VIDE_EXTENSION_BUILD_KIND=${{ inputs.build-kind || (inputs.plan && fromJson(inputs.plan).announcement_is_prerelease && 'beta' || 'stable') }}" >> "$GITHUB_ENV"
echo "VIDE_EXTENSION_COMMIT_HASH=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV"
echo "VIDE_EXTENSION_BUILD_DATE=$(date -u +'%Y%m%dT%H%M%SZ')" >> "$GITHUB_ENV"
- name: Compile web extension
run: npm run compile:web
- name: Build web VSIX
run: npx tsx scripts/package.ts --target web --profile ${{ inputs.vsix-profile }}
- name: Upload web VSIX artifact
uses: actions/upload-artifact@v4
with:
name: vsix-web
path: editors/vscode/vide-vscode-web${{ inputs.vsix-profile == 'debug' && '-debug' || '' }}.vsix
if-no-files-found: error