Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .github/scripts/linux-deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/usr/bin/env bash
# Install only the missing Ubuntu packages for one hosted CI lane.
set -euo pipefail

usage() {
echo "usage: bash .github/scripts/linux-deps.sh [--list] build|test|voice|packaging" >&2
exit 2
}

list=false
if [[ ${1:-} == --list ]]; then
list=true
shift
fi
[[ $# == 1 ]] || usage

packages=(
pkg-config libxkbcommon-dev libwayland-dev libx11-dev libxcursor-dev
libxrandr-dev libxi-dev libgtk-3-dev libfontconfig1-dev libfreetype-dev
)
runtime=(libvulkan1 mesa-vulkan-drivers)
case "$1" in
build) ;;
test) packages+=("${runtime[@]}") ;;
voice) packages+=("${runtime[@]}" libasound2-dev) ;;
packaging) packages+=("${runtime[@]}" file flatpak flatpak-builder elfutils zstd) ;;
*) usage ;;
esac
if [[ "$list" == true ]]; then
printf '%s\n' "${packages[@]}"
exit 0
fi

missing=()
for package in "${packages[@]}"; do
status=$(dpkg-query -W -f='${db:Status-Status}' "$package" 2>/dev/null) || status=missing
if [[ "$status" != installed ]]; then
missing+=("$package")
fi
done

