Skip to content

feat: release process with install script, version flag, and musl builds#22

Open
Miyamura80 wants to merge 6 commits intomasterfrom
feat/release-process
Open

feat: release process with install script, version flag, and musl builds#22
Miyamura80 wants to merge 6 commits intomasterfrom
feat/release-process

Conversation

@Miyamura80
Copy link
Contributor

@Miyamura80 Miyamura80 commented Mar 21, 2026

Summary

  • --version flag: Outputs version + git SHA (e.g. desktest 0.2.0 (abc1234)) via build.rs compile-time embedding
  • Install script: One-liner curl -fsSL .../install.sh | sh with platform detection, SHA256 checksum verification, DESKTEST_VERSION pinning, musl preference on Linux, and DESKTEST_INSTALL_DIR override
  • musl builds: Added x86_64-unknown-linux-musl and aarch64-unknown-linux-musl targets to release workflow (6 total) for Alpine/minimal Docker image compatibility
  • Version consistency check: New check-version CI job blocks release if git tag doesn't match Cargo.toml
  • make bump_version VERSION=x.y.z: Updates Cargo.toml, commits, and tags in one command

Install usage

# Latest
curl -fsSL https://raw.githubusercontent.com/Edison-Watch/desktest/master/install.sh | sh

# Pinned version
DESKTEST_VERSION=0.2.0 curl -fsSL ... | sh

# Custom install dir (e.g. in Dockerfile)
DESKTEST_INSTALL_DIR=/usr/bin curl -fsSL ... | sh

Test plan

  • cargo test — 377 passed, 0 failed
  • desktest --version outputs desktest 0.2.0 (77b5fa3)
  • Verify release workflow runs on next tag push
  • Test install script on Linux (glibc + musl) and macOS

🤖 Generated with Claude Code


Open with Devin

… builds

- Add build.rs to embed git SHA in --version output (e.g. "desktest 0.2.0 (abc1234)")
- Add install.sh with platform detection, checksum verification, version pinning
  (DESKTEST_VERSION=x.y.z), and musl preference on Linux
- Add musl targets (x86_64/aarch64) to release workflow for Alpine compatibility
- Add check-version job to verify git tag matches Cargo.toml version
- Add make bump_version VERSION=x.y.z for streamlined releases

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
devin-ai-integration[bot]

This comment was marked as resolved.

@greptile-apps
Copy link

greptile-apps bot commented Mar 21, 2026

Greptile Summary

This PR introduces a full release pipeline: a --version flag embedding the git SHA at compile time via build.rs, a rewritten POSIX sh install script with checksum verification and sudo-aware installation, musl cross-compilation targets (x86_64 and aarch64), a check-version CI gate, and a make bump_version helper. The changes address all previously raised review issues (supply-chain verification, TMPDIR shadowing, pipefail, chmod ordering, packed-refs tracking).

Key findings:

  • Logic buginstall.sh unconditionally downloads the *-musl tarball on Linux. Users pinning an older DESKTEST_VERSION that predates musl builds will receive a confusing download failure instead of a graceful fallback to the *-gnu artifact.
  • Cosmetic issueverify_installation logs "Installed desktest $(desktest --version)", but clap's --version already prefixes output with the binary name, resulting in ==> Installed desktest desktest 0.2.0 (abc1234).
  • Minor portability note — The Package step in release.yml uses &> (bash extension) in a run: block that defaults to /bin/sh on GitHub Actions runners.

Confidence Score: 3/5

  • Safe to merge after addressing the musl-only download logic in install.sh, which breaks pinned installs of pre-musl releases.
  • The overall implementation is solid and previous review concerns have been thoroughly addressed. The one blocking issue is the musl-always-on-Linux logic in install.sh that silently breaks DESKTEST_VERSION pinning for any release tag that predates this PR's musl builds — a real regression for users who rely on version pinning.
  • install.sh — musl-only download logic on Linux (lines 36–41) needs a fallback to the gnu build for older releases.

Important Files Changed

