Skip to content

Commit 937c690

Browse files
authored
ci: route releases through cargo-dist (#272)
2 parents 415346f + d13be14 commit 937c690

17 files changed

Lines changed: 827 additions & 1008 deletions

File tree

.github/scripts/ci-plan.mjs

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,6 @@ const DEV_PACKAGE_TARGETS = new Map([
1212
["darwin-arm64", { os: "macos-15", target: "darwin-arm64" }],
1313
]);
1414

15-
const DEV_ALPINE_TARGETS = new Map([
16-
[
17-
"alpine-x64",
18-
{
19-
target: "alpine-x64",
20-
image: "ghcr.io/blackdex/rust-musl:x86_64-musl-nightly",
21-
"rust-target": "x86_64-unknown-linux-musl",
22-
},
23-
],
24-
]);
25-
2615
export async function planCi({ github, context, core, filters }) {
2716
const eventName = context.eventName;
2817
const workflowDispatch = eventName === "workflow_dispatch";
@@ -56,37 +45,25 @@ export async function planCi({ github, context, core, filters }) {
5645

5746
let runDevPackage = false;
5847
let runDevWebPackage = false;
59-
let runDevAlpinePackage = false;
6048
let devPackageMatrix = [DEV_PACKAGE_TARGETS.get("linux-x64")];
61-
let devAlpineMatrix = [DEV_ALPINE_TARGETS.get("alpine-x64")];
6249

6350
if (!pullRequest) {
6451
if (workflowDispatch || packageChanged) {
6552
runDevPackage = true;
6653
runDevWebPackage = true;
67-
runDevAlpinePackage = true;
6854
devPackageMatrix = [...DEV_PACKAGE_TARGETS.values()];
69-
devAlpineMatrix = [...DEV_ALPINE_TARGETS.values()];
7055
} else {
7156
const failedDevPackageTargets = failedTargets(
7257
failedJobNames,
7358
DEV_PACKAGE_TARGETS,
7459
);
75-
const failedDevAlpineTargets = failedTargets(
76-
failedJobNames,
77-
DEV_ALPINE_TARGETS,
78-
);
7960

8061
runDevPackage = failedDevPackageTargets.length > 0;
8162
runDevWebPackage = failedJobNames.includes("Dev Package (web)");
82-
runDevAlpinePackage = failedDevAlpineTargets.length > 0;
8363

8464
if (runDevPackage) {
8565
devPackageMatrix = failedDevPackageTargets;
8666
}
87-
if (runDevAlpinePackage) {
88-
devAlpineMatrix = failedDevAlpineTargets;
89-
}
9067
}
9168
}
9269

@@ -109,8 +86,6 @@ export async function planCi({ github, context, core, filters }) {
10986
run_dev_package: runDevPackage,
11087
dev_package_matrix: devPackageMatrix,
11188
run_dev_web_package: runDevWebPackage,
112-
run_dev_alpine_package: runDevAlpinePackage,
113-
dev_alpine_matrix: devAlpineMatrix,
11489
};
11590
}
11691

Lines changed: 241 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,241 @@
1+
name: Build release artifacts
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
plan:
7+
required: false
8+
type: string
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
native:
15+
name: ${{ matrix.rust-target }}
16+
runs-on: ${{ matrix.os }}
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
include:
21+
- os: ubuntu-22.04
22+
rust-target: x86_64-unknown-linux-gnu
23+
rustup-target: x86_64-unknown-linux-gnu
24+
vsix-target: linux-x64
25+
zigbuild: true
26+
- os: ubuntu-22.04
27+
rust-target: aarch64-unknown-linux-gnu
28+
rustup-target: aarch64-unknown-linux-gnu
29+
vsix-target: linux-arm64
30+
zigbuild: true
31+
- os: ubuntu-22.04
32+
rust-target: x86_64-unknown-linux-musl
33+
rustup-target: x86_64-unknown-linux-musl
34+
vsix-target: alpine-x64
35+
zigbuild: true
36+
- os: ubuntu-22.04
37+
rust-target: aarch64-unknown-linux-musl
38+
rustup-target: aarch64-unknown-linux-musl
39+
vsix-target: alpine-arm64
40+
zigbuild: true
41+
- os: macos-15
42+
rust-target: aarch64-apple-darwin
43+
rustup-target: aarch64-apple-darwin
44+
vsix-target: darwin-arm64
45+
zigbuild: false
46+
- os: windows-latest
47+
rust-target: x86_64-pc-windows-msvc
48+
rustup-target: x86_64-pc-windows-msvc
49+
vsix-target: win32-x64
50+
zigbuild: false
51+
env:
52+
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.rust-target == 'aarch64-apple-darwin' && '11.0' || '' }}
53+
CARGO_PROFILE_RELEASE_INCREMENTAL: "false"
54+
steps:
55+
- uses: actions/checkout@v4
56+
57+
- name: Setup Rust
58+
uses: ./.github/actions/setup-rust
59+
with:
60+
components: rustfmt
61+
targets: ${{ matrix.rustup-target }}
62+
63+
- name: Setup cargo-zigbuild
64+
if: matrix.zigbuild
65+
shell: bash
66+
run: |
67+
set -euo pipefail
68+
python3 -m pip install --user --upgrade pip
69+
python3 -m pip install --user cargo-zigbuild
70+
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
71+
72+
- name: Setup sccache
73+
uses: ./.github/actions/setup-sccache
74+
with:
75+
cmake-launcher: "true"
76+
77+
- name: Rust Cache
78+
uses: Swatinem/rust-cache@v2
79+
continue-on-error: true
80+
with:
81+
shared-key: release-${{ runner.os }}-${{ matrix.rust-target }}
82+
key: native-${{ hashFiles('Cargo.toml', 'Cargo.lock', 'build.rs', 'rust-toolchain.toml', 'src/**', 'crates/**', 'xtask/**', 'scripts/build-release-artifact.sh') }}
83+
cache-workspace-crates: true
84+
cache-on-failure: true
85+
86+
- name: Setup Node
87+
uses: actions/setup-node@v4
88+
with:
89+
node-version: 22
90+
cache: npm
91+
cache-dependency-path: editors/vscode/package-lock.json
92+
93+
- name: Install JS dependencies
94+
working-directory: editors/vscode
95+
run: npm ci
96+
97+
- name: Set VSIX build metadata
98+
shell: bash
99+
run: |
100+
echo "VIDE_EXTENSION_BUILD_KIND=${{ inputs.plan && fromJson(inputs.plan).announcement_is_prerelease && 'beta' || 'stable' }}" >> "$GITHUB_ENV"
101+
echo "VIDE_EXTENSION_COMMIT_HASH=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV"
102+
echo "VIDE_EXTENSION_BUILD_DATE=$(date -u +'%Y%m%dT%H%M%SZ')" >> "$GITHUB_ENV"
103+
104+
- name: Build binary archive and stage VSIX server
105+
shell: bash
106+
run: scripts/build-release-artifact.sh "${{ matrix.rust-target }}" "${{ matrix.vsix-target }}"
107+
108+
- name: Build VSIX
109+
working-directory: editors/vscode
110+
run: npm run package:vsix -- --target ${{ matrix.vsix-target }} --server=prebuilt
111+
112+
- name: Upload cargo-dist artifacts
113+
uses: actions/upload-artifact@v4
114+
with:
115+
name: artifacts-${{ matrix.rust-target }}
116+
path: |
117+
target/distrib/vide-${{ matrix.rust-target }}.*
118+
if-no-files-found: error
119+
120+
- name: Upload VSIX artifact
121+
uses: actions/upload-artifact@v4
122+
with:
123+
name: vsix-${{ matrix.vsix-target }}
124+
path: editors/vscode/vide-vscode-${{ matrix.vsix-target }}.vsix
125+
if-no-files-found: error
126+
127+
source-and-checksums:
128+
name: source tarball and unified checksums
129+
runs-on: ubuntu-latest
130+
needs: native
131+
steps:
132+
- uses: actions/checkout@v4
133+
with:
134+
fetch-depth: 0
135+
136+
- name: Download binary artifacts
137+
uses: actions/download-artifact@v4
138+
with:
139+
pattern: artifacts-*
140+
path: target/distrib
141+
merge-multiple: true
142+
143+
- name: Build source tarball and unified checksum manifest
144+
shell: bash
145+
run: |
146+
set -euo pipefail
147+
mkdir -p target/distrib
148+
git archive --format=tar.gz --prefix=vide-source/ HEAD > target/distrib/source.tar.gz
149+
(
150+
cd target/distrib
151+
sha256sum source.tar.gz > source.tar.gz.sha256
152+
cat *.sha256 | sort -k2 > sha256.sum
153+
ls -lh
154+
)
155+
156+
- name: Upload source and checksum artifacts
157+
uses: actions/upload-artifact@v4
158+
with:
159+
name: artifacts-source
160+
path: |
161+
target/distrib/source.tar.gz
162+
target/distrib/source.tar.gz.sha256
163+
target/distrib/sha256.sum
164+
if-no-files-found: error
165+
166+
web:
167+
name: web VSIX
168+
runs-on: ubuntu-latest
169+
defaults:
170+
run:
171+
working-directory: editors/vscode
172+
steps:
173+
- uses: actions/checkout@v4
174+
175+
- name: Restore playground WASM cache
176+
id: playground-wasm-cache
177+
uses: actions/cache/restore@v4
178+
with:
179+
path: playground/public/wasm
180+
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/**') }}
181+
182+
- name: Setup Rust
183+
if: steps.playground-wasm-cache.outputs.cache-hit != 'true'
184+
uses: ./.github/actions/setup-rust
185+
with:
186+
components: rustfmt
187+
188+
- name: Setup sccache
189+
if: steps.playground-wasm-cache.outputs.cache-hit != 'true'
190+
uses: ./.github/actions/setup-sccache
191+
with:
192+
cmake-launcher: "true"
193+
194+
- name: Install Emscripten SDK
195+
if: steps.playground-wasm-cache.outputs.cache-hit != 'true'
196+
uses: ./.github/actions/setup-emscripten
197+
with:
198+
version: 5.0.2
199+
200+
- name: Setup Node
201+
uses: actions/setup-node@v4
202+
with:
203+
node-version: 22
204+
cache: npm
205+
cache-dependency-path: editors/vscode/package-lock.json
206+
207+
- name: Install JS dependencies
208+
run: npm ci
209+
210+
- name: Build playground WASM
211+
if: steps.playground-wasm-cache.outputs.cache-hit != 'true'
212+
working-directory: playground
213+
run: |
214+
source "${EMSDK}/emsdk_env.sh"
215+
npm run build:wasm
216+
217+
- name: Save playground WASM cache
218+
if: steps.playground-wasm-cache.outputs.cache-hit != 'true'
219+
uses: actions/cache/save@v4
220+
continue-on-error: true
221+
with:
222+
path: playground/public/wasm
223+
key: ${{ steps.playground-wasm-cache.outputs.cache-primary-key }}
224+
225+
- name: Set VSIX build metadata
226+
working-directory: .
227+
shell: bash
228+
run: |
229+
echo "VIDE_EXTENSION_BUILD_KIND=${{ inputs.plan && fromJson(inputs.plan).announcement_is_prerelease && 'beta' || 'stable' }}" >> "$GITHUB_ENV"
230+
echo "VIDE_EXTENSION_COMMIT_HASH=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV"
231+
echo "VIDE_EXTENSION_BUILD_DATE=$(date -u +'%Y%m%dT%H%M%SZ')" >> "$GITHUB_ENV"
232+
233+
- name: Build web VSIX
234+
run: npm run package:vsix:web
235+
236+
- name: Upload web VSIX artifact
237+
uses: actions/upload-artifact@v4
238+
with:
239+
name: vsix-web
240+
path: editors/vscode/vide-vscode-web.vsix
241+
if-no-files-found: error

0 commit comments

Comments
 (0)