workflow: inline all steps instead of composite action #37
@@ -9,41 +9,55 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Cargo build (clawstor-cached)
|
name: Cargo build (clawstor-cached)
|
||||||
# Force host mode via self-hosted label — `ubuntu-latest` in
|
|
||||||
# act_runner defaults to container mode which hides
|
|
||||||
# /usr/local/bin/claw-cargo and the per-runner tls_dir.
|
|
||||||
runs-on: clawstor-cache
|
runs-on: clawstor-cache
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Environment report
|
|
||||||
run: |
|
|
||||||
echo "user: $(whoami)"
|
|
||||||
echo "home: $HOME"
|
|
||||||
echo "PATH: $PATH"
|
|
||||||
uname -a
|
|
||||||
ls -la /usr/local/bin/claw-cargo 2>&1 | head -1
|
|
||||||
# Belt-and-braces: ensure both cargo and /usr/local/bin land on PATH.
|
|
||||||
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
|
|
||||||
echo "/usr/local/bin" >> $GITHUB_PATH
|
|
||||||
for bin in rustc cargo cmake pkg-config claw-cargo; do
|
|
||||||
if command -v $bin >/dev/null 2>&1; then
|
|
||||||
echo "$(command -v $bin) $($bin --version 2>&1 | head -1)"
|
|
||||||
else
|
|
||||||
echo "MISSING: $bin"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
- name: Build with clawstor cache
|
- name: Build with clawstor cache
|
||||||
id: cache
|
id: build
|
||||||
uses: ./.gitea/actions/cargo-cache
|
env:
|
||||||
with:
|
NO_UPLOAD: ${{ github.event_name == 'pull_request' && 'true' || 'false' }}
|
||||||
workspace: '.'
|
run: |
|
||||||
profile: 'dev'
|
set -euo pipefail
|
||||||
no-upload: ${{ github.event_name == 'pull_request' }}
|
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/.config/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
|
- name: Announce outcome
|
||||||
run: |
|
run: |
|
||||||
echo "cache: ${{ steps.cache.outputs.cache-outcome }}"
|
echo "cache: ${{ steps.build.outputs.cache-outcome }}"
|
||||||
echo "fp: ${{ steps.cache.outputs.fingerprint }}"
|
echo "fp: ${{ steps.build.outputs.fingerprint }}"
|
||||||
echo "time: ${{ steps.cache.outputs.elapsed-seconds }}s"
|
echo "time: ${{ steps.build.outputs.elapsed-seconds }}s"
|
||||||
|
|||||||
Reference in New Issue
Block a user