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
112 changes: 8 additions & 104 deletions .github/workflows/patch-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,112 +91,16 @@ jobs:
fi
echo "Version still pinned at $CARGO_VERSION — safe to patch in place."

# ── Build matrix ────────────────────────────────────────────────────
# Mirrors release.yml exactly — keep these two job specs in sync.
# ── Build: the five targets, in release-build.yml ──────────────────
# Same build as release.yml, with the patch release's own inputs: its
# checkout keeps credentials and it installs libssl-dev.
build:
needs: preflight
strategy:
fail-fast: true
matrix:
include:
- target: x86_64-pc-windows-msvc
os: windows-latest
artifact: coven-code-windows-x86_64
ext: .exe
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
artifact: coven-code-linux-x86_64
ext: ""
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
artifact: coven-code-linux-aarch64
ext: ""
cross: true
- target: x86_64-apple-darwin
os: macos-latest
artifact: coven-code-macos-x86_64
ext: ""
- target: aarch64-apple-darwin
os: macos-latest
artifact: coven-code-macos-aarch64
ext: ""

runs-on: ${{ matrix.os }}
name: Build ${{ matrix.artifact }}

steps:
- uses: actions/checkout@v5

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@1.100.0
with:
targets: ${{ matrix.target }}

- name: Install Linux system dependencies
if: runner.os == 'Linux' && !matrix.cross
run: |
sudo apt-get update
sudo apt-get install -y libasound2-dev libssl-dev pkg-config

- name: Install cross (aarch64-linux)
if: matrix.cross
run: cargo install cross --git https://github.com/cross-rs/cross

- name: Cache cargo registry & build
uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
src-rust/target
key: ${{ matrix.target }}-cargo-${{ hashFiles('src-rust/Cargo.lock') }}
restore-keys: ${{ matrix.target }}-cargo-

- name: Build release binary (native)
if: ${{ !matrix.cross }}
working-directory: src-rust
run: cargo build --release --locked --package claurst --target ${{ matrix.target }}

- name: Create Cross.toml for cross-compilation
if: matrix.cross
working-directory: src-rust
run: |
cat > Cross.toml << 'EOF'
[target.aarch64-unknown-linux-gnu]
pre-build = [
"dpkg --add-architecture $CROSS_DEB_ARCH",
"apt-get update",
"apt-get install -y pkg-config libssl-dev:$CROSS_DEB_ARCH libasound2-dev:$CROSS_DEB_ARCH"
]
EOF

- name: Build release binary (cross)
if: matrix.cross
working-directory: src-rust
run: cross build --release --locked --package claurst --target ${{ matrix.target }}

- name: Verify binary exists
shell: bash
run: |
BINARY="src-rust/target/${{ matrix.target }}/release/coven-code${{ matrix.ext }}"
if [[ ! -f "$BINARY" ]]; then
echo "::error::Binary not found at $BINARY"
exit 1
fi
ls -lh "$BINARY"

- name: Stage binary for packaging
shell: bash
run: |
mkdir -p "stage/${{ matrix.artifact }}"
cp "src-rust/target/${{ matrix.target }}/release/coven-code${{ matrix.ext }}" \
"stage/${{ matrix.artifact }}/coven-code${{ matrix.ext }}"

- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: ${{ matrix.artifact }}
path: stage/${{ matrix.artifact }}/coven-code${{ matrix.ext }}
uses: ./.github/workflows/release-build.yml
with:
persist-credentials: true
openssl: true
cargo-term-color: always

# ── Re-upload assets to the existing release ────────────────────────
patch:
Expand Down
143 changes: 143 additions & 0 deletions .github/workflows/release-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
name: Release build

