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
59 changes: 46 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Every gate of script/check on GitHub's own runners (docs/PLAN.md §13.4): Windows, Linux and
# macOS, plus the workflows' and the dependencies' own checks. It runs on pushes to main, on
# pull requests, and for every release tag before anything is published (release.yml calls it).
# pull requests, and for a release tag whose commit has no passing run on main (release.yml
# calls it). On Windows and Linux, script/check runs as two jobs side by side, `--fast` (steps
# 1-4, and step 6 on Linux) and `--e2e-only` (step 5), which together are its every step.
#
# Security: the token is read-only in every job, no job has a secret, checkouts keep no
# credentials, every action is pinned to a commit, and nothing runs on pull_request_target. The
Expand All @@ -10,10 +12,23 @@

name: CI

# A change to the documentation alone (docs/, the Markdown at the root, the e2e README) runs
# nothing: no gate reads them. crates/dv_cli/skill/SKILL.md is code (dv_cli embeds and tests it),
# and a release's call (workflow_call) has no path filter.
on:
push:
branches: [main]
paths:
- "**"
- "!docs/**"
- "!*.md"
- "!tests/e2e/README.md"
pull_request:
paths:
- "**"
- "!docs/**"
- "!*.md"
- "!tests/e2e/README.md"
workflow_call:

permissions: {}
Expand Down Expand Up @@ -69,11 +84,15 @@ jobs:
arguments: --all-features --locked

windows:
name: Windows (script/check)
name: Windows (script/check ${{ matrix.check }})
runs-on: windows-2025
timeout-minutes: 75
permissions:
contents: read
strategy:
fail-fast: false
matrix:
check: [--fast, --e2e-only]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
Expand All @@ -95,6 +114,7 @@ jobs:
restore-keys: windows-
# The runner's desktop is 1024x768, too small for the scenarios' 1440x900 windows.
- name: A 1920x1080 desktop for the e2e scenarios
if: ${{ matrix.check == '--e2e-only' }}
shell: pwsh
run: |
Set-DisplayResolution -Width 1920 -Height 1080 -Force
Expand All @@ -103,24 +123,27 @@ jobs:
# The runner's own temp dir, whose name is long: the default one is spelled with an 8.3
# short name (C:\Users\RUNNER~1\…), which git and the file system report long, so tests
# that compare a fixture's path with what came back would see two spellings of one folder.
- name: script/check
- name: script/check ${{ matrix.check }}
shell: bash
env:
CHECK: ${{ matrix.check }}
run: |
export TMP="$RUNNER_TEMP" TEMP="$RUNNER_TEMP"
bash script/check
bash script/check "$CHECK"
- name: The e2e scenarios' screenshots and logs
if: ${{ failure() }}
if: ${{ failure() && matrix.check == '--e2e-only' }}
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: e2e-windows
path: target/e2e
retention-days: 7
if-no-files-found: ignore
# The --fast half's target dir, whose dependencies the --e2e-only half's build reuses.
- name: Save the cache (main, once per Cargo.lock)
if: ${{ !cancelled() && github.event_name == 'push' && github.ref == 'refs/heads/main' && steps.cache.outputs.cache-hit != 'true' }}
if: ${{ !cancelled() && matrix.check == '--fast' && github.event_name == 'push' && github.ref == 'refs/heads/main' && steps.cache.outputs.cache-hit != 'true' }}
shell: bash
run: rm -rf target/debug/incremental target/e2e target/tmp
- if: ${{ !cancelled() && github.event_name == 'push' && github.ref == 'refs/heads/main' && steps.cache.outputs.cache-hit != 'true' }}
- if: ${{ !cancelled() && matrix.check == '--fast' && github.event_name == 'push' && github.ref == 'refs/heads/main' && steps.cache.outputs.cache-hit != 'true' }}
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
Expand All @@ -131,11 +154,15 @@ jobs:
key: windows-${{ hashFiles('Cargo.lock', 'rust-toolchain.toml') }}

