diff --git a/.gitea/workflows/build-flatpak.yml b/.gitea/workflows/build-flatpak.yml index be4574c..ba54eae 100644 --- a/.gitea/workflows/build-flatpak.yml +++ b/.gitea/workflows/build-flatpak.yml @@ -106,7 +106,7 @@ jobs: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal echo "$HOME/.cargo/bin" >> "$GITHUB_PATH" - - name: Build agent from upstream source + - name: Fetch upstream source if: steps.check.outputs.build == 'true' env: TOKEN: ${{ secrets.HeiniRemoteFlatpakActionReleases }} @@ -117,7 +117,23 @@ jobs: git -C upstream remote add origin "$UPSTREAM_URL" git -C upstream fetch -q --depth 1 origin "${{ steps.ver.outputs.ref }}" git -C upstream checkout -q FETCH_HEAD - cargo build --release -p heiniremote-agent --manifest-path upstream/Cargo.toml + + # Same cache layout as the upstream workflows: without it every build + # compiled all dependencies from scratch (the bulk of the job's time). + - name: Cache cargo + if: steps.check.outputs.build == 'true' + uses: actions/cache@v4 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + upstream/target + key: cargo-flatpak-${{ hashFiles('upstream/Cargo.lock') }} + restore-keys: cargo-flatpak- + + - name: Build agent from upstream source + if: steps.check.outputs.build == 'true' + run: cargo build --release -p heiniremote-agent --manifest-path upstream/Cargo.toml - name: Install Flatpak runtime and SDK if: steps.check.outputs.build == 'true'