|
| 1 | +name: Release candidate build |
| 2 | + |
| 3 | +# Builds, packages and runs the five release archives without publishing. |
| 4 | +# Nothing here can create a tag or a release: the token is read-only and no |
| 5 | +# step uploads anywhere except this run's own artifacts. |
| 6 | +on: |
| 7 | + pull_request: |
| 8 | + paths: |
| 9 | + - '.github/workflows/release-candidate.yml' |
| 10 | + - '.github/workflows/release.yml' |
| 11 | + - 'scripts/package-release.py' |
| 12 | + - 'scripts/generate-release-checksums.mjs' |
| 13 | + - 'scripts/smoke-release-archive.py' |
| 14 | + - 'scripts/test-release-candidate.py' |
| 15 | + # bump-version.py rewrites this file, so a version-stamp pull request |
| 16 | + # gets its candidate archives built and run before the release. |
| 17 | + - 'src-rust/crates/acp/registry-template/agent.json' |
| 18 | + workflow_dispatch: |
| 19 | + |
| 20 | +concurrency: |
| 21 | + group: release-candidate-${{ github.ref }} |
| 22 | + cancel-in-progress: true |
| 23 | + |
| 24 | +permissions: |
| 25 | + contents: read |
| 26 | + |
| 27 | +env: |
| 28 | + CARGO_TERM_COLOR: always |
| 29 | + |
| 30 | +jobs: |
| 31 | + # ── Contract: workflow mirror, smoke fixtures and stamp preflight ─── |
| 32 | + contract: |
| 33 | + runs-on: ubuntu-latest |
| 34 | + name: Candidate contract and stamps |
| 35 | + timeout-minutes: 5 |
| 36 | + steps: |
| 37 | + - uses: actions/checkout@v5 |
| 38 | + with: |
| 39 | + persist-credentials: false |
| 40 | + |
| 41 | + - uses: actions/setup-python@v6 |
| 42 | + with: |
| 43 | + python-version: '3.12' |
| 44 | + |
| 45 | + - name: Verify the build mirrors release.yml and cannot publish |
| 46 | + run: python3 -B scripts/test-release-candidate.py -v |
| 47 | + |
| 48 | + # A stamped version with no tag yet is a real candidate and gets the |
| 49 | + # release preflight. An already released version only rehearses the build. |
| 50 | + - name: Verify canonical stamps for an unreleased version |
| 51 | + run: | |
| 52 | + version="v$(python3 -c "import pathlib, tomllib; print(tomllib.loads(pathlib.Path('src-rust/Cargo.toml').read_text())['workspace']['package']['version'])")" |
| 53 | + if git ls-remote --exit-code --tags origin "refs/tags/$version" >/dev/null 2>&1; then |
| 54 | + echo "::notice::$version is already released. This run rehearses the release build; it is not a release candidate." |
| 55 | + else |
| 56 | + python scripts/check-release-version.py "$version" |
| 57 | + fi |
| 58 | +
|
| 59 | + # ── Build matrix: kept identical to the build job in release.yml ──── |
| 60 | + build: |
| 61 | + needs: contract |
| 62 | + strategy: |
| 63 | + fail-fast: true |
| 64 | + matrix: |
| 65 | + include: |
| 66 | + - target: x86_64-pc-windows-msvc |
| 67 | + os: windows-latest |
| 68 | + artifact: coven-code-windows-x86_64 |
| 69 | + ext: .exe |
| 70 | + - target: x86_64-unknown-linux-gnu |
| 71 | + os: ubuntu-latest |
| 72 | + artifact: coven-code-linux-x86_64 |
| 73 | + ext: "" |
| 74 | + - target: aarch64-unknown-linux-gnu |
| 75 | + os: ubuntu-latest |
| 76 | + artifact: coven-code-linux-aarch64 |
| 77 | + ext: "" |
| 78 | + cross: true |
| 79 | + - target: x86_64-apple-darwin |
| 80 | + os: macos-latest |
| 81 | + artifact: coven-code-macos-x86_64 |
| 82 | + ext: "" |
| 83 | + - target: aarch64-apple-darwin |
| 84 | + os: macos-latest |
| 85 | + artifact: coven-code-macos-aarch64 |
| 86 | + ext: "" |
| 87 | + |
| 88 | + runs-on: ${{ matrix.os }} |
| 89 | + name: Build ${{ matrix.artifact }} |
| 90 | + |
| 91 | + steps: |
| 92 | + - uses: actions/checkout@v5 |
| 93 | + with: |
| 94 | + persist-credentials: false |
| 95 | + |
| 96 | + - name: Install Rust toolchain |
| 97 | + uses: dtolnay/rust-toolchain@1.100.0 |
| 98 | + with: |
| 99 | + targets: ${{ matrix.target }} |
| 100 | + |
| 101 | + # Linux native: install system libraries for ALSA (voice feature). |
| 102 | + - name: Install Linux system dependencies |
| 103 | + if: runner.os == 'Linux' && !matrix.cross |
| 104 | + run: | |
| 105 | + sudo apt-get update |
| 106 | + sudo apt-get install -y libasound2-dev pkg-config |
| 107 | +
|
| 108 | + # Linux ARM64: use cross for reliable cross-compilation (handles |
| 109 | + # sysroot, pkg-config, ALSA automatically via Docker). |
| 110 | + - name: Install cross (aarch64-linux) |
| 111 | + if: matrix.cross |
| 112 | + run: cargo install cross --git https://github.com/cross-rs/cross |
| 113 | + |
| 114 | + - name: Cache cargo registry & build |
| 115 | + uses: actions/cache@v5 |
| 116 | + with: |
| 117 | + path: | |
| 118 | + ~/.cargo/registry |
| 119 | + ~/.cargo/git |
| 120 | + src-rust/target |
| 121 | + key: ${{ matrix.target }}-cargo-${{ hashFiles('src-rust/Cargo.lock') }} |
| 122 | + restore-keys: ${{ matrix.target }}-cargo- |
| 123 | + |
| 124 | + - name: Build release binary (native) |
| 125 | + if: ${{ !matrix.cross }} |
| 126 | + working-directory: src-rust |
| 127 | + run: cargo build --release --locked --package claurst --target ${{ matrix.target }} |
| 128 | + |
| 129 | + - name: Create Cross.toml for cross-compilation |
| 130 | + if: matrix.cross |
| 131 | + working-directory: src-rust |
| 132 | + run: | |
| 133 | + cat > Cross.toml << 'EOF' |
| 134 | + [target.aarch64-unknown-linux-gnu] |
| 135 | + pre-build = [ |
| 136 | + "dpkg --add-architecture $CROSS_DEB_ARCH", |
| 137 | + "apt-get update", |
| 138 | + "apt-get install -y pkg-config libasound2-dev:$CROSS_DEB_ARCH" |
| 139 | + ] |
| 140 | + EOF |
| 141 | +
|
| 142 | + - name: Build release binary (cross) |
| 143 | + if: matrix.cross |
| 144 | + working-directory: src-rust |
| 145 | + run: cross build --release --locked --package claurst --target ${{ matrix.target }} |
| 146 | + |
| 147 | + - name: Verify binary exists |
| 148 | + shell: bash |
| 149 | + run: | |
| 150 | + BINARY="src-rust/target/${{ matrix.target }}/release/coven-code${{ matrix.ext }}" |
| 151 | + if [[ ! -f "$BINARY" ]]; then |
| 152 | + echo "::error::Binary not found at $BINARY" |
| 153 | + exit 1 |
| 154 | + fi |
| 155 | + ls -lh "$BINARY" |
| 156 | +
|
| 157 | + # Stage the binary into a per-archive directory using the canonical |
| 158 | + # name "coven-code" (or "coven-code.exe"). The install scripts assume this |
| 159 | + # name inside the archive — do not change without updating install.sh |
| 160 | + # and install.ps1. |
| 161 | + - name: Stage binary for packaging |
| 162 | + shell: bash |
| 163 | + run: | |
| 164 | + mkdir -p "stage/${{ matrix.artifact }}" |
| 165 | + cp "src-rust/target/${{ matrix.target }}/release/coven-code${{ matrix.ext }}" \ |
| 166 | + "stage/${{ matrix.artifact }}/coven-code${{ matrix.ext }}" |
| 167 | +
|
| 168 | + - name: Upload artifact |
| 169 | + uses: actions/upload-artifact@v7 |
| 170 | + with: |
| 171 | + name: ${{ matrix.artifact }} |
| 172 | + path: stage/${{ matrix.artifact }}/coven-code${{ matrix.ext }} |
| 173 | + |
| 174 | + # ── Package exactly as the release job does, then keep the result ─── |
| 175 | + package: |
| 176 | + needs: build |
| 177 | + runs-on: ubuntu-latest |
| 178 | + name: Package archives without publishing |
| 179 | + timeout-minutes: 10 |
| 180 | + |
| 181 | + steps: |
| 182 | + - uses: actions/checkout@v5 |
| 183 | + with: |
| 184 | + persist-credentials: false |
| 185 | + |
| 186 | + - name: Download all artifacts |
| 187 | + uses: actions/download-artifact@v8 |
| 188 | + with: |
| 189 | + path: artifacts |
| 190 | + |
| 191 | + - uses: actions/setup-python@v6 |
| 192 | + with: |
| 193 | + python-version: '3.12' |
| 194 | + |
| 195 | + - name: Validate and package release artifacts |
| 196 | + run: | |
| 197 | + python scripts/package-release.py artifacts release |
| 198 | + node scripts/generate-release-checksums.mjs release |
| 199 | + ls -lh release/ |
| 200 | + cat release/SHA256SUMS |
| 201 | +
|
| 202 | + - name: Upload candidate archives |
| 203 | + uses: actions/upload-artifact@v7 |
| 204 | + with: |
| 205 | + name: release-candidate |
| 206 | + path: release/ |
| 207 | + retention-days: 14 |
| 208 | + |
| 209 | + # ── Native smoke: each archive runs on its own platform ───────────── |
| 210 | + smoke: |
| 211 | + needs: package |
| 212 | + strategy: |
| 213 | + fail-fast: false |
| 214 | + matrix: |
| 215 | + include: |
| 216 | + - artifact: coven-code-windows-x86_64 |
| 217 | + os: windows-latest |
| 218 | + - artifact: coven-code-linux-x86_64 |
| 219 | + os: ubuntu-latest |
| 220 | + - artifact: coven-code-linux-aarch64 |
| 221 | + os: ubuntu-24.04-arm |
| 222 | + - artifact: coven-code-macos-x86_64 |
| 223 | + os: macos-15-intel |
| 224 | + - artifact: coven-code-macos-aarch64 |
| 225 | + os: macos-latest |
| 226 | + |
| 227 | + runs-on: ${{ matrix.os }} |
| 228 | + name: Run ${{ matrix.artifact }} |
| 229 | + timeout-minutes: 15 |
| 230 | + |
| 231 | + steps: |
| 232 | + - uses: actions/checkout@v5 |
| 233 | + with: |
| 234 | + persist-credentials: false |
| 235 | + |
| 236 | + - name: Download candidate archives |
| 237 | + uses: actions/download-artifact@v8 |
| 238 | + with: |
| 239 | + name: release-candidate |
| 240 | + path: release |
| 241 | + |
| 242 | + - uses: actions/setup-python@v6 |
| 243 | + with: |
| 244 | + python-version: '3.12' |
| 245 | + |
| 246 | + # Linux archives load the system ALSA library for the voice feature. |
| 247 | + - name: Install the Linux audio runtime library |
| 248 | + if: runner.os == 'Linux' |
| 249 | + run: | |
| 250 | + sudo apt-get update |
| 251 | + sudo apt-get install -y libasound2t64 || sudo apt-get install -y libasound2 |
| 252 | +
|
| 253 | + - name: Verify digest, contents, version and one turn |
| 254 | + run: python scripts/smoke-release-archive.py release ${{ matrix.artifact }} |
0 commit comments