linux:
name: Linux (script/check --linux)
name: Linux (script/check ${{ matrix.check }})
runs-on: ubuntu-24.04
timeout-minutes: 75
permissions:
contents: read
strategy:
fail-fast: false
matrix:
check: [--fast --linux, --e2e-only]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
Expand Down Expand Up @@ -167,20 +194,26 @@ jobs:
target
key: linux-${{ hashFiles('Cargo.lock', 'rust-toolchain.toml') }}
restore-keys: linux-
- name: script/check --linux
run: bash script/check --linux
- name: script/check ${{ matrix.check }}
env:
CHECK: ${{ matrix.check }}
run: |
read -ra args <<< "$CHECK"
bash script/check "${args[@]}"
- name: The e2e scenarios' screenshots and logs
if: ${{ failure() }}
if: ${{ failure() && matrix.check == '--e2e-only' }}
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: e2e-linux
path: target/e2e
retention-days: 7
if-no-files-found: ignore
# The --fast --linux half's target dirs, whose dependencies the --e2e-only half's build
# reuses, and the musl build's.
- name: Save the cache (main, once per Cargo.lock)
if: ${{ !cancelled() && github.event_name == 'push' && github.ref == 'refs/heads/main' && env.ACT != 'true' && steps.cache.outputs.cache-hit != 'true' }}
if: ${{ !cancelled() && matrix.check != '--e2e-only' && github.event_name == 'push' && github.ref == 'refs/heads/main' && env.ACT != 'true' && steps.cache.outputs.cache-hit != 'true' }}
run: rm -rf target/debug/incremental target/e2e target/tmp
- if: ${{ !cancelled() && github.event_name == 'push' && github.ref == 'refs/heads/main' && env.ACT != 'true' && steps.cache.outputs.cache-hit != 'true' }}
- if: ${{ !cancelled() && matrix.check != '--e2e-only' && github.event_name == 'push' && github.ref == 'refs/heads/main' && env.ACT != 'true' && steps.cache.outputs.cache-hit != 'true' }}
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
Expand Down
113 changes: 95 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# A release (docs/PLAN.md §13.4): pushing an annotated tag `v<version>` on a commit on main
# builds the Windows and macOS releases (Setup.exe, the .pkg, and the Velopack update feed the
# installed app reads) and the Linux AppImage on GitHub's runners, runs every CI gate on that commit, and then waits for
# the owner to approve the `release` environment before anything is published to GitHub
# Releases.
# installed app reads) and the Linux AppImage on GitHub's runners, makes sure every CI gate
# passed on that commit (main's own CI run for it when that one passes, else a run of ci.yml
# here), and then waits for the owner to approve the `release` environment before anything is
# published to GitHub Releases.
#
# Security, beyond ci.yml's:
# - only the owner can create `v*` tags, and no tag can be moved or deleted (a repository
Expand Down Expand Up @@ -66,18 +67,100 @@ jobs:
if-no-files-found: error
retention-days: 7

# The tag's commit is on main, whose push ran ci.yml on it moments before the tag: when that
# run passes, it is this commit's CI, and the release doesn't run the same gates a second
# time, cold, on the slowest path (PLAN §13.4). No run, or one that doesn't pass (failed,
# cancelled, superseded while it waited), and the `ci` job below runs them here instead.
main-ci:
name: CI on main for this commit
needs: verify
runs-on: ubuntu-24.04
timeout-minutes: 120
permissions:
actions: read # lists and watches main's CI runs
outputs:
passed: ${{ steps.main.outputs.passed }}
steps:
- name: Wait for main's CI run of this commit
id: main
env:
GH_TOKEN: ${{ github.token }}
SHA: ${{ github.sha }}
run: |
set -euo pipefail
# The push to main comes first, but its run can take a few seconds to be listed.
id=""
for _ in 1 2 3 4 5 6; do
id="$(gh run list --repo "$GITHUB_REPOSITORY" --workflow ci.yml --branch main \
--event push --commit "$SHA" --limit 1 --json databaseId --jq '.[0].databaseId // ""')"
if [[ -n "$id" ]]; then break; fi
sleep 10
done
if [[ -z "$id" ]]; then
echo "No CI run on main for $SHA: this release runs ci.yml itself"
echo "passed=false" >> "$GITHUB_OUTPUT"
exit 0
fi
echo "main's CI run for $SHA: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$id"
gh run watch "$id" --repo "$GITHUB_REPOSITORY" --interval 60 > /dev/null
conclusion="$(gh run view "$id" --repo "$GITHUB_REPOSITORY" --json conclusion --jq .conclusion)"
echo "conclusion: $conclusion"
if [[ "$conclusion" == success ]]; then
echo "passed=true" >> "$GITHUB_OUTPUT"
else
echo "It didn't pass: this release runs ci.yml itself"
echo "passed=false" >> "$GITHUB_OUTPUT"
fi

