From d8f2715c58ba727108eef507cf6db23306a2169a Mon Sep 17 00:00:00 2001 From: Shamy <110725453+shamykyzer@users.noreply.github.com> Date: Wed, 2 Jul 2025 12:00:04 +0300 Subject: [PATCH 1/2] chore: improve build cache handling --- .github/workflows/c-cpp.yml | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index 8df9cd7..8a998f1 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -13,14 +13,6 @@ jobs: container: ghcr.io/gravity-sim/deps:latest steps: - uses: actions/checkout@v4 - - name: Cache build artifacts - uses: actions/cache@v3 - with: - path: | - src/*.o - tests/*.o - key: ${{ runner.os }}-build-${{ hashFiles('**/*.c') }} - restore-keys: ${{ runner.os }}-build- - name: Setup complete run: echo "Dependencies are pre-installed in the container" @@ -32,15 +24,23 @@ jobs: steps: - uses: actions/checkout@v4 - name: Restore build cache - uses: actions/cache@v3 + id: build-cache + uses: actions/cache/restore@v3 with: path: | src/*.o tests/*.o key: ${{ runner.os }}-build-${{ hashFiles('**/*.c') }} - restore-keys: ${{ runner.os }}-build- - name: Build run: make + - name: Save build cache + if: steps.build-cache.outputs.cache-hit != 'true' + uses: actions/cache/save@v3 + with: + path: | + src/*.o + tests/*.o + key: ${{ steps.build-cache.outputs.cache-primary-key }} test: name: Test @@ -50,13 +50,12 @@ jobs: steps: - uses: actions/checkout@v4 - name: Restore build cache - uses: actions/cache@v3 + uses: actions/cache/restore@v3 with: path: | src/*.o tests/*.o key: ${{ runner.os }}-build-${{ hashFiles('**/*.c') }} - restore-keys: ${{ runner.os }}-build- - name: Test run: make test @@ -77,12 +76,11 @@ jobs: run: make test - uses: actions/checkout@v4 - name: Restore build cache - uses: actions/cache@v3 + uses: actions/cache/restore@v3 with: path: | src/*.o tests/*.o key: ${{ runner.os }}-build-${{ hashFiles('**/*.c') }} - restore-keys: ${{ runner.os }}-build- - name: Make run: make \ No newline at end of file From ef547a30df6941854279f7303286dd849d2eaadd Mon Sep 17 00:00:00 2001 From: Shamy <110725453+shamykyzer@users.noreply.github.com> Date: Wed, 2 Jul 2025 12:02:45 +0300 Subject: [PATCH 2/2] Update c-cpp.yml --- .github/workflows/c-cpp.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index 8a998f1..da625fc 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -69,7 +69,7 @@ jobs: - name: Install dependencies run: | sudo apt-get update - sudo apt-get install -y build-essential libgl1-mesa-dev libglew-dev libglfw3-dev libopenmpi-dev + sudo apt-get install -y build-essential libgl1-mesa-dev libglew-dev libglfw3-dev - name: Build run: make - name: Test @@ -83,4 +83,4 @@ jobs: tests/*.o key: ${{ runner.os }}-build-${{ hashFiles('**/*.c') }} - name: Make - run: make \ No newline at end of file + run: make