# The five-target build that release.yml, patch-release.yml and
# release-candidate.yml share (#368). A called workflow sees none of its
# caller's env, so every setting arrives as an input. It declares no
# permissions and uses no secrets: its token is the calling job's.
on:
workflow_call:
inputs:
persist-credentials:
description: Keep the checkout token in the local git config (the patch release does).
type: boolean
required: true
openssl:
description: Also install libssl-dev, natively and in the cross image (the patch release does).
type: boolean
required: true
cargo-term-color:
description: CARGO_TERM_COLOR for every step.
type: string
required: true
upload:
description: Upload each binary as a run artifact; off only for a build that is just being tried.
type: boolean
default: true

env:
CARGO_TERM_COLOR: ${{ inputs.cargo-term-color }}

jobs:
build:
strategy:
fail-fast: true
matrix:
include:
- target: x86_64-pc-windows-msvc
os: windows-latest
artifact: coven-code-windows-x86_64
ext: .exe
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
artifact: coven-code-linux-x86_64
ext: ""
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
artifact: coven-code-linux-aarch64
ext: ""
cross: true
- target: x86_64-apple-darwin
os: macos-latest
artifact: coven-code-macos-x86_64
ext: ""
- target: aarch64-apple-darwin
os: macos-latest
artifact: coven-code-macos-aarch64
ext: ""

runs-on: ${{ matrix.os }}
name: Build ${{ matrix.artifact }}

steps:
- uses: actions/checkout@v5
with:
persist-credentials: ${{ inputs.persist-credentials }}

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@1.100.0
with:
targets: ${{ matrix.target }}

# Linux native: install system libraries for ALSA (voice feature).
- name: Install Linux system dependencies
if: runner.os == 'Linux' && !matrix.cross
run: |
sudo apt-get update
sudo apt-get install -y libasound2-dev ${{ inputs.openssl && 'libssl-dev ' || '' }}pkg-config

# Linux ARM64: use cross for reliable cross-compilation (handles
# sysroot, pkg-config, ALSA automatically via Docker).
- name: Install cross (aarch64-linux)
if: matrix.cross
run: cargo install cross --git https://github.com/cross-rs/cross

- name: Cache cargo registry & build
uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
src-rust/target
key: ${{ matrix.target }}-cargo-${{ hashFiles('src-rust/Cargo.lock') }}
restore-keys: ${{ matrix.target }}-cargo-

- name: Build release binary (native)
if: ${{ !matrix.cross }}
working-directory: src-rust
run: cargo build --release --locked --package claurst --target ${{ matrix.target }}

- name: Create Cross.toml for cross-compilation
if: matrix.cross
working-directory: src-rust
run: |
cat > Cross.toml << 'EOF'
[target.aarch64-unknown-linux-gnu]
pre-build = [
"dpkg --add-architecture $CROSS_DEB_ARCH",
"apt-get update",
"apt-get install -y pkg-config ${{ inputs.openssl && 'libssl-dev:$CROSS_DEB_ARCH ' || '' }}libasound2-dev:$CROSS_DEB_ARCH"
]
EOF

- name: Build release binary (cross)
if: matrix.cross
working-directory: src-rust
run: cross build --release --locked --package claurst --target ${{ matrix.target }}

- name: Verify binary exists
shell: bash
run: |
BINARY="src-rust/target/${{ matrix.target }}/release/coven-code${{ matrix.ext }}"
if [[ ! -f "$BINARY" ]]; then
echo "::error::Binary not found at $BINARY"
exit 1
fi
ls -lh "$BINARY"

# Stage the binary into a per-archive directory using the canonical
# name "coven-code" (or "coven-code.exe"). The install scripts assume this
# name inside the archive — do not change without updating install.sh
# and install.ps1.
- name: Stage binary for packaging
shell: bash
run: |
mkdir -p "stage/${{ matrix.artifact }}"
cp "src-rust/target/${{ matrix.target }}/release/coven-code${{ matrix.ext }}" \
"stage/${{ matrix.artifact }}/coven-code${{ matrix.ext }}"

- name: Upload artifact
if: inputs.upload
uses: actions/upload-artifact@v7
with:
name: ${{ matrix.artifact }}
path: stage/${{ matrix.artifact }}/coven-code${{ matrix.ext }}
Loading
Loading