From 0e73ca1923d9472097b9c9cdf65795bb3f165b01 Mon Sep 17 00:00:00 2001 From: Fijxu Date: Sat, 24 May 2025 22:41:21 -0400 Subject: [PATCH] CI: Use buildkit-cache-dance to speed up builds --- .forgejo/workflows/ci.yml | 19 +++++++++++++++++-- docker/Dockerfile | 2 +- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/.forgejo/workflows/ci.yml b/.forgejo/workflows/ci.yml index 572e4e8d..41ecb35b 100644 --- a/.forgejo/workflows/ci.yml +++ b/.forgejo/workflows/ci.yml @@ -2,8 +2,6 @@ name: "Invidious CI" on: workflow_dispatch: - # schedule: - # - cron: '0 7 * * 0' push: branches: - "master" @@ -44,6 +42,23 @@ jobs: type=sha,format=short,prefix={{date 'YYYY.MM.DD'}}-,enable=${{ github.ref == format('refs/heads/{0}', 'master') }} type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'master') }} + - name: Cache .o files for compilation + uses: https://code.forgejo.org/actions/cache@v4 + id: cache + with: + path: | + codegen-cache + key: cache-${{ hashFiles('./Dockerfile') }} + + - name: Inject cache into Docker + uses: https://github.com/reproducible-containers/buildkit-cache-dance@v3.1.0 + with: + cache-map: | + { + "codegen-cache": "/root/.cache/crystal" + } + skip-extraction: ${{ steps.cache.outputs.cache-hit }} + - uses: https://code.forgejo.org/docker/build-push-action@v6 name: Build images with: diff --git a/docker/Dockerfile b/docker/Dockerfile index 87aa63de..db426208 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -22,7 +22,7 @@ COPY ./videojs-dependencies.yml ./videojs-dependencies.yml RUN --mount=type=cache,target=/root/.cache/crystal \ crystal build ./src/invidious.cr \ - --release --mcpu=x86-64-v2 \ + -O3 -Drelease --mcpu=x86-64-v2 \ --static --warnings all \ --link-flags "-lxml2 -llzma";