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" LLVM_BIN="$SYSROOT/lib/rustlib/$HOST/bin"
test -x "$LLVM_BIN/llvm-profdata" test -x "$LLVM_BIN/llvm-profdata"
echo "LLVM_BIN=$LLVM_BIN" >> "$GITHUB_OUTPUT" echo "LLVM_BIN=$LLVM_BIN" >> "$GITHUB_OUTPUT"
- name: Build instrumented binary "$LLVM_BIN/llvm-profdata" --version
run: | rustc --version
rm -rf /tmp/riptide-pgo rustc -vV
mkdir -p /tmp/riptide-pgo
RUSTFLAGS="\ - name: Build instrumented binary
-C target-feature=+crt-static \ shell: sh
-C profile-generate=/tmp/riptide-pgo \ 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 \ " cargo build \
--release \ --release \
--target "$LINUX_TARGET" --target "$LINUX_TARGET"
@@ -70,13 +78,27 @@ jobs:
chmod +x /tmp/riptide-pgo/riptide chmod +x /tmp/riptide-pgo/riptide
- name: Train PGO profile file /tmp/riptide-pgo/riptide
env:
LLVM_PROFILE_FILE: /tmp/riptide-pgo/%m-%p.profraw - name: Verify instrumented binary
shell: sh
run: | 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 \ timeout 10m \
/tmp/riptide-pgo/riptide \ /tmp/riptide-pgo/riptide \
--sitemap "https://riptide-pgo.blitzw.in/sitemaps/sitemap.xml" \ --sitemap "$SITEMAP_URL" \
--output /tmp/pgo-urls.txt \ --output /tmp/pgo-urls.txt \
--scheme https \ --scheme https \
--workers 16 \ --workers 16 \
@@ -88,26 +110,45 @@ jobs:
wc -l /tmp/pgo-urls.txt wc -l /tmp/pgo-urls.txt
echo "Generated profiles:" 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 - name: Merge PGO profiles
shell: sh
run: | 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 \ -o /tmp/riptide-pgo.profdata \
/tmp/riptide-pgo/*.profraw /tmp/riptide-pgo/profiles/*.profraw
test -s /tmp/riptide-pgo.profdata test -s /tmp/riptide-pgo.profdata
- name: Build optimized Linux binary - name: Build optimized Linux binary
shell: sh
run: | run: |
RUSTFLAGS="\ set -eu
-C target-feature=+crt-static \
-C profile-use=/tmp/riptide-pgo.profdata \ RUSTFLAGS="
-C target-feature=+crt-static
-C profile-use=/tmp/riptide-pgo.profdata
" cargo build \ " cargo build \
--release \ --release \
--target "$LINUX_TARGET" --target "$LINUX_TARGET"
mkdir -p dist mkdir -p dist
cp \ cp \
"target/$LINUX_TARGET/release/riptide" \ "target/$LINUX_TARGET/release/riptide" \
dist/riptide dist/riptide
@@ -115,6 +156,7 @@ jobs:
chmod +x dist/riptide chmod +x dist/riptide
- name: Verify static binary - name: Verify static binary
shell: sh
run: | run: |
file dist/riptide file dist/riptide
@@ -124,6 +166,7 @@ jobs:
fi fi
- name: Smoke test - name: Smoke test
shell: sh
run: | run: |
./dist/riptide --help ./dist/riptide --help
@@ -133,7 +176,6 @@ jobs:
name: riptide-linux name: riptide-linux
path: dist/riptide path: dist/riptide
release: release:
name: Create Forgejo release name: Create Forgejo release
runs-on: self-hosted runs-on: self-hosted