Filename Overview
install.sh Rewritten from bash to POSIX sh with improved version pinning, checksum verification, sudo handling, and PATH warnings. A logic bug causes musl-only downloads on Linux, breaking pinned installs of pre-musl releases. Also has a cosmetic double "desktest" in the version log message.
.github/workflows/release.yml Adds check-version gate, four new matrix targets (x86_64/aarch64 musl), and checksum-verified musl.cc toolchain download. Minor POSIX portability note on &> redirect in Package step. Overall solid.
build.rs New build script embeds git SHA at compile time with graceful fallback to "unknown". Correctly tracks HEAD, loose refs, and packed-refs to avoid stale SHA after git gc.
Makefile Adds bump_version target that updates Cargo.toml, runs cargo check (no longer swallowed), commits, and tags. Clean and correct implementation.
src/cli.rs Adds version string embedding CARGO_PKG_VERSION and DESKTEST_GIT_SHA via clap's version attribute. Straightforward and correct.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["curl install.sh | sh"] --> B[detect_platform]
    B --> C{OS?}
    C -- Linux --> D["TARGET = ARCH-unknown-linux-musl ⚠️"]
    C -- Darwin --> E[TARGET = ARCH-apple-darwin]
    C -- Other --> F[err: Unsupported OS]
    D --> G[resolve_version]
    E --> G
    G --> H{DESKTEST_VERSION set?}
    H -- Yes --> I["VERSION = v$DESKTEST_VERSION"]
    H -- No --> J[curl GitHub API for latest tag]
    J --> K{VERSION empty?}
    K -- Yes --> L[err: Failed to fetch]
    K -- No --> M[download_and_install]
    I --> M
    M --> N[Download tarball + SHA256SUMS.txt]
    N --> O[Verify checksum]
    O --> P{INSTALL_DIR writable?}
    P -- Yes --> Q[mkdir + mv + chmod +x]
    P -- No --> R[sudo mkdir + mv + chmod +x]
    Q --> S[verify_installation]
    R --> S
    S --> T{desktest in PATH?}
    T -- Yes --> U[log desktest --version]
    T -- No --> V{INSTALL_DIR in PATH?}
    V -- Yes --> W[log installed path]
    V -- No --> X[warn: add to PATH]
Loading

Comments Outside Diff (1)

  1. .github/workflows/release.yml, line 101-105 (link)

    P2 sha256sum vs shasum inconsistency between Package step and install script

    The workflow uses command -v sha256sum &>/dev/null (bash-style redirect) but this step runs on both Ubuntu (where sha256sum is the standard tool) and macOS (where shasum is standard). The &> redirect is a bash extension; the shebang for GitHub Actions inline run: steps is /bin/sh by default.

    More importantly: the sha256sum output format includes a relative path (./desktest-...tar.gz) when sha256sum is invoked on the tarball with a relative path, but GNU sha256sum outputs just the filename (no leading ./) when passed a bare filename. The install script's grep "${TARBALL}" would match either form, but it's worth being explicit.

    Consider pinning the run: to bash with shell: bash to use &> safely, or replace &> with >/dev/null 2>&1 for POSIX compatibility:

            if command -v sha256sum >/dev/null 2>&1; then
              sha256sum desktest-${{ github.ref_name }}-${{ matrix.target }}.tar.gz >> checksums.txt
            else
              shasum -a 256 desktest-${{ github.ref_name }}-${{ matrix.target }}.tar.gz >> checksums.txt
            fi

Last reviewed commit: "fix: chmod +x under ..."

greptile-apps[bot]

This comment was marked as resolved.

Miyamura80 and others added 2 commits March 21, 2026 21:50
- Fix silent empty VERSION when GitHub API fails (add explicit empty check)
- Rename TMPDIR to DL_TMPDIR to avoid shadowing POSIX env var
- Use %b format specifier in printf helpers for proper \n handling
- Use real newlines instead of \n escapes in multi-line error messages
- Pin musl.cc download with SHA256 checksum verification
- Fix install dir writability check to test parent dir when target doesn't exist
- Abort version bump on cargo check failure instead of silently continuing

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Miyamura80
Copy link
Contributor Author

@greptileai

greptile-apps[bot]

This comment was marked as resolved.

- Move chmod +x inside the sudo/non-sudo branches so it doesn't fail
  on root-owned binaries with set -eu
- Add .git/packed-refs to rerun-if-changed so the embedded SHA stays
  fresh after git gc or in cloned repos with packed refs

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Miyamura80
Copy link
Contributor Author

@greptileai

devin-ai-integration[bot]

This comment was marked as resolved.

greptile-apps[bot]

This comment was marked as resolved.

Miyamura80 and others added 2 commits March 21, 2026 22:49
…ld releases

- Change test skip from !contains('aarch64') to !contains('aarch64-unknown-linux')
  so aarch64-apple-darwin (native on Apple Silicon) still runs tests
- Add gnu fallback in install.sh when musl tarball is not found, supporting
  pinned installs of pre-musl releases

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The Package step used `&>/dev/null` which is a bash extension. Replace
with `>/dev/null 2>&1` for POSIX compatibility.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant