From 4c822376080e657edc5e2b3321fd12b3c425cf15 Mon Sep 17 00:00:00 2001 From: Jeremie Fraeys Date: Thu, 12 Feb 2026 14:12:25 -0500 Subject: [PATCH] ci: performance optimizations - native lib caching, docker layer caching, path filtering, apt caching --- .forgejo/workflows/ci-native.yml | 29 +++++++++++++++++++++- .forgejo/workflows/ci.yml | 41 +++++++++++++++++++++++++++++--- 2 files changed, 66 insertions(+), 4 deletions(-) diff --git a/.forgejo/workflows/ci-native.yml b/.forgejo/workflows/ci-native.yml index b9d6411..fb95e65 100644 --- a/.forgejo/workflows/ci-native.yml +++ b/.forgejo/workflows/ci-native.yml @@ -3,8 +3,18 @@ name: CI with Native Libraries on: push: branches: [main, master] + paths-ignore: + - 'docs/**' + - 'README.md' + - 'CHANGELOG.md' + - '**/*.md' pull_request: branches: [main, master] + paths-ignore: + - 'docs/**' + - 'README.md' + - 'CHANGELOG.md' + - '**/*.md' workflow_dispatch: # Manual trigger for debugging native builds @@ -114,7 +124,24 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 1 - + + - name: Cache native libraries + uses: actions/cache@v4 + with: + path: | + native/build/ + key: ${{ runner.os }}-native-${{ hashFiles('native/**/*.cpp', 'native/**/*.h', 'native/**/CMakeLists.txt') }} + restore-keys: | + ${{ runner.os }}-native- + + - name: Cache apt packages + uses: actions/cache@v4 + with: + path: /var/cache/apt/archives + key: ${{ runner.os }}-apt-native-${{ hashFiles('.forgejo/workflows/*.yml') }} + restore-keys: | + ${{ runner.os }}-apt- + - name: Install cmake and build tools run: | echo "Installing cmake and build dependencies..." diff --git a/.forgejo/workflows/ci.yml b/.forgejo/workflows/ci.yml index ccd062b..6054256 100644 --- a/.forgejo/workflows/ci.yml +++ b/.forgejo/workflows/ci.yml @@ -2,6 +2,13 @@ name: CI/CD Pipeline on: workflow_dispatch: + push: + paths-ignore: + - 'docs/**' + - 'README.md' + - 'CHANGELOG.md' + - '.forgejo/ISSUE_TEMPLATE/**' + - '**/*.md' concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -79,6 +86,23 @@ jobs: restore-keys: | ${{ runner.os }}-zig- + - name: Cache native libraries + uses: actions/cache@v4 + with: + path: | + native/build/ + key: ${{ runner.os }}-native-${{ hashFiles('native/**/*.cpp', 'native/**/*.h', 'native/**/CMakeLists.txt') }} + restore-keys: | + ${{ runner.os }}-native- + + - name: Cache apt packages + uses: actions/cache@v4 + with: + path: /var/cache/apt/archives + key: ${{ runner.os }}-apt-${{ hashFiles('.forgejo/workflows/*.yml') }} + restore-keys: | + ${{ runner.os }}-apt- + - name: Install dependencies run: | go mod download @@ -139,7 +163,7 @@ jobs: - name: Checkout code uses: actions/checkout@v5 - - name: Set up Go (fast) + - name: Set up Go run: | REQUIRED_GO="1.25.0" if command -v go &> /dev/null && go version | grep -q "go${REQUIRED_GO}"; then @@ -275,6 +299,17 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 + with: + driver-opts: | + image=moby/buildkit:master + + - name: Cache Docker layers + uses: actions/cache@v4 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- - name: Login to GitHub Container Registry uses: docker/login-action@v3 @@ -292,5 +327,5 @@ jobs: tags: | ghcr.io/${{ github.repository }}:latest ghcr.io/${{ github.repository }}:${{ github.sha }} - cache-from: type=gha - cache-to: type=gha,mode=max + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max