Skip to content

Visual Studio Code, rebuilt in Rust

Rust

ci: smoke-run the app on macOS and Linux x64 (#41)

Artur Rok7a01ac58b2cf
diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml
index 587054f4ac7..71c98c7330e 100644
--- a/.github/actions/setup/action.yml
+++ b/.github/actions/setup/action.yml
@@ -4,6 +4,9 @@ inputs:
save-rust-cache:
description: Save the Rust cache on main. The 10 GB repository cache limit fits the test jobs and the macOS safety job, not every job.
default: 'true'
+ rust-cache-job:
+ description: Restore the Rust cache of this job instead of the caller's own.
+ default: ''
runs:
using: composite
@@ -61,6 +64,7 @@ runs:
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
workspaces: native
+ shared-key: ${{ inputs.rust-cache-job }}
cache-on-failure: true
save-if: ${{ github.ref == 'refs/heads/main' && inputs.save-rust-cache == 'true' }}
# port/patches apply in build-exthost, after this cache, so the key has only what the install and compile read.
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 1dd29e32964..13a8e6df306 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -1,6 +1,6 @@
name: CI
-# The repository checks and every crate's tests on macOS, Linux and Windows. Dispatch runs it on any branch.
+# The repository checks, every crate's tests and a smoke run of the app on macOS and Linux. Dispatch runs it on any branch.
# Outside CI: ui-pair, pixel-check and api-tests need the reference app and a GUI session (port/tools/studio --lane).
on:
push:
@@ -75,6 +75,33 @@ jobs:
- working-directory: native
run: cargo clippy -p app -p exthost --all-targets --locked -- -A clippy::all
+ # The app itself, which no test starts: a window, the extension host, git and emmet active, an edit saved to disk.
+ # The dev build, from the test job's Rust cache: a release cache does not fit the 10 GB limit. Not expected red.
+ smoke:
+ name: smoke (${{ matrix.os }} ${{ matrix.arch }})
+ strategy:
+ fail-fast: false
+ matrix:
+ include:
+ - os: macos
+ arch: arm64
+ runner: macos-26
+ # Linux arm64 is out: its build sometimes dies at quit with SIGSEGV (port/ledger.md M23).
+ - os: linux
+ arch: x64
+ runner: ubuntu-24.04
+ runs-on: ${{ matrix.runner }}
+ timeout-minutes: 90
+ steps:
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+ - uses: ./.github/actions/setup
+ with:
+ rust-cache-job: test
+ save-rust-cache: false
+ - working-directory: native
+ run: cargo build -p app --locked
+ - run: APP=native/target/debug/vsrustium VSCODE_GPUI_EXTENSIONS=$PWD/upstream/extensions port/tools/linux/smoke
+
test:
name: test (${{ matrix.os }} ${{ matrix.arch }})
strategy:
diff --git a/docs/testing.md b/docs/testing.md
index 35a4806fb5b..a3d787fe402 100644
--- a/docs/testing.md
+++ b/docs/testing.md
@@ -8,7 +8,7 @@ Builds and tests run on the build machine (the Studio), not on a laptop: `port/t
`port/tools/cargo-test [-p <crate>] [<filter>...]` (default crate `app`) runs `cargo gc test` in `native/` and prints only compile errors, failed tests and the summary lines. It exits non-zero when cargo fails or when the filter matches no test, where `cargo test ... | rg` passes on both. Use it on any machine, through `port/tools/studio` too.
-`.github/workflows/ci.yml` runs on each push to `main` and each pull request: the repository checks (`ledger-check`, the tests of `port/tools`, `docs-check`, licenses, advisories), clippy's SAFETY check, and `cargo test --workspace` on macOS and Linux. The Linux test jobs are `expected-red` until milestone M23 closes its test gaps; Windows (M24) is paused and runs by hand in `windows.yml`. The checks that need the reference app and a window do not run there.
+`.github/workflows/ci.yml` runs on each push to `main` and each pull request: the repository checks (`ledger-check`, the tests of `port/tools`, `docs-check`, licenses, advisories), clippy's SAFETY check, `cargo test --workspace` on macOS and Linux, and a smoke run of the dev build on macOS arm64 and Linux x64 (`port/tools/linux/smoke`: the app starts in a window, git and emmet activate, an edit saves to disk). The Linux test jobs are `expected-red` until milestone M23 closes its test gaps; Windows (M24) is paused and runs by hand in `windows.yml`. The checks that need the reference app and a window do not run there.
The workspace has about 4000 tests. The `app` suite takes about a minute after the build.
diff --git a/port/tools/linux/smoke b/port/tools/linux/smoke
index ebb8065996a..a797db3b0c9 100755
--- a/port/tools/linux/smoke
+++ b/port/tools/linux/smoke
@@ -1,8 +1,8 @@
#!/bin/bash
-# Runs the Linux release build under Xvfb in the Linux container (port/tools/linux-build port/tools/linux/smoke): opens a
-# git repository copy of port/fixtures/workspace and runs port/fixtures/extensions/linux-smoke-tests in it (git and emmet
-# activate, an edit saves to disk). APP overrides the binary; FIXTURE=webview-tests runs that fixture instead, as
-# port/tools/webview-check does on macOS.
+# Runs the release build on a git repository copy of port/fixtures/workspace with
+# port/fixtures/extensions/linux-smoke-tests in it (git and emmet activate, an edit saves to disk): under Xvfb on Linux
+# (port/tools/linux-build port/tools/linux/smoke), in a window on macOS. APP overrides the binary; FIXTURE=webview-tests
+# runs that fixture instead, as port/tools/webview-check does on macOS. CI's smoke job runs it on the dev build.
set -uo pipefail
REF=$(cd upstream && pwd -P)
# A packaged app (APP=<folder>/vsrustium) runs its own resources/app/extensions; the dev build the reference's.
@@ -11,19 +11,24 @@ if [[ -z ${APP:-} ]]; then
export VSCODE_GPUI_EXTENSIONS=${VSCODE_GPUI_EXTENSIONS:-$REF/extensions}
fi
dir=$(mktemp -d)
-trap 'kill %1; rm -rf "$dir"' EXIT
-# -displayfd picks a free display and writes its number once Xvfb accepts clients; the app exits with
-# "Failed to initialize X11 client" when it starts before that.
-Xvfb -displayfd 1 -screen 0 1600x1000x24 >"$dir/display" 2>/dev/null &
-for _ in $(seq 100); do [ -s "$dir/display" ] && break; sleep 0.1; done
-export DISPLAY=:$(cat "$dir/display")
+trap 'rm -rf "$dir"' EXIT
+if [[ $(uname) == Linux ]]; then
+ trap 'kill %1; rm -rf "$dir"' EXIT
+ # -displayfd picks a free display and writes its number once Xvfb accepts clients; the app exits with
+ # "Failed to initialize X11 client" when it starts before that.
+ Xvfb -displayfd 1 -screen 0 1600x1000x24 >"$dir/display" 2>/dev/null &
+ for _ in $(seq 100); do [ -s "$dir/display" ] && break; sleep 0.1; done
+ export DISPLAY=:$(cat "$dir/display")
+fi
cp -R port/fixtures/workspace "$dir/workspace"
git -C "$dir/workspace" init -q && git -C "$dir/workspace" add -A && git -C "$dir/workspace" -c user.name=smoke -c user.email=smoke@localhost commit -qm fixture
tests=$PWD/port/fixtures/extensions/${FIXTURE:-linux-smoke-tests}
-timeout 300 "$APP" "$dir/workspace" --user-data-dir "$dir/user-data" --skip-welcome --disable-workspace-trust \
+# perl's alarm, not timeout: GitHub's macOS runners have no coreutils. A run past 300 s ends with exit 142.
+perl -e 'alarm 300; exec @ARGV' "$APP" "$dir/workspace" --user-data-dir "$dir/user-data" --skip-welcome --disable-workspace-trust \
--extensionDevelopmentPath="$tests" --extensionTestsPath="$tests/tests" >"$dir/log" 2>&1
code=$?
grep -E "^handshake done|^(ok|FAILED) " "$dir/log"
+[[ $code == 0 ]] || tail -40 "$dir/log"
echo "linux smoke: exit $code"
exit $code