From 9c68bc19b57155b8627852aba3b6c8d766206579 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steven=20Dee=20=28J=C5=8Dshin=29?= Date: Thu, 17 Apr 2025 15:55:27 -0700 Subject: [PATCH] Cache .cosmocc and o for github workflows (#1400) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Uses GitHub’s actions/cache@v4 to store the cosmocc distribution and the output directory between runs of the build workflow, with the version of cosmocc as the cache key. Upgrades to actions/checkout@v4. --- .github/workflows/build.yml | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c558453d5..6bd20ffab 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,5 +1,8 @@ name: build +env: + COSMOCC_VERSION: 3.9.2 + on: push: branches: @@ -19,10 +22,30 @@ jobs: matrix: mode: ["", tiny, rel, tinylinux, optlinux] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 + with: + # Full checkout needed for git-restore-mtime-bare. + fetch-depth: 0 + + # TODO(jart): fork this action. + - uses: chetan/git-restore-mtime-action@v2 + + - uses: actions/cache@v4 + with: + path: .cosmocc/${{ env.COSMOCC_VERSION }} + key: cosmocc-${{ env.COSMOCC_VERSION }} + + - uses: actions/cache@v4 + with: + path: o + key: o-${{ matrix.mode }}-${{ env.COSMOCC_VERSION }}-${{ github.sha }} + restore-keys: | + o-${{ matrix.mode }}-${{ env.COSMOCC_VERSION }}- + o-${{ matrix.mode }}- + o- - name: support ape bins 1 - run: sudo cp build/bootstrap/ape.elf /usr/bin/ape + run: sudo cp -a build/bootstrap/ape.elf /usr/bin/ape - name: support ape bins 2 run: sudo sh -c "echo ':APE:M::MZqFpD::/usr/bin/ape:' >/proc/sys/fs/binfmt_misc/register"