echo "Image: ${ImageOS:-unknown} ${ImageVersion:-unknown}"
echo "Linux dependencies ($1): ${#packages[@]} requested, ${#missing[@]} absent."
if (( ${#missing[@]} )); then
printf 'Installing %s\n' "${missing[*]}"
apt_options=(-o Acquire::Retries=2 -o Acquire::http::Timeout=30 -o Acquire::https::Timeout=30)
sudo timeout --kill-after=20s 5m apt-get "${apt_options[@]}" update
sudo timeout --kill-after=20s 8m apt-get "${apt_options[@]}" install -y --no-install-recommends "${missing[@]}"
fi

if [[ -n "${GITHUB_STEP_SUMMARY:-}" ]]; then
printf 'Linux setup (%s) on %s: %s/%s packages already installed, %ss elapsed.\n\n' \
"$1" "${ImageVersion:-unknown}" "$(( ${#packages[@]} - ${#missing[@]} ))" "${#packages[@]}" "$SECONDS" >> "$GITHUB_STEP_SUMMARY"
fi
46 changes: 29 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,13 @@ jobs:
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Install Linux build dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends pkg-config libxkbcommon-dev libwayland-dev libx11-dev libxcursor-dev libxrandr-dev libxi-dev libgtk-3-dev libfontconfig1-dev libfreetype-dev libvulkan1 mesa-vulkan-drivers
run: bash .github/scripts/linux-deps.sh build
- name: Install Rust
run: rustup install
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
- run: cargo clippy --workspace --all-targets -- -D warnings
- run: cargo clippy --workspace --all-targets --locked -- -D warnings

platform-build-test:
name: build/test (${{ matrix.platform }})
Expand Down Expand Up @@ -142,9 +140,7 @@ jobs:
devx-timing-v1-${{ matrix.platform }}-${{ hashFiles('rust-toolchain.toml') }}-
- name: Install Linux build dependencies
if: matrix.platform == 'linux'
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends pkg-config libxkbcommon-dev libwayland-dev libx11-dev libxcursor-dev libxrandr-dev libxi-dev libgtk-3-dev libfontconfig1-dev libfreetype-dev libvulkan1 mesa-vulkan-drivers
run: bash .github/scripts/linux-deps.sh test
- name: Install Rust
run: rustup install
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
Expand All @@ -160,7 +156,7 @@ jobs:
- name: Build workspace
# Keep the running xtask timing wrapper out of its own build on Windows. Build xtask
# in the next step so the workflow still builds the complete workspace.
run: cargo xtask devx-time build -- cargo build --workspace --exclude xtask --locked
run: cargo xtask devx-time build -- cargo build --workspace --exclude xtask --locked --timings
- name: Build xtask
run: cargo build -p xtask --locked
- name: Run workspace tests with infrastructure-only retry (Linux)
Expand All @@ -170,20 +166,28 @@ jobs:
cargo xtask devx-time tests -- bash -c '
set -o pipefail
set +e
cargo test --workspace --locked 2>&1 | tee cargo-test.log
cargo test --workspace --locked --timings 2>&1 | tee cargo-test.log
status=${PIPESTATUS[0]}
set -e
if [[ "$status" -eq 0 ]]; then exit 0; fi
if grep -Eq "No space left on device|IO failure on output stream|Bus error|signal 7" cargo-test.log; then
echo "Retrying after an infrastructure/resource failure"
cargo test --workspace
cargo test --workspace --locked --timings
exit $?
fi
exit "$status"
'
- name: Run workspace tests
if: matrix.platform != 'linux'
run: cargo xtask devx-time tests -- cargo test --workspace --locked
run: cargo xtask devx-time tests -- cargo test --workspace --locked --timings
- name: Upload Cargo compilation timings
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: cargo-timings-${{ matrix.platform }}-${{ github.run_attempt }}
path: target/cargo-timings/cargo-timing-*.html
if-no-files-found: ignore
retention-days: 14
- name: Save main-branch build/test timing history
if: github.ref == 'refs/heads/main' && success()
uses: actions/cache/save@caa296126883cff596d87d8935842f9db880ef25 # v5
Expand Down Expand Up @@ -213,9 +217,7 @@ jobs:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Install Linux build dependencies
if: matrix.platform == 'linux'
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends pkg-config libasound2-dev libxkbcommon-dev libwayland-dev libx11-dev libxcursor-dev libxrandr-dev libxi-dev libgtk-3-dev libfontconfig1-dev libfreetype-dev libvulkan1 mesa-vulkan-drivers
run: bash .github/scripts/linux-deps.sh voice
- name: Install Rust
run: rustup install
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
Expand Down Expand Up @@ -264,9 +266,7 @@ jobs:
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Install Linux build dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends pkg-config libxkbcommon-dev libwayland-dev libx11-dev libxcursor-dev libxrandr-dev libxi-dev libgtk-3-dev libfontconfig1-dev libfreetype-dev libvulkan1 mesa-vulkan-drivers
run: bash .github/scripts/linux-deps.sh test
- name: Install Rust and LLVM tools
run: |
rustup install
Expand Down Expand Up @@ -319,8 +319,20 @@ jobs:
timeout-minutes: 60
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Restore pinned cargo-ndk
id: cargo-ndk
uses: actions/cache/restore@caa296126883cff596d87d8935842f9db880ef25 # v5
with:
path: ~/.cargo/bin/cargo-ndk
key: cargo-ndk-ubuntu24-${{ runner.arch }}-${{ hashFiles('android/ci-setup.sh', 'rust-toolchain.toml') }}
- name: Install the Android SDK packages, the Rust target and cargo-ndk
run: bash android/ci-setup.sh
- name: Save pinned cargo-ndk from main
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && steps.cargo-ndk.outputs.cache-hit != 'true'
uses: actions/cache/save@caa296126883cff596d87d8935842f9db880ef25 # v5
with:
path: ~/.cargo/bin/cargo-ndk
key: ${{ steps.cargo-ndk.outputs.cache-primary-key }}
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
with:
key: android
Expand Down
16 changes: 11 additions & 5 deletions .github/workflows/nightly-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -290,18 +290,24 @@ jobs:
with:
ref: ${{ needs.prepare.outputs.sha }}
- name: Install Linux build dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends pkg-config libxkbcommon-dev libwayland-dev libx11-dev libxcursor-dev libxrandr-dev libxi-dev libgtk-3-dev libfontconfig1-dev libfreetype-dev libvulkan1 mesa-vulkan-drivers
run: bash .github/scripts/linux-deps.sh test
- name: Install Rust
run: rustup install
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
with:
save-if: false
- name: Build workspace
run: cargo build --workspace --locked
run: cargo build --workspace --locked --timings
- name: Run workspace tests
run: cargo test --workspace --locked
run: cargo test --workspace --locked --timings
- name: Upload Cargo compilation timings
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: cargo-timings-tagged-linux-${{ github.run_attempt }}
path: target/cargo-timings/cargo-timing-*.html
if-no-files-found: ignore
retention-days: 14
- name: Welcome notebook matches the version
run: cargo xtask demo-check

Expand Down
21 changes: 19 additions & 2 deletions .github/workflows/packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,13 @@ jobs:
persist-credentials: false
- name: Install Linux build dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends pkg-config libxkbcommon-dev libwayland-dev libx11-dev libxcursor-dev libxrandr-dev libxi-dev libgtk-3-dev libfontconfig1-dev libfreetype-dev libvulkan1 mesa-vulkan-drivers file flatpak flatpak-builder elfutils zstd
# Manual packaging can select a commit from before the shared setup script.
if [[ -f .github/scripts/linux-deps.sh ]]; then
bash .github/scripts/linux-deps.sh packaging
else
sudo timeout --kill-after=20s 5m apt-get -o Acquire::Retries=2 -o Acquire::http::Timeout=30 -o Acquire::https::Timeout=30 update
sudo timeout --kill-after=20s 8m apt-get -o Acquire::Retries=2 -o Acquire::http::Timeout=30 -o Acquire::https::Timeout=30 install -y --no-install-recommends pkg-config libxkbcommon-dev libwayland-dev libx11-dev libxcursor-dev libxrandr-dev libxi-dev libgtk-3-dev libfontconfig1-dev libfreetype-dev libvulkan1 mesa-vulkan-drivers file flatpak flatpak-builder elfutils zstd
fi
- name: Install nfpm and appimagetool
run: |
set -eu
Expand Down Expand Up @@ -92,6 +97,7 @@ jobs:
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: notecraft-linux-${{ matrix.arch }}
compression-level: 0
path: |
dist/linux/*.tar.gz
dist/linux/*.AppImage
Expand Down Expand Up @@ -124,6 +130,7 @@ jobs:
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: notecraft-linux-${{ matrix.arch }}-extra
compression-level: 0
path: |
dist/linux/*.pkg.tar.zst
dist/linux/*.flatpak
Expand Down Expand Up @@ -168,6 +175,7 @@ jobs:
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: notecraft-windows-x64
compression-level: 0
path: dist/release/*
if-no-files-found: error

Expand Down Expand Up @@ -210,6 +218,7 @@ jobs:
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: notecraft-macos-${{ matrix.arch }}
compression-level: 0
path: |
dist/macos/*.dmg
dist/macos/*.zip
Expand All @@ -226,6 +235,12 @@ jobs:
with:
ref: ${{ inputs.ref }}
persist-credentials: false
- name: Restore pinned cargo-ndk
id: cargo-ndk
uses: actions/cache/restore@caa296126883cff596d87d8935842f9db880ef25 # v5
with:
path: ~/.cargo/bin/cargo-ndk
key: cargo-ndk-ubuntu24-${{ runner.arch }}-${{ hashFiles('android/ci-setup.sh', 'rust-toolchain.toml') }}
- name: Install the Android SDK packages, the Rust target and cargo-ndk
run: bash android/ci-setup.sh
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
Expand Down Expand Up @@ -264,6 +279,7 @@ jobs:
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: notecraft-android-arm64
compression-level: 0
path: dist/android/*.apk
if-no-files-found: error

Expand Down Expand Up @@ -318,5 +334,6 @@ jobs:
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: notecraft-freebsd-x86_64
compression-level: 0
path: dist/freebsd/*.tar.gz
if-no-files-found: error
12 changes: 10 additions & 2 deletions .github/workflows/website-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,20 +110,27 @@ jobs:
version="$(python3 -c 'import tomllib; print(tomllib.load(open("Cargo.toml", "rb"))["workspace"]["package"]["version"])')"
echo "value=$version" >> "$GITHUB_OUTPUT"

- name: Build the demo from source (no external build service)
- name: Apply the browser source patches
run: |
set -eu
python3 .github/web-build/apply-web-diff.py . .github/web-build/web.diff
python3 .github/web-build/apply-web-patches.py . .github/web-build/patches.yaml
- name: Test the browser host code
run: |
# The tab-close policy is platform-neutral and tested with real files on the host.
cargo test -p notecraft-web
- name: Compile and bundle WASM with Trunk
run: |
set -eu
# Wasm SIMD: off by default for this target: egui's CPU rendering is noticeably faster with it
# (this is the same rustflag daijro/openplayground's build.mjs sets), every current browser has it.
mkdir -p .cargo
printf '[target.wasm32-unknown-unknown]\nrustflags = ["-Ctarget-feature=+simd128"]\n' >> .cargo/config.toml
cd apps/notecraft-web
trunk build --release --dist "$GITHUB_WORKSPACE/website/demo" --public-url ./
cd "$GITHUB_WORKSPACE"
- name: Optimize and verify WASM
run: |
set -eu
for f in website/demo/*.wasm; do
# Same flags daijro/openplayground's build.mjs uses (WASM_OPT/WASM_FEATURES): these
# features match what Rust's wasm32-unknown-unknown target actually emits with SIMD
Expand Down Expand Up @@ -182,6 +189,7 @@ jobs:
if: inputs.artifact-name != ''
with:
name: ${{ inputs.artifact-name }}
compression-level: 0
path: ${{ runner.temp }}/web/*.zip
if-no-files-found: error

Expand Down
18 changes: 15 additions & 3 deletions android/ci-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,22 @@ NDK_VERSION="27.2.12479018"
export JAVA_HOME="${JAVA_HOME_21_X64:-$JAVA_HOME}"
echo "JAVA_HOME=$JAVA_HOME" >> "$GITHUB_ENV"
sdkmanager="$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager"
(yes || true) | "$sdkmanager" --licenses > /dev/null
"$sdkmanager" --install "platforms;android-35" "build-tools;35.0.0" "ndk;$NDK_VERSION" > /dev/null
packages=()
[[ -f "$ANDROID_HOME/platforms/android-35/android.jar" ]] || packages+=("platforms;android-35")
[[ -x "$ANDROID_HOME/build-tools/35.0.0/aapt2" ]] || packages+=("build-tools;35.0.0")
[[ -x "$ANDROID_HOME/ndk/$NDK_VERSION/ndk-build" ]] || packages+=("ndk;$NDK_VERSION")
if (( ${#packages[@]} )); then
printf 'Installing Android SDK packages: %s\n' "${packages[*]}"
(yes || true) | timeout --kill-after=20s 5m "$sdkmanager" --licenses > /dev/null
timeout --kill-after=20s 12m "$sdkmanager" --install "${packages[@]}"
else
echo "The requested SDK and NDK packages are already installed."
fi
echo "ANDROID_NDK_HOME=$ANDROID_HOME/ndk/$NDK_VERSION" >> "$GITHUB_ENV"

rustup install
rustup target add aarch64-linux-android
cargo install cargo-ndk --version 4.1.2 --locked
if [[ "$(cargo ndk --version 2>/dev/null || true)" != "cargo-ndk 4.1.2" ]]; then
cargo install cargo-ndk --version 4.1.2 --locked --force
fi
cargo ndk --version
11 changes: 11 additions & 0 deletions docs/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,17 @@ history is kept in a platform-specific GitHub Actions cache. Warnings compare wi
successful runs on the same platform and Rust toolchain, and never fail a gate. See
[`devx-performance.md`](devx-performance.md) for the data fields and thresholds.

The desktop build/test lanes and the tagged Linux lane also attach Cargo timing HTML for
build and test compilation. Compare it with the workflow steps to distinguish compilation
and linking from test execution. The website workflow times source patches, host tests,
Trunk and `wasm-opt` separately.

Hosted Linux lanes use the tracked [dependency setup script](../.github/scripts/linux-deps.sh).
It reports the runner image and packages already present. The build profile selects compile
dependencies. Test and voice profiles include GPU runtime libraries, and packaging adds
its archive and installer tools. The setup installs missing packages with bounded network
retries and timeouts.

## Continuous integration

[`ci.yml`](../.github/workflows/ci.yml) runs the same gates on every pull request and on main:
Expand Down
Loading