Skip to content

Commit

Permalink
Merge pull request #429 from hatoo/pgo-ci
Browse files Browse the repository at this point in the history
release pgo binary
  • Loading branch information
hatoo authored Mar 16, 2024
2 parents 96c7c2f + cfc73c8 commit acf3e95
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 4 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/release-pgo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Publish PGO

on:
push:
tags:
- "*.*.*"

jobs:
publish:
name: Publish for ${{ matrix.target }} PGO
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
artifact_name: oha
release_name: oha-linux-amd64-pgo
target: x86_64-unknown-linux-musl
additional_args: "--features vsock"
- os: windows-latest
artifact_name: oha.exe
release_name: oha-windows-amd64-pgo.exe
target: x86_64-pc-windows-msvc
additional_args: ""
- os: macos-latest
artifact_name: oha
release_name: oha-macos-amd64-pgo
target: x86_64-apple-darwin
additional_args: ""
- os: macos-14
artifact_name: oha
release_name: oha-macos-arm64-pgo
target: aarch64-apple-darwin
additional_args: ""

steps:
- uses: actions/checkout@v4
- name: Install musl-tools on Linux
run: sudo apt-get update --yes && sudo apt-get install --yes musl-tools
if: contains(matrix.target, 'musl')
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
components: llvm-tools-preview
- run: cargo install cargo-pgo
- uses: taiki-e/install-action@just
- run: just pgo '--target ${{ matrix.target }} ${{ matrix.additional_args }}'
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v1-release
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/${{ matrix.target }}/pgo/${{ matrix.artifact_name }}
asset_name: ${{ matrix.release_name }}
tag: ${{ github.ref }}
21 changes: 17 additions & 4 deletions justfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
pgo:
[unix]
pgo addtional-args="":
#!/bin/bash
trap "kill 0" EXIT
# Disable trap in CI
# `just` returns weired exit code if we use trap
if [ -z $CI]; then trap "kill 0" EXIT; fi
cargo run --release --manifest-path pgo/server/Cargo.toml &
# Should be more than 1m
cargo pgo run -- --profile pgo -- -z 3m -c 900 --no-tui http://localhost:8888
cargo pgo optimize build -- --profile pgo
cargo pgo run -- --profile pgo {{addtional-args}} -- -z 3m -c 900 --no-tui http://localhost:8888
cargo pgo optimize build -- --profile pgo {{addtional-args}}

set windows-powershell := true

[windows]
pgo addtional-args="":
try { \
$proc = Start-Process -NoNewWindow -PassThru cargo -ArgumentList 'run','--release','--manifest-path','pgo/server/Cargo.toml'; \
cargo pgo run -- --profile pgo {{addtional-args}} -- -z 3m -c 900 --no-tui http://localhost:8888; \
cargo pgo optimize build -- --profile pgo {{addtional-args}}; \
} finally { Stop-Process -Id $proc.Id }

0 comments on commit acf3e95

Please sign in to comment.