Add the plan2code-app desktop app, its CI workflows and docs

AI Assisted
This commit is contained in:
jparkerweb committed 2026-10-23 10:09:18 -07:00
1 parent 681c4a4b85
commit a5a3a81c5f
55 files changed
+13277

No files matched your search

+101
View File
@@ -0,0 +1,101 @@
name: app
on:
push:
branches: [main]
pull_request:
jobs:
app:
name: app (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
defaults:
run:
working-directory: plan2code-app
steps:
- uses: actions/checkout@v4.2.2
- uses: actions/setup-node@v4.4.0
with:
node-version: 20
cache: npm
cache-dependency-path: plan2code-app/package-lock.json
- name: Check the versions agree
working-directory: .
run: node scripts/check-versions.mjs
- name: Install the pinned Rust toolchain
shell: bash
# clippy and rustfmt are not part of rust-toolchain.toml's minimal profile.
run: rustup toolchain install "$(grep channel rust-toolchain.toml | cut -d '"' -f2)" --profile minimal --component clippy --component rustfmt
- name: Cache the Cargo registry and build output
uses: actions/cache@v6.1.0
with:
path: |
~/.cargo/registry
~/.cargo/git
plan2code-app/target
key: cargo-${{ runner.os }}-${{ hashFiles('plan2code-app/Cargo.lock') }}
restore-keys: |
cargo-${{ runner.os }}-
- name: Install Linux system packages
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev build-essential libxdo-dev libssl-dev libayatana-appindicator3-dev librsvg2-dev xvfb
- name: Install the app's packages
run: npm ci
- name: Vendor the xterm files cargo needs
# `tauri build` runs this itself (beforeBuildCommand in tauri.conf.json); the cargo
# steps below call straight into cargo and skip that, so they need it run by hand.
run: node scripts/vendor.mjs
- name: Format check
run: cargo fmt --check
- name: Lint
run: cargo clippy --workspace --all-targets -- -D warnings
- name: Test
run: cargo test --workspace
- name: Build
run: cargo build --workspace
- name: Build the app (tauri build --no-bundle)
run: npm run tauri -- build --no-bundle
- name: Smoke-test the built app against the fake agent
shell: bash
# Points the real app at tests/agent_manager.rs's fake-agent fixture (already built
# by the "Build" step above, in target/debug) and checks the real binary comes up and
# stays up for a few seconds instead of crashing. Linux has no display by default.
run: |
exe=plan2code-app
agent=fake-agent
if [ "${{ runner.os }}" = "Windows" ]; then exe="$exe.exe"; agent="$agent.exe"; fi
export PLAN2CODE_APP_AGENT_BIN="$(pwd)/target/debug/$agent"
launch=("target/release/$exe")
if [ "${{ runner.os }}" = "Linux" ]; then launch=(xvfb-run -a "target/release/$exe"); fi
"${launch[@]}" &
pid=$!
sleep 5
if kill -0 "$pid" 2>/dev/null; then
echo "plan2code-app is still running after 5s; smoke test passed"
kill "$pid"
else
wait "$pid"
echo "plan2code-app exited within 5s (exit code $?); smoke test failed"
exit 1
fi
node-tests:
name: npm test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
steps:
- uses: actions/checkout@v4.2.2
- uses: actions/setup-node@v4.4.0
with:
node-version: 20
- run: npm install
- run: npm test
+119
View File
@@ -0,0 +1,119 @@
name: release-app
# Builds the desktop app on four systems when a GitHub release is published, or a v* tag is
# pushed ahead of one, and attaches one file per system, named
# plan2code-app-<version>-<os>-<arch>[.exe], plus one checksum file
# (plan2code-app-<version>-SHA256SUMS.txt). install.js fetches the matching file and checks it
# against that list. Linux ships the plain binary, not an AppImage: docs/desktop-app.md documents
# its WebKitGTK 4.1 dependency instead. The first release is unsigned: docs/desktop-app.md says
# how to allow it.
on:
release:
types: [published]
push:
tags: ['v*']
permissions:
contents: write
jobs:
build:
name: build (${{ matrix.label }})
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- { runner: windows-latest, label: windows-x64, built: plan2code-app.exe, suffix: .exe }
- { runner: macos-latest, label: macos-arm64, built: plan2code-app, suffix: '' }
- { runner: macos-13, label: macos-x64, built: plan2code-app, suffix: '' }
- { runner: ubuntu-latest, label: linux-x64, built: plan2code-app, suffix: '' }
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4.2.2
- uses: actions/setup-node@v4.4.0
with:
node-version: 22
cache: npm
cache-dependency-path: plan2code-app/package-lock.json
- name: Check the versions agree with the release tag
env:
TAG: ${{ github.event.release.tag_name || github.ref_name }}
run: node scripts/check-versions.mjs --tag "$TAG"
- name: Install the pinned Rust toolchain
working-directory: plan2code-app
run: rustup toolchain install "$(grep channel rust-toolchain.toml | cut -d '"' -f2)" --profile minimal
- name: Cache the Cargo registry and build output
uses: actions/cache@v6.1.0
with:
path: |
~/.cargo/registry
~/.cargo/git
plan2code-app/target
key: cargo-release-${{ matrix.label }}-${{ hashFiles('plan2code-app/Cargo.lock') }}
restore-keys: |
cargo-release-${{ matrix.label }}-
- name: Install Linux system packages
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev build-essential libxdo-dev libssl-dev libayatana-appindicator3-dev librsvg2-dev
- name: Install the app's packages
working-directory: plan2code-app
run: npm ci
# One plain executable per system: the web page is built into it, so it needs no installer.
- name: Build
working-directory: plan2code-app
run: npm run tauri -- build --no-bundle
- name: Name the file
run: |
VERSION="$(node -p "require('./plan2code-app/src-tauri/tauri.conf.json').version")"
mkdir -p dist
cp "plan2code-app/target/release/${{ matrix.built }}" "dist/plan2code-app-${VERSION}-${{ matrix.label }}${{ matrix.suffix }}"
- uses: actions/upload-artifact@v4.6.2
with:
name: app-${{ matrix.label }}
path: dist/*
if-no-files-found: error
publish:
name: attach to the release
needs: build
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ github.event.release.tag_name || github.ref_name }}
steps:
- uses: actions/checkout@v4.2.2
- uses: actions/download-artifact@v4.3.0
with:
path: dist
pattern: app-*
merge-multiple: true
- name: Verify every system's file is here
run: |
VERSION="$(node -p "require('./plan2code-app/src-tauri/tauri.conf.json').version")"
cd dist
missing=0
for name in "plan2code-app-${VERSION}-windows-x64.exe" "plan2code-app-${VERSION}-macos-arm64" "plan2code-app-${VERSION}-macos-x64" "plan2code-app-${VERSION}-linux-x64"; do
if [ ! -f "$name" ]; then
echo "::error::missing release asset $name"
missing=1
fi
done
[ "$missing" -eq 0 ]
- name: Write the checksum file
run: |
VERSION="$(node -p "require('./plan2code-app/src-tauri/tauri.conf.json').version")"
cd dist
sha256sum plan2code-app-* > "plan2code-app-${VERSION}-SHA256SUMS.txt"
cat "plan2code-app-${VERSION}-SHA256SUMS.txt"
- name: Make sure the release exists
# A tag push alone names no release; create one (same tag, generated notes) so the
# upload below always has somewhere to go, whichever trigger ran it.
run: gh release view "$TAG" || gh release create "$TAG" --title "$TAG" --generate-notes
- name: Attach to the release
run: gh release upload "$TAG" dist/* --clobber