OS X Only: Looping Sounds Break Audio #570
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow | |
name: benchmark | |
# read-only repo token, no access to secrets | |
permissions: | |
contents: read | |
# no access to secrets | |
on: | |
issue_comment: | |
types: [created, edited] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
benchmark: | |
runs-on: ubuntu-latest | |
if: contains(github.event.comment.body, '/bench') | |
steps: | |
# the workflow is triggered from main branch | |
# cf. https://github.com/actions/checkout/issues/331 | |
# need this first step to init the git repo | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install valgrind and hub | |
run: sudo apt-get update && sudo apt-get install hub valgrind | |
- name: Checkout Pull Request | |
run: hub pr checkout ${{ github.event.issue.number }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# install dependencies | |
- name: Install Rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
# restore cargo cache from previous runs | |
- name: Rust Cache | |
uses: Swatinem/rust-cache@v2 | |
with: | |
# The cache should not be shared between different workflows and jobs. | |
shared-key: ${{ github.workflow }}-${{ github.job }} | |
## Benchmarks | |
- name: Checkout main branch | |
run: git checkout main | |
- name: Copy over benchmarks from PR branch | |
run: git checkout - -- benches/my_benchmark.rs | |
- name: Revert when benches do not compile on main | |
run: cargo check --benches --no-default-features || git checkout main -- benches/my_benchmark.rs | |
- name: Run benchmarks for main branch | |
run: cargo bench --no-default-features --features iai | |
- name: Checkout PR branch | |
run: git checkout - | |
- name: Run bench against baseline | |
run: cargo bench --no-default-features --features iai | sed '0,/^test result:/d' | tee bench.txt | |
# for testing | |
# - name: create mock results | |
# run: echo "my bench results" > bench.txt | |
## Save results | |
## see https://securitylab.github.com/research/github-actions-preventing-pwn-requests/ | |
- name: Save PR number and bench results | |
run: | | |
mkdir -p ./pr | |
echo ${{ github.event.issue.number }} > ./pr/pr_number.txt | |
mv bench.txt ./pr/bench.txt | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: pr | |
path: pr/ |