ci:
name: CI
needs: verify
needs: [verify, main-ci]
# main-ci failing to answer counts as no answer: the gates run here.
if: ${{ !cancelled() && needs.verify.result == 'success' && needs.main-ci.outputs.passed != 'true' }}
# A job-level call resolves from this same commit before anything runs, so the runtime
# checkout the self-repository form (`$/`) guards against can't reach it; actionlint doesn't
# read `$/` yet.
uses: ./.github/workflows/ci.yml # zizmor: ignore[self-repository]
permissions:
contents: read

# The static dv WSL distros run, which the Windows release ships beside dv.exe: a job of its
# own, so the Windows release starts once it is built rather than after the AppImage.
linux-dv:
name: Linux dv (WSL)
needs: verify
runs-on: ubuntu-24.04
timeout-minutes: 60
permissions:
contents: read
env:
VERSION: ${{ needs.verify.outputs.version }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: rustup (act's runner image has none; GitHub's has)
if: ${{ env.ACT == 'true' }}
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs |
sh -s -- -y --profile minimal --default-toolchain none
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
- name: Rust toolchain (rust-toolchain.toml)
run: rustup toolchain install && rustc --version
- name: The static Linux dv WSL distros run (script/build-linux)
env:
DV_CHANNEL: release
DV_VERSION: ${{ env.VERSION }}
run: bash script/build-linux --profile dist --out target/package/linux
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: linux-builds
path: target/package/linux/dv-linux-x86_64
if-no-files-found: error
retention-days: 7

linux:
name: Linux builds
name: Linux AppImage
needs: verify
runs-on: ubuntu-24.04
timeout-minutes: 120
Expand Down Expand Up @@ -107,23 +190,12 @@ jobs:
dotnet-version: 8.0.x
- name: vpk 1.2.161 (the velopack crate's version)
run: dotnet tool install -g vpk --version 1.2.161
- name: The static Linux dv WSL distros run (script/build-linux)
env:
DV_CHANNEL: release
DV_VERSION: ${{ env.VERSION }}
run: bash script/build-linux --profile dist --out target/package/linux
- name: The Linux app's AppImage (script/package --linux-app)
run: |
set -euo pipefail
bash script/package --linux-app --version "$VERSION" --out target/package/linux-release
mkdir -p target/package/upload
cp target/package/linux-release/dv.AppImage target/package/upload/dv-linux-x86_64.AppImage
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: linux-builds
path: target/package/linux/dv-linux-x86_64
if-no-files-found: error
retention-days: 7
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: release-linux
Expand All @@ -133,7 +205,7 @@ jobs:

windows:
name: Windows release
needs: [verify, linux]
needs: [verify, linux-dv]
runs-on: windows-2025
timeout-minutes: 120
permissions:
Expand Down Expand Up @@ -263,7 +335,12 @@ jobs:

publish:
name: Publish (after the owner approves)
needs: [verify, ci, linux, windows, macos]
needs: [verify, main-ci, ci, linux-dv, linux, windows, macos]
# Every build, and the gates either on main or here (`ci` is skipped when main's run passed).
if: >-
${{ !cancelled() && needs.verify.result == 'success' && needs.linux.result == 'success'
&& needs.windows.result == 'success' && needs.macos.result == 'success'
&& (needs.main-ci.outputs.passed == 'true' || needs.ci.result == 'success') }}
runs-on: ubuntu-24.04
timeout-minutes: 30
environment:
Expand Down
1 change: 1 addition & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ and a gpui bump starts there. Don't guess APIs: grep the sources under
```bash
script/check # every gate (PLAN §13.2): fmt, clippy x3, gpui boundary, tests, e2e
script/check --fast # the same without the e2e scenarios
script/check --e2e-only # the e2e scenarios alone (step 5; CI's job beside --fast)
script/check --foreground # also tests/e2e/foreground: takes the focus for a few seconds
script/check --linux # also step 6: the headless crates and dv tested and linted in WSL
# Ubuntu, script/build-linux --debug-only, the real WSL sandboxed under /tmp
Expand Down
39 changes: 23 additions & 16 deletions docs/PLAN.md
Original file line number Diff line number Diff line change
Expand Up @@ -2449,7 +2449,8 @@ change is committed; CI (§13.4) runs the same script on GitHub's runners once i
4. `cargo test --workspace`
5. a plain `cargo build -p dv -p mock_gh -p mock_lsp` (step 4's test build links the binaries
with gpui's test support), then the e2e scenarios (`cargo run -p dv_e2e --bin e2e -- tests/e2e`),
background mode; `--fast` skips this step. `--foreground` also runs `tests/e2e/foreground/`,
background mode; `--fast` skips this step, and `--e2e-only` runs it alone (CI's second job
beside `--fast`, §13.4). `--foreground` also runs `tests/e2e/foreground/`,
the scenarios that must take the focus (screen captures of the window materials, §14.2)
6. `--linux`: inside WSL Ubuntu with `CARGO_TARGET_DIR` on ext4, `cargo test -p dv_core -p
dv_backend -p dv_cli -p dv_lsp -p dv_test_support -p mock_gh -p mock_lsp`, `cargo test -p dv
Expand Down Expand Up @@ -2600,30 +2601,36 @@ owns `~/.local/bin/dv` (§5.2's link rule).
### 13.4 CI and releases (GitHub Actions)
The repository is public, so GitHub's hosted runners cost nothing. Two workflows:

- **`.github/workflows/ci.yml`**, on every push to main, every pull request, and for every
release tag (`release.yml` calls it): `script/check` on Windows (`windows-2025`),
`script/check --fast` on macOS (`macos-15`, Apple silicon: its runner's 1024×768 screen is too
small for the scenarios' 1440×900 windows, which `script/check-mac` runs on the owner's Mac),
`script/check --linux` on Ubuntu 24.04 (the gates, the e2e
scenarios on the runner's own Xvfb with Mesa's software Vulkan, the headless crates and the
static musl build; the real-WSL step needs Windows with WSL and is skipped), the workflows
themselves (actionlint, and zizmor's security audits, pedantic; locally
- **`.github/workflows/ci.yml`**, on every push to main, every pull request, and for a release
tag whose commit has no passing run on main (`release.yml` calls it): `script/check` on
Windows (`windows-2025`), `script/check --fast` on macOS (`macos-15`, Apple silicon: its
runner's 1024×768 screen is too small for the scenarios' 1440×900 windows, which
`script/check-mac` runs on the owner's Mac), `script/check --linux` on Ubuntu 24.04 (the
gates, the e2e scenarios on the runner's own Xvfb with Mesa's software Vulkan, the headless
crates and the static musl build; the real-WSL step needs Windows with WSL and is skipped).
On Windows and Linux each runs as two jobs side by side, `--fast` (with `--linux` on Linux)
and `--e2e-only`, which together are every step (the scenarios take about as long as the
tests, so the two halves run at once). Beside them, the workflows themselves (actionlint, and zizmor's security audits, pedantic; locally
`script/check-workflows`), and the dependencies (cargo-deny, `deny.toml`: every crate from
crates.io with a license on its list, no yanked crate, no open RustSec vulnerability; one that
doesn't apply is ignored there with why). A failure keeps the e2e screenshots and logs as the
run's artifact for a week. The caches (Cargo's registry and the target dirs) are saved only
by a push to main.
by a push to main. A push or pull request that changes only documentation (`docs/`, the
Markdown at the root, `tests/e2e/README.md`) runs nothing, since no gate reads it.
- **`.github/workflows/release.yml`**, on pushing a tag `v*`:
1. **the tag** (`script/release-check`): an annotated `v<semver>` (a prerelease such as
`v0.2.0-rc.1` too) whose version without the prerelease is the tagged commit's workspace
version, on a commit on main; the tag's message is the release notes;
2. **CI** in full on that commit (ci.yml), alongside
2. **CI** on that commit, alongside the builds: the push to main that brought the commit ran
ci.yml on it, and when that run passes (the release waits for it) it stands for this one;
with no such run, or one that doesn't pass (failed, cancelled, superseded in the queue),
the release runs ci.yml in full itself, without caches;
3. **the builds**, with no cache: the static musl `dv-linux-x86_64` (`script/build-linux
--profile dist`) and the AppImage (`script/package --linux-app`, `vpk pack` on the runner),
then the Windows release (`vpk download github` fetches the latest release's full
package, from which `vpk pack` makes the delta and against which `dv_package` checks the
version newer, then `script/package --version <v> --feed https://github.com/<repo>
--linux-dir … --out …`), and the macOS release on `macos-15` the same way (its channel
--profile dist`, a job of its own) and the AppImage (`script/package --linux-app`, `vpk
pack` on the runner), and once the musl build is done the Windows release (`vpk download
github` fetches the latest release's full package, from which `vpk pack` makes the delta
and against which `dv_package` checks the version newer, then `script/package --version
<v> --feed https://github.com/<repo> --linux-dir … --out …`), and the macOS release on `macos-15` the same way (its channel
`osx`, `script/package --version <v> --feed … --out …`);
4. **publish**, in the `release` environment, which waits for the owner's approval: the
files' `SHA256SUMS`, their build provenance (`actions/attest-build-provenance`), then the
Expand Down
Loading
Loading