From fc53a799ae7f6f44c92ab8f33896479af27adce8 Mon Sep 17 00:00:00 2001 From: appujet Date: Sun, 30 Aug 2026 23:59:40 +0530 Subject: [PATCH 1/3] Update sources dependency revision --- Cargo.lock | 61 +++--------------------------------------------------- Cargo.toml | 2 +- 2 files changed, 4 insertions(+), 59 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c10d83b..cd18b4a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -98,26 +98,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "audiopus" -version = "0.3.0-rc.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab55eb0e56d7c6de3d59f544e5db122d7725ec33be6a276ee8241f3be6473955" -dependencies = [ - "audiopus_sys", -] - -[[package]] -name = "audiopus_sys" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62314a1546a2064e033665d658e88c620a62904be945f8147e6b16c3db9f8651" -dependencies = [ - "cmake", - "log", - "pkg-config", -] - [[package]] name = "autocfg" version = "1.5.1" @@ -407,15 +387,6 @@ dependencies = [ "vec_map", ] -[[package]] -name = "cmake" -version = "0.1.58" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0f78a02292a74a88ac736019ab962ece0bc380e3f977bf72e376c5d78ff0678" -dependencies = [ - "cc", -] - [[package]] name = "const-oid" version = "0.9.6" @@ -1460,7 +1431,7 @@ dependencies = [ "lyrics", "mimalloc", "perf_monitor", - "player 0.1.0 (git+https://github.com/bongo-devs/player?rev=ad2a244e4497af3222b6fa77b36c21ed62f9c5dc)", + "player", "rand 0.8.8", "rustls", "serde", @@ -2132,12 +2103,6 @@ dependencies = [ "spki", ] -[[package]] -name = "pkg-config" -version = "0.3.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548" - [[package]] name = "player" version = "0.1.0" @@ -2158,26 +2123,6 @@ dependencies = [ "url", ] -[[package]] -name = "player" -version = "0.1.0" -source = "git+https://github.com/bongo-devs/player#9e397c7ac6f8f048f3680213b69a6ad3b7cb04a3" -dependencies = [ - "aes", - "audiopus", - "base64", - "bytes", - "cbc", - "reqwest", - "serde", - "serde_json", - "symphonia", - "symphonia-core", - "tokio", - "tracing", - "url", -] - [[package]] name = "poly1305" version = "0.8.0" @@ -2865,7 +2810,7 @@ dependencies = [ [[package]] name = "sources" version = "0.1.0" -source = "git+https://github.com/bongo-devs/sources?rev=484ea7a424d13ad27455dc3f38bfa0bfe8bab664#484ea7a424d13ad27455dc3f38bfa0bfe8bab664" +source = "git+https://github.com/bongo-devs/sources?rev=d7caa2a0ac88bcbc2ac45ec556f3356421d60dee#d7caa2a0ac88bcbc2ac45ec556f3356421d60dee" dependencies = [ "aes", "base64", @@ -2875,7 +2820,7 @@ dependencies = [ "hmac", "md-5", "percent-encoding", - "player 0.1.0 (git+https://github.com/bongo-devs/player)", + "player", "rand 0.8.8", "regex", "serde", diff --git a/Cargo.toml b/Cargo.toml index 856ec5a..63a357f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,7 +28,7 @@ rev = "ad2a244e4497af3222b6fa77b36c21ed62f9c5dc" [dependencies.sources] git = "https://github.com/bongo-devs/sources" -rev = "484ea7a424d13ad27455dc3f38bfa0bfe8bab664" +rev = "d7caa2a0ac88bcbc2ac45ec556f3356421d60dee" [dependencies.voice] git = "https://github.com/bongo-devs/voice" From 0258ed1465275b71b37c9d8f107e9dedf0738afe Mon Sep 17 00:00:00 2001 From: appujet Date: Mon, 31 Aug 2026 00:46:10 +0530 Subject: [PATCH 2/3] Update CI and dependency pins --- .github/workflows/docker-release.yml | 14 ++----- .github/workflows/rust.yml | 10 ----- Cargo.lock | 61 ++++++++++++++++------------ Cargo.toml | 8 ++-- Dockerfile | 11 +---- 5 files changed, 44 insertions(+), 60 deletions(-) diff --git a/.github/workflows/docker-release.yml b/.github/workflows/docker-release.yml index 7389d31..1e5b3d5 100644 --- a/.github/workflows/docker-release.yml +++ b/.github/workflows/docker-release.yml @@ -13,10 +13,6 @@ permissions: packages: write env: CARGO_TERM_COLOR: always - LIBOPUS_STATIC: "1" - OPUS_STATIC: "1" - AUDIOPUS_STATIC: "1" - CMAKE_POLICY_VERSION_MINIMUM: "3.5" SCCACHE_GHA_ENABLED: "true" RUSTC_WRAPPER: sccache CARGO_NET_GIT_FETCH_WITH_CLI: "true" @@ -62,15 +58,13 @@ jobs: key: cargo-${{ matrix.target }}-${{ hashFiles('Cargo.lock') }} restore-keys: cargo-${{ matrix.target }}- - - name: Install build dependencies + - name: Install the aarch64 cross-compiler + if: matrix.target == 'aarch64-unknown-linux-gnu' run: | sudo apt-get update sudo apt-get install -y --no-install-recommends \ - cmake pkg-config libclang-dev clang git build-essential perl - if [[ "${{ matrix.target }}" == "aarch64-unknown-linux-gnu" ]]; then - sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu - echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> "$GITHUB_ENV" - fi + gcc-aarch64-linux-gnu g++-aarch64-linux-gnu + echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> "$GITHUB_ENV" - name: Build run: cargo build --release --locked --target ${{ matrix.target }} --bin kairo diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 9e4d981..b77fb32 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -9,10 +9,6 @@ on: env: CARGO_TERM_COLOR: always CARGO_NET_GIT_FETCH_WITH_CLI: "true" - LIBOPUS_STATIC: "1" - OPUS_STATIC: "1" - AUDIOPUS_STATIC: "1" - CMAKE_POLICY_VERSION_MINIMUM: "3.5" jobs: build: @@ -31,12 +27,6 @@ jobs: git config --global url."https://x-access-token:$TOKEN@github.com/".insteadOf \ https://github.com/ - - name: Install build dependencies - run: | - sudo apt-get update - sudo apt-get install -y --no-install-recommends \ - cmake pkg-config libclang-dev clang build-essential perl - - uses: actions/cache@v4 with: path: | diff --git a/Cargo.lock b/Cargo.lock index cd18b4a..a4a4977 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -317,12 +317,12 @@ dependencies = [ [[package]] name = "chacha20" -version = "0.10.1" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d524456ba66e72eb8b115ff89e01e497f8e6d11d78b70b1aa13c0fbd97540a81" +checksum = "65c35e4b699c7e15ccbe7ee35c005e4fc0a278d22238a2857e6ce2dadeda1b06" dependencies = [ "cfg-if", - "cpufeatures 0.3.0", + "cpufeatures 0.3.1", "rand_core 0.10.1", ] @@ -421,9 +421,9 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b2a41393f66f16b0823bb79094d54ac5fbd34ab292ddafb9a0456ac9f87d201" +checksum = "5ca28b0ae3115b884660db4118d803791fd6756b6e88f39c0f3f7859060d7566" dependencies = [ "libc", ] @@ -1164,9 +1164,9 @@ checksum = "15cdd26707701c53297e2fa6afb323d55fbc1d0810c3aec078ae3ef0424c3c15" [[package]] name = "hyper" -version = "1.11.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d22053281f852e11534f5198498373cbb59295120a20771d90f7ed1897490a72" +checksum = "27b501faa50e7a26c3d3560ca625132f4078a17771f4810baf70475ae48cbe43" dependencies = [ "atomic-waker", "bytes", @@ -1353,9 +1353,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.14.0" +version = "2.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9" +checksum = "07aa2048142242915a31d35844fb311e0e53fcca590c3a0a40dcf1b841fa09eb" dependencies = [ "equivalent", "hashbrown", @@ -1692,13 +1692,12 @@ dependencies = [ [[package]] name = "libmimalloc-sys" -version = "0.1.44" +version = "0.1.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "667f4fec20f29dfc6bc7357c582d91796c169ad7e2fce709468aefeb2c099870" +checksum = "6a45a52f43e1c16f667ccfe4dd8c85b7f7c204fd5e3bf46c5b0db9a5c3c0b8e9" dependencies = [ "cc", "cty", - "libc", ] [[package]] @@ -1737,7 +1736,7 @@ checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154" [[package]] name = "lyrics" version = "0.1.0" -source = "git+https://github.com/bongo-devs/lyrics?rev=ccf928f04cbc0c6dd839398307fd12a460de08f9#ccf928f04cbc0c6dd839398307fd12a460de08f9" +source = "git+https://github.com/bongo-devs/lyrics?tag=v0.1.0#d5c1f9966fc2639e254b5cb68287025bb248d906" dependencies = [ "async-trait", "futures", @@ -1792,9 +1791,9 @@ checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" [[package]] name = "mimalloc" -version = "0.1.48" +version = "0.1.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1ee66a4b64c74f4ef288bcbb9192ad9c3feaad75193129ac8509af543894fd8" +checksum = "2d4139bb28d14ad1facf21d5eb8825051b326e172d216b39f6d31df53cc97862" dependencies = [ "libmimalloc-sys", ] @@ -1981,7 +1980,8 @@ dependencies = [ [[package]] name = "opus-rs" version = "0.1.32" -source = "git+https://github.com/restsend/opus-rs?rev=ba7d023d532fa4cb5d6037b454b9017fec747c13#ba7d023d532fa4cb5d6037b454b9017fec747c13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f18e50e3ad1d816434f675150eca1b4c669e49cac7b685f733a88127cd75551" [[package]] name = "p256" @@ -2105,8 +2105,8 @@ dependencies = [ [[package]] name = "player" -version = "0.1.0" -source = "git+https://github.com/bongo-devs/player?rev=ad2a244e4497af3222b6fa77b36c21ed62f9c5dc#ad2a244e4497af3222b6fa77b36c21ed62f9c5dc" +version = "0.1.1" +source = "git+https://github.com/bongo-devs/player?tag=v0.1.1-rc#d8a6d631853d6d4e461a09e3168c998c001c8bec" dependencies = [ "aes", "base64", @@ -2314,7 +2314,7 @@ version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c7f5fa3a058cd35567ef9bfa5e75732bee0f9e4c55fa90477bef2dfcdbc4be80" dependencies = [ - "chacha20 0.10.1", + "chacha20 0.10.2", "getrandom 0.4.3", "rand_core 0.10.1", ] @@ -2537,7 +2537,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -2809,8 +2809,8 @@ dependencies = [ [[package]] name = "sources" -version = "0.1.0" -source = "git+https://github.com/bongo-devs/sources?rev=d7caa2a0ac88bcbc2ac45ec556f3356421d60dee#d7caa2a0ac88bcbc2ac45ec556f3356421d60dee" +version = "0.1.1" +source = "git+https://github.com/bongo-devs/sources?tag=v0.1.0#7e0f2bcd90a32cfd2b7d7dd63858f227f364a7e7" dependencies = [ "aes", "base64", @@ -3517,9 +3517,9 @@ checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" [[package]] name = "uuid" -version = "1.25.0" +version = "1.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f053576934f05a761a402421fbbe3d425d9366f75f978806a037b3ca481abecc" +checksum = "b5772d71c9be8a8a6ac2117d949c5b224c1b72241bb611d9a3012edcf8af7812" dependencies = [ "getrandom 0.4.3", "js-sys", @@ -3547,7 +3547,7 @@ checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "voice" version = "0.1.0" -source = "git+https://github.com/bongo-devs/voice?rev=848da7f3b2dd543ee3941176c56760ca18c7193c#848da7f3b2dd543ee3941176c56760ca18c7193c" +source = "git+https://github.com/bongo-devs/voice?tag=v0.1.0#5490ce4d9a165b9d9ab49a97b0acb0fbf6d39491" dependencies = [ "aes-gcm", "bytes", @@ -3724,7 +3724,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.61.2", ] [[package]] @@ -3810,6 +3810,15 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + [[package]] name = "windows-sys" version = "0.61.2" diff --git a/Cargo.toml b/Cargo.toml index 63a357f..5720020 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,19 +20,19 @@ tracing-appender = "0.2" [dependencies.lyrics] git = "https://github.com/bongo-devs/lyrics" -rev = "ccf928f04cbc0c6dd839398307fd12a460de08f9" +tag = "v0.1.0" [dependencies.player] git = "https://github.com/bongo-devs/player" -rev = "ad2a244e4497af3222b6fa77b36c21ed62f9c5dc" +tag = "v0.1.1-rc" [dependencies.sources] git = "https://github.com/bongo-devs/sources" -rev = "d7caa2a0ac88bcbc2ac45ec556f3356421d60dee" +tag = "v0.1.0" [dependencies.voice] git = "https://github.com/bongo-devs/voice" -rev = "848da7f3b2dd543ee3941176c56760ca18c7193c" +tag = "v0.1.0" [dependencies.tokio] version = "1.52" diff --git a/Dockerfile b/Dockerfile index 2f3f542..fcad1af 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,20 +8,11 @@ RUN cargo chef prepare --recipe-path recipe.json FROM chef AS builder RUN apt-get update && apt-get install -y --no-install-recommends \ - cmake \ - pkg-config \ - libclang-dev \ - clang \ build-essential \ - perl \ git \ && rm -rf /var/lib/apt/lists/* -ENV LIBOPUS_STATIC=1 \ - OPUS_STATIC=1 \ - AUDIOPUS_STATIC=1 \ - CMAKE_POLICY_VERSION_MINIMUM=3.5 \ - CARGO_TERM_COLOR=always +ENV CARGO_TERM_COLOR=always COPY --from=planner /build/recipe.json recipe.json RUN cargo chef cook --release --recipe-path recipe.json From 74c51a5bda24fa58a7520306586b46ea255a5000 Mon Sep 17 00:00:00 2001 From: appujet Date: Mon, 31 Aug 2026 01:16:11 +0530 Subject: [PATCH 3/3] Refactor Release Workflow --- .github/workflows/docker-release.yml | 130 ---------------- .github/workflows/release.yml | 218 +++++++++++++++++++++++++++ 2 files changed, 218 insertions(+), 130 deletions(-) delete mode 100644 .github/workflows/docker-release.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/docker-release.yml b/.github/workflows/docker-release.yml deleted file mode 100644 index 1e5b3d5..0000000 --- a/.github/workflows/docker-release.yml +++ /dev/null @@ -1,130 +0,0 @@ -name: Release Pipeline -on: - release: - types: [published] - workflow_dispatch: - inputs: - commit: - description: "Specific commit SHA (leave empty for latest)" - required: false - default: "" -permissions: - contents: read - packages: write -env: - CARGO_TERM_COLOR: always - SCCACHE_GHA_ENABLED: "true" - RUSTC_WRAPPER: sccache - CARGO_NET_GIT_FETCH_WITH_CLI: "true" -jobs: - build-linux: - name: Linux ${{ matrix.arch }} - runs-on: ubuntu-22.04 - strategy: - fail-fast: false - matrix: - include: - - target: x86_64-unknown-linux-gnu - arch: amd64 - - target: aarch64-unknown-linux-gnu - arch: arm64 - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ inputs.commit || github.ref }} - - - uses: dtolnay/rust-toolchain@stable - with: - targets: ${{ matrix.target }} - - - uses: mozilla-actions/sccache-action@v0.0.9 - - - name: Authenticate for the private dependencies - env: - TOKEN: ${{ secrets.CARGO_GIT_TOKEN }} - run: | - if [ -z "$TOKEN" ]; then - echo "::error::CARGO_GIT_TOKEN is unset, so cargo cannot fetch the git dependencies" - exit 1 - fi - git config --global url."https://x-access-token:$TOKEN@github.com/".insteadOf \ - https://github.com/ - - - uses: actions/cache@v4 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - key: cargo-${{ matrix.target }}-${{ hashFiles('Cargo.lock') }} - restore-keys: cargo-${{ matrix.target }}- - - - name: Install the aarch64 cross-compiler - if: matrix.target == 'aarch64-unknown-linux-gnu' - run: | - sudo apt-get update - sudo apt-get install -y --no-install-recommends \ - gcc-aarch64-linux-gnu g++-aarch64-linux-gnu - echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> "$GITHUB_ENV" - - - name: Build - run: cargo build --release --locked --target ${{ matrix.target }} --bin kairo - - - name: Rename binary - run: | - mv target/${{ matrix.target }}/release/kairo \ - target/${{ matrix.target }}/release/kairo-linux-${{ matrix.arch }} - - - uses: actions/upload-artifact@v4 - with: - name: kairo-linux-${{ matrix.arch }} - path: target/${{ matrix.target }}/release/kairo-linux-${{ matrix.arch }} - - docker: - name: Build & Push Docker Image - needs: build-linux - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ inputs.commit || github.ref }} - - - uses: actions/download-artifact@v4 - with: - path: bin - pattern: kairo-linux-* - - - name: Organize binaries - run: | - mkdir -p bin/linux/amd64 bin/linux/arm64 - mv bin/kairo-linux-amd64/kairo-linux-amd64 bin/linux/amd64/kairo - mv bin/kairo-linux-arm64/kairo-linux-arm64 bin/linux/arm64/kairo - chmod +x bin/linux/amd64/kairo bin/linux/arm64/kairo - - - uses: docker/setup-buildx-action@v3 - - - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - id: meta - uses: docker/metadata-action@v5 - with: - images: ghcr.io/${{ github.repository }} - tags: | - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - type=raw,value=latest - - - uses: docker/build-push-action@v6 - with: - context: . - file: Dockerfile - target: ci - platforms: linux/amd64,linux/arm64 - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - cache-from: type=gha - cache-to: type=gha,mode=max diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..ffad7c2 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,218 @@ +name: Release + +on: + release: + types: [published] + workflow_dispatch: + inputs: + commit: + description: "Specific commit SHA (leave empty for latest)" + required: false + default: "" + # A tag run can only inherit the default branch's caches, so build here when the lockfile moves. + # Without it every release compiles all 399 crates from scratch. + push: + branches: [main] + paths: + - Cargo.lock + - Cargo.toml + - .github/workflows/release.yml + +permissions: + contents: read + packages: write + +env: + CARGO_TERM_COLOR: always + CARGO_NET_GIT_FETCH_WITH_CLI: "true" + RUSTC_WRAPPER: sccache + SCCACHE_GHA_ENABLED: "true" + +# All five build legs start at once. Only the image waits, and only on the two Linux ones. +jobs: + linux: + name: Linux ${{ matrix.arch }} + # Not a newer image: the binary has to run on the distroless cc-debian12 base, glibc 2.36. + runs-on: ubuntu-22.04 + permissions: + contents: write + strategy: + fail-fast: false + matrix: + include: + - target: x86_64-unknown-linux-gnu + arch: amd64 + - target: aarch64-unknown-linux-gnu + arch: arm64 + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ inputs.commit || github.ref }} + - uses: dtolnay/rust-toolchain@stable + with: + targets: ${{ matrix.target }} + + - uses: mozilla-actions/sccache-action@v0.0.9 + + - name: Authenticate for the private git dependencies + env: + TOKEN: ${{ secrets.CARGO_GIT_TOKEN }} + run: | + test -n "$TOKEN" || { echo "::error::CARGO_GIT_TOKEN is unset, so cargo cannot fetch the git dependencies"; exit 1; } + git config --global url."https://x-access-token:$TOKEN@github.com/".insteadOf https://github.com/ + + # Downloads only, and not target-specific, so every leg shares one entry. Cargo re-extracts + # registry/src from these faster than a cache that size restores; sccache holds the objects. + - uses: actions/cache@v4 + with: + path: | + ~/.cargo/registry/index + ~/.cargo/registry/cache + ~/.cargo/git/db + key: cargo-deps-${{ runner.os }}-${{ hashFiles('Cargo.lock') }} + restore-keys: cargo-deps-${{ runner.os }}- + + # ring, libmimalloc-sys and perf_monitor all compile C for the target. + - name: Install the aarch64 cross-compiler + if: matrix.arch == 'arm64' + run: | + sudo apt-get update + sudo apt-get install -y --no-install-recommends gcc-aarch64-linux-gnu g++-aarch64-linux-gnu + echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> "$GITHUB_ENV" + + - name: Build + run: cargo build --release --locked --target ${{ matrix.target }} --bin kairo + + # Hit rate, so a slow release is diagnosable instead of a guess. + - run: sccache --show-stats + + # Named after the arch so the docker job's download lands it straight at the path the + # `ci` stage COPYs, with no renaming or shuffling in between. + - uses: actions/upload-artifact@v4 + if: github.event_name != 'push' + with: + name: ${{ matrix.arch }} + path: target/${{ matrix.target }}/release/kairo + if-no-files-found: error + + - name: Attach the binary to the release + if: github.event_name == 'release' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + cp target/${{ matrix.target }}/release/kairo kairo-linux-${{ matrix.arch }} + gh release upload "${{ github.event.release.tag_name }}" kairo-linux-${{ matrix.arch }} --clobber + # macOS and Windows only ship release assets, so nothing downstream waits on them. The x86_64 mac + # leg cross-links against the same universal SDK the arm runner already has. + desktop: + name: ${{ matrix.asset }} + runs-on: ${{ matrix.os }} + permissions: + contents: write + defaults: + run: + shell: bash + strategy: + fail-fast: false + matrix: + include: + - os: macos-latest + target: aarch64-apple-darwin + bin: kairo + asset: kairo-macos-arm64 + - os: macos-latest + target: x86_64-apple-darwin + bin: kairo + asset: kairo-macos-amd64 + - os: windows-latest + target: x86_64-pc-windows-msvc + bin: kairo.exe + asset: kairo-windows-amd64.exe + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ inputs.commit || github.ref }} + + - uses: dtolnay/rust-toolchain@stable + with: + targets: ${{ matrix.target }} + + - uses: mozilla-actions/sccache-action@v0.0.9 + + - name: Authenticate for the private git dependencies + env: + TOKEN: ${{ secrets.CARGO_GIT_TOKEN }} + run: | + test -n "$TOKEN" || { echo "::error::CARGO_GIT_TOKEN is unset, so cargo cannot fetch the git dependencies"; exit 1; } + git config --global url."https://x-access-token:$TOKEN@github.com/".insteadOf https://github.com/ + + - uses: actions/cache@v4 + with: + path: | + ~/.cargo/registry/index + ~/.cargo/registry/cache + ~/.cargo/git/db + key: cargo-deps-${{ runner.os }}-${{ hashFiles('Cargo.lock') }} + restore-keys: cargo-deps-${{ runner.os }}- + + - name: Build + run: cargo build --release --locked --target ${{ matrix.target }} --bin kairo + + - run: sccache --show-stats + + - name: Attach the binary to the release + if: github.event_name == 'release' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + cp "target/${{ matrix.target }}/release/${{ matrix.bin }}" "${{ matrix.asset }}" + gh release upload "${{ github.event.release.tag_name }}" "${{ matrix.asset }}" --clobber + docker: + name: Docker image + needs: linux + if: github.event_name != 'push' + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ inputs.commit || github.ref }} + + # Both artifacts, each into bin/linux//kairo. The zip drops the executable bit. + - uses: actions/download-artifact@v4 + with: + path: bin/linux + + - run: chmod +x bin/linux/*/kairo + + - uses: docker/setup-buildx-action@v3 + + - uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - id: meta + uses: docker/metadata-action@v5 + with: + images: ghcr.io/${{ github.repository }} + tags: | + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=raw,value=latest + + # No QEMU and no layer cache: the `ci` stage only COPYs a prebuilt binary, so nothing RUNs + # under emulation and the one layer worth caching changes every release anyway. + - uses: docker/build-push-action@v6 + with: + context: . + file: Dockerfile + target: ci + platforms: linux/amd64,linux/arm64 + push: true + provenance: false + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }}