Files
clawstor/.gitea/workflows/build-with-cache.yml
T
Omar Sobh 927c3e03ea
Build with clawstor cache / Cargo build (clawstor-cached) (push) Successful in 7s
workflow: check ~/.claw-cargo/config.toml (actual convention)
client_config.rs load_layered looks at ~/.claw-cargo/config.toml,
not ~/.config/claw-cargo/config.toml. Fix the workflow preflight
path to match. Both runners already have the file at both locations.
2026-07-13 01:48:50 -07:00

64 lines
2.1 KiB
YAML

name: Build with clawstor cache
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
name: Cargo build (clawstor-cached)
runs-on: clawstor-cache
steps:
- uses: actions/checkout@v4
- name: Build with clawstor cache
id: build
env:
NO_UPLOAD: ${{ github.event_name == 'pull_request' && 'true' || 'false' }}
run: |
set -euo pipefail
echo "user=$(whoami) home=$HOME"
export PATH="$HOME/.cargo/bin:/usr/local/bin:$PATH"
echo "PATH=$PATH"
for bin in rustc cargo claw-cargo; do
if ! command -v $bin >/dev/null 2>&1; then
echo "missing $bin"; exit 1
fi
$bin --version | head -1
done
cfg="$HOME/.claw-cargo/config.toml"
test -s "$cfg" || { echo "no $cfg"; exit 1; }
args=(build --workspace . --profile dev --parallel-restore 1)
if [ "${NO_UPLOAD:-false}" = "true" ]; then
args+=(--no-upload)
fi
started=$SECONDS
set +e
claw-cargo "${args[@]}" 2>&1 | tee /tmp/clawstor-build.out
rc=${PIPESTATUS[0]}
set -e
elapsed=$((SECONDS - started))
outcome=SKIPPED
if grep -q 'cache: *HIT' /tmp/clawstor-build.out; then outcome=HIT
elif grep -q 'cache: *MISS.*populated' /tmp/clawstor-build.out; then outcome=POPULATED
elif grep -q 'cache: *MISS' /tmp/clawstor-build.out; then outcome=MISS
fi
fp=$(grep -oE 'fingerprint: [0-9a-f]+' /tmp/clawstor-build.out | head -1 | awk '{print $2}')
echo "cache-outcome=$outcome" >> "$GITHUB_OUTPUT"
echo "fingerprint=${fp:-unknown}" >> "$GITHUB_OUTPUT"
echo "elapsed-seconds=$elapsed" >> "$GITHUB_OUTPUT"
echo "::notice::clawstor $outcome fp=${fp:-unknown} elapsed=${elapsed}s"
exit "$rc"
- name: Announce outcome
run: |
echo "cache: ${{ steps.build.outputs.cache-outcome }}"
echo "fp: ${{ steps.build.outputs.fingerprint }}"
echo "time: ${{ steps.build.outputs.elapsed-seconds }}s"