From 290af48007338ab78b9fb707ea33eea3165885fe Mon Sep 17 00:00:00 2001 From: datadunia Date: Wed, 17 Jun 2026 14:23:51 +0700 Subject: [PATCH] ci: add Gitea-compatible caching (RUNNER_TOOL_CACHE + actions/cache@v3 + go-hashfiles) Per Gitea tutorial: add RUNNER_TOOL_CACHE=/toolcache env, use actions/cache@v3 (not v4), and go-hashfiles instead of hashFiles() which is unsupported. --- .gitea/workflows/build_dashboard.yaml | 15 +++++++++++++++ .gitea/workflows/build_device_agent.yaml | 17 +++++++++++++++++ .gitea/workflows/build_server_core.yaml | 17 +++++++++++++++++ 3 files changed, 49 insertions(+) diff --git a/.gitea/workflows/build_dashboard.yaml b/.gitea/workflows/build_dashboard.yaml index 096bed4..e0fc550 100644 --- a/.gitea/workflows/build_dashboard.yaml +++ b/.gitea/workflows/build_dashboard.yaml @@ -6,6 +6,8 @@ on: jobs: build: runs-on: ubuntu-latest + env: + RUNNER_TOOL_CACHE: /toolcache steps: - name: Configure git auth for submodules run: git config --global url."https://x-access-token:${{ secrets.BUILD_TOKEN }}@git.datadunia.com/".insteadOf "https://git.datadunia.com/" @@ -21,6 +23,19 @@ jobs: with: node-version: '24' + - uses: https://gitea.com/actions/go-hashfiles@v0.0.1 + id: hash-npm + with: + patterns: | + apps/dashboard-ui/package-lock.json + + - uses: actions/cache@v3 + with: + path: | + ~/.npm + key: npm-dashboard-${{ steps.hash-npm.outputs.hash }} + restore-keys: npm-dashboard- + - name: Install working-directory: apps/dashboard-ui run: npm ci || npm install diff --git a/.gitea/workflows/build_device_agent.yaml b/.gitea/workflows/build_device_agent.yaml index 2452eff..24dbec5 100644 --- a/.gitea/workflows/build_device_agent.yaml +++ b/.gitea/workflows/build_device_agent.yaml @@ -6,6 +6,8 @@ on: jobs: cross-build: runs-on: ubuntu-latest + env: + RUNNER_TOOL_CACHE: /toolcache steps: - name: Configure git auth for submodules run: git config --global url."https://x-access-token:${{ secrets.BUILD_TOKEN }}@git.datadunia.com/".insteadOf "https://git.datadunia.com/" @@ -21,6 +23,21 @@ jobs: with: go-version: '1.26' + - uses: https://gitea.com/actions/go-hashfiles@v0.0.1 + id: hash-go + with: + patterns: | + apps/device-agent/go.mod + apps/device-agent/go.sum + + - uses: actions/cache@v3 + with: + path: | + /root/go/pkg/mod + /root/.cache/go-build + key: go-device-agent-${{ steps.hash-go.outputs.hash }} + restore-keys: go-device-agent- + - name: Build all platforms working-directory: apps/device-agent shell: bash diff --git a/.gitea/workflows/build_server_core.yaml b/.gitea/workflows/build_server_core.yaml index d116864..50ffa69 100644 --- a/.gitea/workflows/build_server_core.yaml +++ b/.gitea/workflows/build_server_core.yaml @@ -6,6 +6,8 @@ on: jobs: build: runs-on: ubuntu-latest + env: + RUNNER_TOOL_CACHE: /toolcache steps: - name: Configure git auth for submodules run: git config --global url."https://x-access-token:${{ secrets.BUILD_TOKEN }}@git.datadunia.com/".insteadOf "https://git.datadunia.com/" @@ -21,6 +23,21 @@ jobs: with: go-version: '1.26' + - uses: https://gitea.com/actions/go-hashfiles@v0.0.1 + id: hash-go + with: + patterns: | + apps/server-core/go.mod + apps/server-core/go.sum + + - uses: actions/cache@v3 + with: + path: | + /root/go/pkg/mod + /root/.cache/go-build + key: go-server-core-${{ steps.hash-go.outputs.hash }} + restore-keys: go-server-core- + - name: Download Go modules working-directory: apps/server-core run: go mod download