GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — opencode/.github/workflows/release-process-daemon.yml at dev · ismet/opencode 393 lines (383 loc) · 19.2 KB / Copy pathrelease-process-daemon.ymlFile metadata and controls393 lines (383 loc) · 19.2 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 name: Process daemon release # Publishes the opencode-pty binaries and the @opencode/pty npm packages from packages/process-daemon. # Only process-daemon-v<version> tags publish; pull requests that touch the release pipeline build and pack # without publishing. on: push: tags: - "process-daemon-v*" pull_request: paths: - .github/actions/prefetch-ghostty/** - .github/workflows/release-process-daemon.yml - packages/process-daemon/build.rs - packages/process-daemon/ghostty-revision - packages/process-daemon/npm/** - packages/process-daemon/script/npm-packages.mjs workflow_dispatch: permissions: contents: read defaults: run: working-directory: packages/process-daemon env: CARGO_TERM_COLOR: always ZIG_VERSION: 0.16.0 GNU_GLIBC_VERSION: "2.30" CARGO_ZIGBUILD_VERSION: 0.23.2 jobs: checks: runs-on: ubuntu-22.04 outputs: protocol: ${{ steps.protocol.outputs.protocol }} steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - uses: mlugg/setup-zig@8d6198c65fb0feaa111df26e6b467fea8345e46f # v2.0.5 with: version: ${{ env.ZIG_VERSION }} use-cache: false - uses: ./.github/actions/prefetch-ghostty - name: Configure baseline Zig builds run: | chmod +x "$GITHUB_WORKSPACE/packages/process-daemon/script/release-bin/zig" echo "OPENCODE_REAL_ZIG=$(command -v zig)" >> "$GITHUB_ENV" echo "$GITHUB_WORKSPACE/packages/process-daemon/script/release-bin" >> "$GITHUB_PATH" - name: Install Rust run: rustup toolchain install 1.90.0 --profile minimal --component clippy --component rustfmt - name: Read protocol version id: protocol run: | protocol="$(sed -nE 's/^pub const PROTOCOL_VERSION: u32 = ([0-9]+);$/\1/p' src/protocol.rs)" test -n "$protocol" echo "protocol=$protocol" >> "$GITHUB_OUTPUT" - name: Validate tag run: | package_version="$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[] | select(.name == "opencode-pty") | .version')" npm_version="$(node -p 'require("./npm/package.json").version')" test "$package_version" = "$npm_version" node -e 'const pkg = require("./npm/package.json"); if (Object.values(pkg.optionalDependencies).some(version => version !== pkg.version)) process.exit(1)' if [[ "$GITHUB_REF" == refs/tags/* ]]; then [[ "$GITHUB_REF_NAME" =~ ^process-daemon-v[0-9]+\.[0-9]+\.[0-9]+([+-][0-9A-Za-z.-]+)?$ ]] test "${GITHUB_REF_NAME#process-daemon-v}" = "$package_version" fi - run: cargo fmt --check - run: cargo clippy --all-targets --all-features -- -D warnings build: needs: checks strategy: fail-fast: false matrix: include: - runner: ubuntu-22.04 target: x86_64-unknown-linux-gnu - runner: ubuntu-22.04-arm target: aarch64-unknown-linux-gnu - runner: ubuntu-22.04 target: x86_64-unknown-linux-musl musl: true - runner: ubuntu-22.04-arm target: aarch64-unknown-linux-musl musl: true - runner: macos-15-intel target: x86_64-apple-darwin - runner: blacksmith-6vcpu-macos-15 target: aarch64-apple-darwin runs-on: ${{ matrix.runner }} env: PROTOCOL_VERSION: ${{ needs.checks.outputs.protocol }} MACOSX_DEPLOYMENT_TARGET: "11.0" steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - uses: mlugg/setup-zig@8d6198c65fb0feaa111df26e6b467fea8345e46f # v2.0.5 with: version: ${{ env.ZIG_VERSION }} use-cache: false - uses: ./.github/actions/prefetch-ghostty - name: Configure baseline Zig builds run: | chmod +x "$GITHUB_WORKSPACE/packages/process-daemon/script/release-bin/zig" echo "OPENCODE_REAL_ZIG=$(command -v zig)" >> "$GITHUB_ENV" echo "$GITHUB_WORKSPACE/packages/process-daemon/script/release-bin" >> "$GITHUB_PATH" - name: Install musl toolchain if: matrix.musl run: sudo apt-get update && sudo apt-get install -y musl-tools - name: Install Rust target run: rustup toolchain install 1.90.0 --profile minimal --target "${{ matrix.target }}" - name: Install glibc baseline linker if: endsWith(matrix.target, '-linux-gnu') run: cargo install cargo-zigbuild --locked --version "$CARGO_ZIGBUILD_VERSION" - name: Test service run: cargo test --locked --target "${{ matrix.target }}" --lib --test service --test ownership - name: Test CLI integration if: runner.os != 'macOS' run: cargo test --locked --target "${{ matrix.target }}" --test playground - name: Build run: | if [[ "${{ matrix.target }}" == *-linux-gnu ]]; then cargo zigbuild --locked --release --target "${{ matrix.target }}.$GNU_GLIBC_VERSION" else cargo build --locked --release --target "${{ matrix.target }}" fi - name: Verify glibc baseline if: endsWith(matrix.target, '-linux-gnu') run: | binary="target/${{ matrix.target }}/release/opencode-pty" required="$(readelf --version-info "$binary" | grep -oE 'GLIBC_[0-9]+(\.[0-9]+)+' | sed 's/GLIBC_//' | sort -V | tail -n 1)" echo "Highest required glibc version: $required" test "$(printf '%s\n' "$required" "$GNU_GLIBC_VERSION" | sort -V | tail -n 1)" = "$GNU_GLIBC_VERSION" - name: Smoke test run: | version="$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[] | select(.name == "opencode-pty") | .version')" binary="target/${{ matrix.target }}/release/opencode-pty" output="$("$binary" --version)" test "$output" = "opencode-pty $version (protocol $PROTOCOL_VERSION)" runtime="$RUNNER_TEMP/opencode-pty-release-smoke" rm -rf "$runtime" printf 'new /bin/sh -c "printf release-smoke; sleep 1"\nwait 250\nquit\n' \ | "$binary" play --runtime-dir "$runtime" --name smoke > "$RUNNER_TEMP/opencode-pty-release-smoke.log" grep -q 'release-smoke' "$RUNNER_TEMP/opencode-pty-release-smoke.log" grep -q 'checkpoint' "$RUNNER_TEMP/opencode-pty-release-smoke.log" test ! -e "$runtime/smoke" - name: Package run: | version="$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[] | select(.name == "opencode-pty") | .version')" name="opencode-pty-${version}-${{ matrix.target }}" mkdir -p "dist/$name" cp "target/${{ matrix.target }}/release/opencode-pty" "dist/$name/" cp LICENSE README.md "dist/$name/" tar -C dist -czf "dist/$name.tar.gz" "$name" - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: name: opencode-pty-${{ matrix.target }} path: packages/process-daemon/dist/*.tar.gz if-no-files-found: error build-windows: needs: checks strategy: fail-fast: false matrix: include: - runner: windows-2025 target: x86_64-pc-windows-msvc arch: x64 - runner: windows-11-arm target: aarch64-pc-windows-msvc arch: arm64 runs-on: ${{ matrix.runner }} timeout-minutes: 60 defaults: run: shell: pwsh working-directory: packages/process-daemon env: PROTOCOL_VERSION: ${{ needs.checks.outputs.protocol }} CARGO_BUILD_TARGET: ${{ matrix.target }} RUSTUP_TOOLCHAIN: 1.90.0-x86_64-pc-windows-msvc # Portable CPU for Ghostty (see build.rs) and no Visual C++ runtime dependency. OPENCODE_ZIG_CPU: baseline RUSTFLAGS: -C target-feature=+crt-static steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Enable long dependency paths run: git config --global core.longpaths true - uses: mlugg/setup-zig@8d6198c65fb0feaa111df26e6b467fea8345e46f # v2.0.5 if: matrix.arch == 'x64' with: version: ${{ env.ZIG_VERSION }} use-cache: false # Zig 0.16 crashes when building Ghostty on the native ARM64 host, so use # the x64-hosted compiler there (matching check-process-daemon.yml). - name: Install x64 Zig for ARM64 cross-compilation if: matrix.arch == 'arm64' run: | $archive = Join-Path $env:RUNNER_TEMP 'zig-x64.zip' Invoke-WebRequest 'https://ziglang.org/download/0.16.0/zig-x86_64-windows-0.16.0.zip' -OutFile $archive if ((Get-FileHash $archive -Algorithm SHA256).Hash -ne '68659eb5f1e4eb1437a722f1dd889c5a322c9954607f5edcf337bc3684a75a7e') { throw 'Zig archive checksum mismatch' } Expand-Archive $archive -DestinationPath $env:RUNNER_TEMP Join-Path $env:RUNNER_TEMP 'zig-x86_64-windows-0.16.0' >> $env:GITHUB_PATH - name: Fix Zig 0.16 ARM64 function-pointer alignment if: matrix.arch == 'arm64' run: | $file = Join-Path $env:RUNNER_TEMP 'zig-x86_64-windows-0.16.0/lib/std/debug/SelfInfo/Windows.zig' $source = [System.IO.File]::ReadAllText($file) $old = '@ptrCast(try si.loadNtdllProc(@tagName(proc)))' if (!$source.Contains($old)) { throw 'Zig alignment workaround no longer matches; re-evaluate it' } [System.IO.File]::WriteAllText($file, $source.Replace($old, '@ptrCast(@alignCast(try si.loadNtdllProc(@tagName(proc))))')) - name: Pin MSVC 14.51 for Zig's Clang 21 timeout-minutes: 20 run: | $installer = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer" $vs = & "$installer\vswhere.exe" -latest -products * -property installationPath $tools = "$vs\VC\Tools\MSVC" $arch = '${{ matrix.arch }}' $hasRuntimes = { (Test-Path "$($_.FullName)\lib\x64\vcruntime.lib") -and (Test-Path "$($_.FullName)\lib\$arch\vcruntime.lib") } if (!(Get-ChildItem $tools -Directory -Filter '14.51.*' | Where-Object $hasRuntimes)) { $components = '--add Microsoft.VisualStudio.Component.VC.14.51.x86.x64' if ($arch -eq 'arm64') { $components += ' --add Microsoft.VisualStudio.Component.VC.14.51.ARM64' } $setup = Start-Process "$installer\setup.exe" -ArgumentList "modify --installPath `"$vs`" $components --quiet --norestart" -Wait -PassThru if ($setup.ExitCode -notin 0, 3010) { throw "VS installer exited with $($setup.ExitCode)" } Write-Output "MSVC 14.51 installer exited with $($setup.ExitCode) for $arch" } $toolset = Get-ChildItem $tools -Directory -Filter '14.51.*' | Where-Object $hasRuntimes | Sort-Object { [version]$_.Name } -Descending | Select-Object -First 1 if (!$toolset) { throw "Missing MSVC 14.51 for $arch" } # Zig reads this file for both host and target tools on the disposable runner. Set-Content "$vs\VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt" $toolset.Name -Encoding ascii $libc = zig libc $libc if ($LASTEXITCODE -ne 0 -or $libc -inotcontains "sys_include_dir=$($toolset.FullName)\include") { throw 'Zig selected unexpected MSVC headers' } - name: Install Rust toolchain and target run: rustup toolchain install $env:RUSTUP_TOOLCHAIN --force-non-host --profile minimal --target $env:CARGO_BUILD_TARGET - uses: ./.github/actions/prefetch-ghostty - name: Build run: cargo build --locked --release - name: Smoke test run: | $metadata = cargo metadata --locked --no-deps --format-version 1 | ConvertFrom-Json if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } $version = ($metadata.packages | Where-Object name -eq 'opencode-pty').version $binary = "target/$env:CARGO_BUILD_TARGET/release/opencode-pty.exe" $output = & $binary --version if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } if ($output -ne "opencode-pty $version (protocol $env:PROTOCOL_VERSION)") { throw "Unexpected version output: $output" } # Start a real daemon over a named pipe; it stops when nobody claims it. $runtime = Join-Path $env:RUNNER_TEMP 'opencode-pty-release-smoke' $daemon = Start-Process $binary -ArgumentList @('daemon', '--runtime-dir', $runtime, '--name', 'smoke') -PassThru -NoNewWindow $deadline = (Get-Date).AddSeconds(10) while (!(Test-Path (Join-Path $runtime 'smoke/service.json'))) { if ($daemon.HasExited -or (Get-Date) -gt $deadline) { throw 'daemon did not register' } Start-Sleep -Milliseconds 50 } if (!$daemon.WaitForExit(15000)) { $daemon.Kill(); throw 'unclaimed daemon did not stop' } if (Test-Path (Join-Path $runtime 'smoke')) { throw 'runtime directory was not removed' } - name: Package run: | $metadata = cargo metadata --locked --no-deps --format-version 1 | ConvertFrom-Json if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } $version = ($metadata.packages | Where-Object name -eq 'opencode-pty').version $name = "opencode-pty-$version-$env:CARGO_BUILD_TARGET" New-Item -ItemType Directory -Force "dist/$name" | Out-Null Copy-Item "target/$env:CARGO_BUILD_TARGET/release/opencode-pty.exe" "dist/$name/" Copy-Item LICENSE, README.md "dist/$name/" tar -C dist -czf "dist/$name.tar.gz" $name if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: name: opencode-pty-${{ matrix.target }} path: packages/process-daemon/dist/*.tar.gz if-no-files-found: error package: needs: [checks, build, build-windows] runs-on: ubuntu-22.04 outputs: digest: ${{ steps.upload.outputs.digest }} env: PROTOCOL_VERSION: ${{ needs.checks.outputs.protocol }} steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 with: node-version: "24" registry-url: https://registry.npmjs.org - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 with: path: packages/process-daemon/dist pattern: opencode-pty-* merge-multiple: true - name: Create checksums and manifest working-directory: packages/process-daemon/dist run: | version="$(node -p 'require("../npm/package.json").version')" sha256sum opencode-pty-*.tar.gz > SHA256SUMS artifacts='[]' while read -r sha256 archive; do target="${archive#opencode-pty-${version}-}" target="${target%.tar.gz}" artifacts="$(jq --arg target "$target" --arg archive "$archive" --arg sha256 "$sha256" '. + [{target: $target, archive: $archive, sha256: $sha256}]' <<<"$artifacts")" done < SHA256SUMS jq -n \ --arg version "$version" \ --argjson protocol "$PROTOCOL_VERSION" \ --argjson artifacts "$artifacts" \ '{schema: 1, version: $version, protocol: $protocol, artifacts: $artifacts}' \ > release-manifest.json sha256sum release-manifest.json >> SHA256SUMS - name: Prepare npm packages run: node script/npm-packages.mjs dist - name: Validate npm packages run: | for package in dist/npm/*; do npm pack --dry-run "$package" >/dev/null done temporary="$(mktemp -d)" npm pack --pack-destination "$temporary" dist/npm/opencode-pty-linux-x64-gnu dist/npm/opencode-pty >/dev/null npm install --prefix "$temporary" --ignore-scripts --no-package-lock --no-audit --no-fund "$temporary"/*.tgz test "$("$temporary/node_modules/.bin/opencode-pty" --version)" = "opencode-pty $(node -p 'require("./npm/package.json").version') (protocol $PROTOCOL_VERSION)" - name: Stage release files run: | mkdir -p "$RUNNER_TEMP/bundle/github" "$RUNNER_TEMP/bundle/npm" cp dist/*.tar.gz dist/release-manifest.json dist/SHA256SUMS "$RUNNER_TEMP/bundle/github/" for package in dist/npm/*; do npm pack --ignore-scripts --pack-destination "$RUNNER_TEMP/bundle/npm" "$(realpath "$package")" done # The upload action owns the outer SHA256SUMS; include the release checksums in it. mv "$RUNNER_TEMP/bundle/github/SHA256SUMS" "$RUNNER_TEMP/bundle/github/checksums.txt" - id: upload uses: ./.github/release/upload with: name: process-daemon-bundle path: ${{ runner.temp }}/bundle release: needs: [checks, package] if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/process-daemon-v') runs-on: ubuntu-24.04 environment: process-daemon-release permissions: contents: write id-token: write attestations: write defaults: run: working-directory: . env: PROTOCOL_VERSION: ${{ needs.checks.outputs.protocol }} steps: - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 with: sparse-checkout: /.github/release/ sparse-checkout-cone-mode: false persist-credentials: false - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0; caching opt-in with: node-version: '24.11.0' - uses: ./.github/release/download with: pattern: process-daemon-bundle digests: process-daemon-bundle=${{ needs.package.outputs.digest }} require-digests: 'true' - uses: actions/attest@1e69f48acb82d1966a394da916b4c1698aa569d6 # v4.2.2 with: subject-path: | ${{ runner.temp }}/in/process-daemon-bundle/github/*.tar.gz ${{ runner.temp }}/in/process-daemon-bundle/github/release-manifest.json # The monorepo's Latest release drives OpenCode's own update paths, so this release must never become # Latest. It is drafted first because immutable releases lock assets once published. - name: Publish release env: GH_TOKEN: ${{ github.token }} run: | cd "$RUNNER_TEMP/in/process-daemon-bundle/github" mv checksums.txt SHA256SUMS version="${GITHUB_REF_NAME#process-daemon-v}" gh release view "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1 || gh release create "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" --draft --verify-tag --latest=false \ --title "process-daemon v$version" \ --notes "opencode-pty $version (protocol $PROTOCOL_VERSION) from packages/process-daemon, published to npm as @opencode/pty@$version." gh release upload "$GITHUB_REF_NAME" ./*.tar.gz SHA256SUMS release-manifest.json --clobber --repo "$GITHUB_REPOSITORY" gh release edit "$GITHUB_REF_NAME" --draft=false --latest=false --repo "$GITHUB_REPOSITORY" - name: Publish npm packages run: bash .github/release/publish-process-daemon.sh "$RUNNER_TEMP/in/process-daemon-bundle/npm" |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |