Skip to content
Merged
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
18 changes: 18 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,24 @@ jobs:
with:
targets: ${{ matrix.rust_target }}

# Release builds compile the same dependency graph the test workflows
# do, from scratch, on four runners. The measurement that motivated
# caching is in test.yml: 7m57s of a 12m14s job was the release compile
# alone.
#
# `workspaces` names the cargo workspace root; without it the action
# looks for Cargo.lock at the repository root and caches nothing.
#
# `key` is not optional here. The automatic key covers the job id, the
# rustc release/host and a hash of the Cargo files -- and the two
# windows-latest entries share all three, differing only in `arch`. The
# ARM64 job would otherwise restore the x64 job's target directory.
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
workspaces: src-tauri
key: ${{ matrix.os }}-${{ matrix.arch }}

- name: Install Linux dependencies
if: matrix.platform == 'ubuntu-24.04'
run: |
Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,24 @@ on:
branches:
- master

# A pull request branch gets pushed to repeatedly, and every push queued
# another full run of this suite while the previous revision was still being
# tested. Only the newest revision of a branch is worth testing -- the same
# reasoning test_build.yml already applies to its platform matrix.
#
# `github.ref` is `refs/pull/<n>/merge` under the pull_request trigger and
# `refs/heads/master` under the push trigger, so the two triggers land in
# different groups and neither can cancel the other.
#
# Cancellation is restricted to pull requests. The push trigger exists because
# a commit can reach master without ever having been a pull request (see the
# comment above it); cancelling a master run because a second commit landed
# would leave the first one untested, which is the exact hole that trigger was
# added to close.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
test:
runs-on: ubuntu-22.04
Expand All @@ -27,6 +45,25 @@ jobs:
- name: install rust stable
uses: dtolnay/rust-toolchain@stable

# Nothing in this repository cached cargo output, so every job compiled
# the whole dependency graph from scratch. Measured on the Linux
# `build-test` job of run 31382758646: `cargo test` took 2m31s and the
# release `Build app` 7m57s out of 12m14s -- 86% of the job was Rust
# compilation, none of it reused.
#
# `src-tauri` is the cargo workspace root. Without naming it the action
# looks for Cargo.lock at the repository root, finds none and caches
# nothing.
#
# This job is also what makes the cache reach anything: a pull request
# can only restore caches written on its own branch or on the base
# branch, and of the three workflows only this one runs on push to
# master. Its master runs are what seed a freshly opened branch.
- name: cache rust dependencies
uses: Swatinem/rust-cache@v2
with:
workspaces: src-tauri

- name: install dependencies (ubuntu only)
run: |
sudo apt-get update
Expand Down
48 changes: 48 additions & 0 deletions .github/workflows/test_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,30 @@ name: Test Build (No Release)
on:
# Keep release packaging changes from reaching a draft release without a
# platform build check.
#
# Documentation cannot change what these three platforms compile. No
# Markdown file is bundled as a resource -- `tauri.conf.json` has no
# `resources` key -- and the frontend suites that do read `samples/*.md` as
# fixtures still run on every pull request through test.yml, which carries
# no path filter. A documentation-only pull request was therefore spending
# three full platform builds, 12m14s on Linux alone, to prove nothing.
#
# This is only safe while `build-test` is not a required status check: a job
# that never starts stays pending forever against a required check, and the
# pull request can then never be merged. Checked when this was written --
# master's protection reports no required contexts, and `gh pr checks
# --required` reports none on the open pull requests. Whoever makes it
# required has to delete this filter in the same change.
#
# `samples/**` is deliberately absent. It holds only `.md` files today, so
# `**.md` already covers it, and `npm test` reads `samples/stress-test.md`
# as a fixture; naming the directory would drop a future non-Markdown
# fixture out of the matrix without anyone noticing.
pull_request:
paths-ignore:
- '**.md'
- 'pics/**'
- '.github/ISSUE_TEMPLATE/**'
workflow_dispatch:

# Every push to a pull request queued another full matrix while the previous
Expand Down Expand Up @@ -52,6 +75,31 @@ jobs:
with:
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}

# This is the job the 12m14s measurement in test.yml came from: 2m31s of
# it was the debug compile behind `cargo test` and 7m57s the release
# compile behind `Build app`, all of it from scratch on every run.
#
# `workspaces` names the cargo workspace root; the action finds no
# Cargo.lock without it.
#
# The automatic key covers the job id, the rustc release/host and a hash
# of the Cargo files. All three entries share the job id `build-test`,
# which leaves the rustc host as the only thing telling them apart, and
# the target list this matrix varies does not appear in the key at all.
# `key` makes the cache say which matrix entry wrote it rather than
# leaning on that coincidence.
#
# Note what this cannot do on its own: this workflow has no push
# trigger, so its caches are only ever written on pull request branches
# and a branch can only restore its own or the base branch's. The first
# run of a new pull request will still be a cold compile; later pushes
# to the same branch are the ones that hit.
- name: cache rust dependencies
uses: Swatinem/rust-cache@v2
with:
workspaces: src-tauri
key: ${{ matrix.os-name }}

- name: install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-22.04'
run: |
Expand Down