Update .forgejo/workflows/pgo-binary.yml

This commit is contained in:
gigirassy
2026-08-18 04:52:52 +02:00
parent 63dedd0c3e
commit a1b82e3222
+60 -18
View File
@@ -50,16 +50,24 @@ jobs:
LLVM_BIN="$SYSROOT/lib/rustlib/$HOST/bin"
test -x "$LLVM_BIN/llvm-profdata"
echo "LLVM_BIN=$LLVM_BIN" >> "$GITHUB_OUTPUT"
- name: Build instrumented binary
run: |
rm -rf /tmp/riptide-pgo
mkdir -p /tmp/riptide-pgo
"$LLVM_BIN/llvm-profdata" --version
rustc --version
rustc -vV
RUSTFLAGS="\
-C target-feature=+crt-static \
-C profile-generate=/tmp/riptide-pgo \
- name: Build instrumented binary
shell: sh
run: |
set -eu
rm -rf /tmp/riptide-pgo
mkdir -p /tmp/riptide-pgo/profiles
RUSTFLAGS="
-C target-feature=+crt-static
-C profile-generate=/tmp/riptide-pgo/profiles
" cargo build \
--release \
--target "$LINUX_TARGET"
@@ -70,13 +78,27 @@ jobs:
chmod +x /tmp/riptide-pgo/riptide
- name: Train PGO profile
env:
LLVM_PROFILE_FILE: /tmp/riptide-pgo/%m-%p.profraw
file /tmp/riptide-pgo/riptide
- name: Verify instrumented binary
shell: sh
run: |
/tmp/riptide-pgo/riptide --help
- name: Train PGO profile
shell: sh
env:
LLVM_PROFILE_FILE: /tmp/riptide-pgo/profiles/%m-%p.profraw
run: |
set -eu
SITEMAP_URL='https://riptide-pgo.blitzw.in/sitemaps/sitemap.xml'
printf 'Training with sitemap: <%s>\n' "$SITEMAP_URL"
timeout 10m \
/tmp/riptide-pgo/riptide \
--sitemap "https://riptide-pgo.blitzw.in/sitemaps/sitemap.xml" \
--sitemap "$SITEMAP_URL" \
--output /tmp/pgo-urls.txt \
--scheme https \
--workers 16 \
@@ -88,26 +110,45 @@ jobs:
wc -l /tmp/pgo-urls.txt
echo "Generated profiles:"
find /tmp/riptide-pgo -name '*.profraw' -type f -print
find /tmp/riptide-pgo/profiles \
-name '*.profraw' \
-type f \
-print
test -n "$(
find /tmp/riptide-pgo/profiles \
-name '*.profraw' \
-type f \
-print -quit
)"
- name: Merge PGO profiles
shell: sh
run: |
"${{ steps.llvm.outputs.LLVM_BIN }}/llvm-profdata" merge \
set -eu
LLVM_PROFDATA="${{ steps.llvm.outputs.LLVM_BIN }}/llvm-profdata"
"$LLVM_PROFDATA" merge \
-o /tmp/riptide-pgo.profdata \
/tmp/riptide-pgo/*.profraw
/tmp/riptide-pgo/profiles/*.profraw
test -s /tmp/riptide-pgo.profdata
- name: Build optimized Linux binary
shell: sh
run: |
RUSTFLAGS="\
-C target-feature=+crt-static \
-C profile-use=/tmp/riptide-pgo.profdata \
set -eu
RUSTFLAGS="
-C target-feature=+crt-static
-C profile-use=/tmp/riptide-pgo.profdata
" cargo build \
--release \
--target "$LINUX_TARGET"
mkdir -p dist
cp \
"target/$LINUX_TARGET/release/riptide" \
dist/riptide
@@ -115,6 +156,7 @@ jobs:
chmod +x dist/riptide
- name: Verify static binary
shell: sh
run: |
file dist/riptide
@@ -124,6 +166,7 @@ jobs:
fi
- name: Smoke test
shell: sh
run: |
./dist/riptide --help
@@ -133,7 +176,6 @@ jobs:
name: riptide-linux
path: dist/riptide
release:
name: Create Forgejo release
runs-on: self-hosted