Merge pull request #28 from cbusillo/fix/limits-refresh-http-overlay #26
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Binary Release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| release_tag: | |
| description: Release tag to create or update, for example overlay-v0.6.93.1 | |
| required: true | |
| release_name: | |
| description: Optional display name for the GitHub release | |
| required: false | |
| default: "" | |
| prerelease: | |
| description: Mark the GitHub release as a prerelease | |
| required: true | |
| type: boolean | |
| default: true | |
| push: | |
| tags: | |
| - overlay-v* | |
| concurrency: | |
| group: binary-release-${{ github.ref_name || github.run_id }} | |
| cancel-in-progress: false | |
| permissions: | |
| contents: write | |
| jobs: | |
| metadata: | |
| runs-on: [self-hosted, Linux, X64, chris-testing] | |
| outputs: | |
| tag: ${{ steps.meta.outputs.tag }} | |
| release_name: ${{ steps.meta.outputs.release_name }} | |
| prerelease: ${{ steps.meta.outputs.prerelease }} | |
| code_version: ${{ steps.code_version.outputs.version }} | |
| toolchain: ${{ steps.rust_toolchain.outputs.channel }} | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Resolve release metadata | |
| id: meta | |
| shell: bash | |
| env: | |
| RELEASE_TAG: ${{ inputs.release_tag }} | |
| RELEASE_NAME: ${{ inputs.release_name }} | |
| PRERELEASE: ${{ inputs.prerelease }} | |
| run: | | |
| set -euo pipefail | |
| if [[ "${GITHUB_EVENT_NAME}" == "push" ]]; then | |
| tag="${GITHUB_REF_NAME}" | |
| prerelease=false | |
| release_name="Code ${tag}" | |
| else | |
| tag="${RELEASE_TAG}" | |
| prerelease="${PRERELEASE}" | |
| release_name="${RELEASE_NAME}" | |
| if [[ -z "${release_name}" ]]; then | |
| release_name="Code ${tag}" | |
| fi | |
| fi | |
| { | |
| echo "tag=${tag}" | |
| echo "release_name=${release_name}" | |
| echo "prerelease=${prerelease}" | |
| } >> "$GITHUB_OUTPUT" | |
| - name: Read Rust toolchain channel | |
| id: rust_toolchain | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| toolchain=$(python3 - <<'PY' | |
| import pathlib | |
| import tomllib | |
| data = tomllib.loads(pathlib.Path("code-rs/rust-toolchain.toml").read_text()) | |
| print(data["toolchain"]["channel"]) | |
| PY | |
| ) | |
| echo "channel=${toolchain}" >> "$GITHUB_OUTPUT" | |
| - name: Resolve embedded Code version | |
| id: code_version | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| version=$(node -p "require('./codex-cli/package.json').version") | |
| if [[ -z "$version" ]]; then | |
| echo "Unable to resolve embedded Code version from codex-cli/package.json" >&2 | |
| exit 1 | |
| fi | |
| echo "version=${version}" >> "$GITHUB_OUTPUT" | |
| build: | |
| name: Build ${{ matrix.target }} | |
| needs: metadata | |
| runs-on: ${{ fromJson(matrix.runs_on) }} | |
| timeout-minutes: 180 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: linux-self-hosted | |
| runs_on: '["self-hosted","Linux","X64","chris-testing"]' | |
| target: x86_64-unknown-linux-gnu | |
| artifact: code-linux-x64 | |
| - os: macos-14 | |
| runs_on: '["macos-14"]' | |
| target: x86_64-apple-darwin | |
| artifact: code-x86_64-apple-darwin | |
| - os: macos-14 | |
| runs_on: '["macos-14"]' | |
| target: aarch64-apple-darwin | |
| artifact: code-aarch64-apple-darwin | |
| env: | |
| CARGO_HOME: ${{ github.workspace }}/.cargo-home | |
| RUSTUP_HOME: ${{ github.workspace }}/.cargo-home/rustup | |
| CARGO_TARGET_DIR: ${{ github.workspace }}/code-rs/target | |
| CARGO_TERM_COLOR: always | |
| CODE_VERSION: ${{ needs.metadata.outputs.code_version }} | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: ${{ needs.metadata.outputs.toolchain }} | |
| targets: ${{ matrix.target }} | |
| - name: Rust cache | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| prefix-key: v2-binary-release | |
| shared-key: binary-release-${{ matrix.target }}-${{ needs.metadata.outputs.toolchain }} | |
| workspaces: | | |
| code-rs -> target | |
| cache-targets: true | |
| cache-workspace-crates: true | |
| cache-on-failure: true | |
| - name: Setup sccache | |
| uses: mozilla-actions/sccache-action@v0.0.9 | |
| with: | |
| version: v0.10.0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Enable sccache | |
| shell: bash | |
| run: | | |
| echo "SCCACHE_GHA_ENABLED=true" >> "$GITHUB_ENV" | |
| echo "RUSTC_WRAPPER=sccache" >> "$GITHUB_ENV" | |
| echo "SCCACHE_IDLE_TIMEOUT=1800" >> "$GITHUB_ENV" | |
| echo "SCCACHE_CACHE_SIZE=10G" >> "$GITHUB_ENV" | |
| - name: Linux tuning | |
| if: matrix.os == 'linux-self-hosted' | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| echo 'RUSTFLAGS=-Awarnings -C debuginfo=0 -C strip=symbols -C panic=abort' >> "$GITHUB_ENV" | |
| - name: macOS tuning | |
| if: startsWith(matrix.os, 'macos-') | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| if ! command -v zstd >/dev/null 2>&1; then | |
| brew install zstd | |
| fi | |
| echo 'CC=sccache clang' >> "$GITHUB_ENV" | |
| echo 'CXX=sccache clang++' >> "$GITHUB_ENV" | |
| echo 'RUSTFLAGS=-Awarnings -C debuginfo=0 -C strip=symbols -C panic=abort' >> "$GITHUB_ENV" | |
| - name: Prefetch Rust dependencies | |
| working-directory: code-rs | |
| env: | |
| CARGO_NET_GIT_FETCH_WITH_CLI: "true" | |
| run: cargo fetch --locked | |
| - name: Build release binary | |
| working-directory: code-rs | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| cargo build --release --locked --target "${{ matrix.target }}" --bin code | |
| - name: Smoke test release binary [Unix] | |
| if: | | |
| (matrix.os == 'linux-self-hosted' && matrix.target == 'x86_64-unknown-linux-gnu') || | |
| (startsWith(matrix.os, 'macos-') && matrix.target == 'aarch64-apple-darwin') | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| exe="code-rs/target/${{ matrix.target }}/release/code" | |
| "$exe" --version | |
| "$exe" completion bash > /dev/null | |
| - name: Prepare artifacts | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| mkdir -p artifacts | |
| cp "code-rs/target/${{ matrix.target }}/release/code" "artifacts/${{ matrix.artifact }}" | |
| - name: Compress artifacts (*nix dual-format) | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| shopt -s nullglob | |
| for f in artifacts/*; do | |
| [ -f "$f" ] || continue | |
| base=$(basename "$f") | |
| if command -v zstd >/dev/null 2>&1; then | |
| zstd -T0 -19 --force -o "artifacts/${base}.zst" "$f" | |
| fi | |
| tar -C artifacts -czf "artifacts/${base}.tar.gz" "$base" | |
| rm -f "$f" | |
| done | |
| - name: Upload workflow artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: binary-release-${{ matrix.target }} | |
| path: artifacts/ | |
| compression-level: 0 | |
| publish: | |
| name: Publish GitHub release | |
| needs: [metadata, build] | |
| runs-on: [self-hosted, Linux, X64, chris-testing] | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Download workflow artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts/ | |
| - name: Prepare release bundle | |
| shell: bash | |
| env: | |
| RELEASE_TAG: ${{ needs.metadata.outputs.tag }} | |
| CODE_VERSION: ${{ needs.metadata.outputs.code_version }} | |
| run: | | |
| set -euo pipefail | |
| mkdir -p dist | |
| while IFS= read -r -d '' f; do | |
| cp "$f" dist/ | |
| done < <(find artifacts -type f -name 'code-*' -print0) | |
| sha256sum dist/* > dist/SHA256SUMS.txt | |
| scripts/local/generate-overlay-release-notes.sh \ | |
| --tag "${RELEASE_TAG}" \ | |
| --code-version "${CODE_VERSION}" \ | |
| --commit "${GITHUB_SHA}" \ | |
| --ref-name "${GITHUB_REF_NAME}" \ | |
| --dist-dir dist \ | |
| --output dist/RELEASE_NOTES.txt | |
| - name: Publish GitHub release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ needs.metadata.outputs.tag }} | |
| target_commitish: ${{ github.sha }} | |
| name: ${{ needs.metadata.outputs.release_name }} | |
| prerelease: ${{ needs.metadata.outputs.prerelease == 'true' }} | |
| body_path: dist/RELEASE_NOTES.txt | |
| files: | | |
| dist/* | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |