From 53cc4ee3215b94019f5191071ca2d5470687cb75 Mon Sep 17 00:00:00 2001 From: Samuel O'Neal Date: Sun, 6 Sep 2026 14:08:13 -0600 Subject: [PATCH] updated the runner to utilize caching --- .gitea/workflows/ci.yml | 9 +++++++++ .gitea/workflows/release.yml | 18 ++++++++++++++++++ scripts/install_odin.sh | 21 +++++++++++++++------ 3 files changed, 42 insertions(+), 6 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 8182802..b80f4ed 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -66,6 +66,15 @@ jobs: with: submodules: recursive + # Cache the extracted Odin install so only the first run downloads the + # ~60 MB tarball; keyed on the pinned version (cache paths live outside + # the checkout, so no sharing between jobs/refs). + - name: Cache Odin + uses: actions/cache@v4 + with: + path: /tmp/odin + key: odin-${{ env.ODIN_VERSION }}-${{ runner.arch }} + - name: Install Odin ${{ env.ODIN_VERSION }} run: scripts/install_odin.sh diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index f3e347e..fb2877f 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -34,6 +34,12 @@ jobs: with: submodules: recursive + - name: Cache Odin + uses: actions/cache@v4 + with: + path: /tmp/odin + key: odin-${{ env.ODIN_VERSION }}-${{ runner.arch }} + - name: Install Odin ${{ env.ODIN_VERSION }} run: scripts/install_odin.sh @@ -76,6 +82,12 @@ jobs: with: submodules: recursive + - name: Cache Odin + uses: actions/cache@v4 + with: + path: /tmp/odin + key: odin-${{ env.ODIN_VERSION }}-${{ runner.arch }} + - name: Install Odin ${{ env.ODIN_VERSION }} run: scripts/install_odin.sh @@ -139,6 +151,12 @@ jobs: with: submodules: recursive + - name: Cache Odin + uses: actions/cache@v4 + with: + path: /tmp/odin + key: odin-${{ env.ODIN_VERSION }}-${{ runner.arch }} + - name: Install Odin ${{ env.ODIN_VERSION }} run: scripts/install_odin.sh diff --git a/scripts/install_odin.sh b/scripts/install_odin.sh index 02670e3..be5e252 100755 --- a/scripts/install_odin.sh +++ b/scripts/install_odin.sh @@ -18,10 +18,19 @@ case "$ARCH" in ;; esac -curl -fL -o /tmp/odin.tar.gz \ - "https://github.com/odin-lang/Odin/releases/download/${VERSION}/odin-linux-${OBJ_ARCH}-${VERSION}.tar.gz" -mkdir -p /tmp/odin -tar -xzf /tmp/odin.tar.gz -C /tmp/odin --strip-components=1 +# If a prior job restored the install from cache, reuse it instead of +# re-downloading. The extracted Odin binary already on PATH is authoritative; +# otherwise fetch the version (plus the raylib workaround) fresh. +if [ -x /tmp/odin/odin ]; then + echo "Odin ${VERSION} found in cache (host arch: ${ARCH}, release arch: ${OBJ_ARCH})" + BIN_DIR=/tmp/odin +else + curl -fL -o /tmp/odin.tar.gz \ + "https://github.com/odin-lang/Odin/releases/download/${VERSION}/odin-linux-${OBJ_ARCH}-${VERSION}.tar.gz" + mkdir -p /tmp/odin + tar -xzf /tmp/odin.tar.gz -C /tmp/odin --strip-components=1 + BIN_DIR=/tmp/odin +fi # Work around an Odin binding bug: for ODIN_ARCH == .arm64 the vendored # raylib references `vendor/raylib/linux-arm/libraylib.a`, but the release @@ -33,7 +42,7 @@ if [ "${OBJ_ARCH}" = "arm64" ] \ fi if [ -n "${GITHUB_PATH:-}" ]; then - echo "/tmp/odin" >> "$GITHUB_PATH" + echo "${BIN_DIR}" >> "$GITHUB_PATH" fi -echo "Installed Odin ${VERSION} (host arch: ${ARCH}, release arch: ${OBJ_ARCH})" +echo "Odin ${VERSION} ready (host arch: ${ARCH}, release arch: ${OBJ_ARCH})"