-
Notifications
You must be signed in to change notification settings - Fork 11
/
pgo.yml
43 lines (35 loc) · 1.17 KB
/
pgo.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# This is an example GitHub Actions workflow that demonstrates how you can optimize your Rust binaries
# with PGO on CI.
name: PGO optimization workflow
on:
push:
branches:
- main
pull_request:
jobs:
optimize:
name: Optimize
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
components: llvm-tools-preview
- name: Cache Rust artifacts
uses: Swatinem/rust-cache@v2
- name: Install cargo-pgo
run: cargo install cargo-pgo
- name: Build instrumented binary
# Use `cargo pgo build -- --bin foo` if you have multiple binaries
run: cargo pgo build
# Run the instrumented binary on some workflow to gather profiles
- name: Gather PGO profiles
run: ./target/x86_64-unknown-linux-gnu/release/foo
- name: Build optimized binary
run: cargo pgo optimize
# Now do something with the PGO optimized binary at `./target/x86_64-unknown-linux-gnu/release/foo` :)