From 6e8568c666ce3dce79cbf85df40ad57bbe557c61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20=C4=8Cerm=C3=A1k?= Date: Fri, 27 Oct 2023 13:56:44 +0200 Subject: [PATCH] Optimize build cache for dev builds (#2872) * Optimize build cache for dev builds * Remove downloaded files cache, as it doesn't save that much time and it can't fit into the repo cache limit, randomly causing eviction of CC object cache for a single board. * Limit saving of the object cache only to the dev branch, because of the restrictions for the cache access limit us from effectively using the cache for rc/main branches anyway. * Adjust names of the steps a bit for clarity. * Add printing of some cache stats * Compare old ccache files' age to Makefile --- .github/workflows/build.yaml | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 3de962609..6c9ebf7b1 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -178,13 +178,7 @@ jobs: sudo mkdir /mnt/cache sudo chown -R runner:runner /mnt/cache - - name: Cache downloads - uses: actions/cache/restore@v3 - with: - path: /mnt/cache/dl - key: haos-dl - - - name: Cache object files + - name: "Restore cache: object files" uses: actions/cache/restore@v3 with: path: /mnt/cache/cc @@ -227,18 +221,19 @@ jobs: upload_url: ${{ github.event.release.upload_url }} asset_path: output/images/haos_* - - name: Cache downloads - uses: actions/cache/save@v3 - with: - path: /mnt/cache/dl - key: haos-dl-${{ github.run_id }} - - - name: Cache build + - name: "Save cache: object files" + if: github.ref == 'refs/heads/dev' uses: actions/cache/save@v3 with: path: /mnt/cache/cc key: haos-cc-${{ matrix.board.id }}-${{ github.run_id }} + - name: Print cache stats + run: | + echo "Cache size: $(du -sh /mnt/cache/cc)" + echo "Files total: $(find /mnt/cache/cc -mindepth 1 -type f | wc -l)" + echo "Old files: $(find /mnt/cache/cc -mindepth 1 -type f -not -anewer output/Makefile | wc -l)" + - name: Upload ova image to artifacts for test job uses: actions/upload-artifact@v3 if: ${{ matrix.board.id == 'ova' }}