From 3d51317776b59743f6490a1c17ab7fe6fee99b0d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 31 Dec 2025 06:11:30 +0000 Subject: [PATCH 1/3] Initial plan From d32c9442ab4e6b5f3af1e1fcb9547bdefc535878 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 31 Dec 2025 06:17:28 +0000 Subject: [PATCH 2/3] feat: add cache for tblib compilation in release workflow Co-authored-by: hugefiver <18693500+hugefiver@users.noreply.github.com> --- .github/workflows/pull-request.yml | 14 ++++++++++++-- .github/workflows/release.yml | 13 +++++++++++-- Dockerfile | 4 ++-- 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index b1ca05b..6928838 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -32,6 +32,16 @@ jobs: with: driver: docker-container + - name: Inject tblib cache into Docker + uses: reproducible-containers/buildkit-cache-dance@v3.2.0 + with: + cache-map: | + { + "tblib-build": "/src/build", + "cargo-cache": "/src/target" + } + skip-extraction: true + - name: Build and Upload id: docker_build uses: docker/build-push-action@v6 @@ -41,5 +51,5 @@ jobs: tags: ${{ steps.meta.outputs.image }}:${{ steps.meta.outputs.version }} labels: runnumber=${{ github.run_id }} provenance: false - cache-from: type=gha - cache-to: type=gha,mode=max + cache-from: type=gha,scope=tblib-linux/amd64 + cache-to: type=gha,mode=max,scope=tblib-linux/amd64 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2e3d6fb..fca60c4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -65,6 +65,15 @@ jobs: with: driver: docker-container + - name: Inject tblib cache into Docker + uses: reproducible-containers/buildkit-cache-dance@v3.2.0 + with: + cache-map: | + { + "tblib-build": "/src/build", + "cargo-cache": "/src/target" + } + - name: Build and Upload id: docker_build uses: docker/build-push-action@v6 @@ -75,5 +84,5 @@ jobs: labels: runnumber=${{ github.run_id }} provenance: false platforms: ${{ steps.meta.outputs.platform }} - cache-from: type=gha - cache-to: type=gha,mode=max + cache-from: type=gha,scope=tblib-${{ steps.meta.outputs.platform }} + cache-to: type=gha,mode=max,scope=tblib-${{ steps.meta.outputs.platform }} diff --git a/Dockerfile b/Dockerfile index 9025393..c1a21d9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ RUN apk add --no-cache libressl-dev zlib-static zlib-dev RUN git clone --depth 1 --shallow-submodules --single-branch --recursive https://github.com/tdlib/telegram-bot-api.git src RUN cd src && git submodule update --init --recursive -RUN --mount=type=cache,target=/src/build cd src/build && \ +RUN --mount=type=cache,id=tblib-build,target=/src/build cd src/build && \ cmake -DCMAKE_BUILD_TYPE=Release \ -DBUILD_SHARED_LIBS=OFF \ -DOPENSSL_USE_STATIC_LIBS=ON \ @@ -23,7 +23,7 @@ RUN apk add --no-cache musl-dev libressl-dev WORKDIR /src COPY . . -RUN --mount=type=cache,target=/src/target \ +RUN --mount=type=cache,id=cargo-cache,target=/src/target \ cargo build --release && \ cp target/release/tg-bot-full-api /tg-bot-full-api From 6e858e78575f9749afced1262080d9035c9a6d49 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 6 Jan 2026 04:20:53 +0000 Subject: [PATCH 3/3] fix: add platform-specific cache keys for buildkit-cache-dance Co-authored-by: hugefiver <18693500+hugefiver@users.noreply.github.com> --- .github/workflows/pull-request.yml | 12 ++++++++++++ .github/workflows/release.yml | 11 +++++++++++ 2 files changed, 23 insertions(+) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 6928838..ba0297f 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -32,14 +32,26 @@ jobs: with: driver: docker-container + # PR builds use linux/amd64 (ubuntu-latest default), so cache scope is hardcoded + - name: Cache tblib and cargo builds + uses: actions/cache@v4 + id: cache + with: + path: cache-mount + key: buildkit-cache-linux/amd64-${{ hashFiles('Dockerfile') }} + restore-keys: | + buildkit-cache-linux/amd64- + - name: Inject tblib cache into Docker uses: reproducible-containers/buildkit-cache-dance@v3.2.0 with: + cache-dir: cache-mount cache-map: | { "tblib-build": "/src/build", "cargo-cache": "/src/target" } + # Always skip extraction to prevent PRs from overwriting the main cache skip-extraction: true - name: Build and Upload diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fca60c4..1c48c07 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -65,14 +65,25 @@ jobs: with: driver: docker-container + - name: Cache tblib and cargo builds + uses: actions/cache@v4 + id: cache + with: + path: cache-mount + key: buildkit-cache-${{ steps.meta.outputs.platform }}-${{ hashFiles('Dockerfile') }} + restore-keys: | + buildkit-cache-${{ steps.meta.outputs.platform }}- + - name: Inject tblib cache into Docker uses: reproducible-containers/buildkit-cache-dance@v3.2.0 with: + cache-dir: cache-mount cache-map: | { "tblib-build": "/src/build", "cargo-cache": "/src/target" } + skip-extraction: ${{ steps.cache.outputs.cache-hit }} - name: Build and Upload id: docker_build