Skip to content

Merge pull request #322 from orottier/feature/worklet-example #88

Merge pull request #322 from orottier/feature/worklet-example

Merge pull request #322 from orottier/feature/worklet-example #88

Workflow file for this run

# yaml-language-server: $schema=https://json.schemastore.org/github-workflow
name: Build
# read-only repo token, no access to secrets
permissions:
contents: read
# no access to secrets
on:
push:
branches: [main]
pull_request:
env:
CARGO_TERM_COLOR: always
jobs:
verify-build:
runs-on: ubuntu-latest
steps:
- name: Install ALSA and Jack dependencies
run: |
sudo apt-get update && sudo apt-get install -y libasound2-dev libjack-jackd2-dev cmake
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- name: Check out repository
uses: actions/checkout@v3
- name: Generate Cargo.lock
run: cargo generate-lockfile
# restore cargo cache from previous runs
- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
# Distinguished by the action name to avoid sharing!
shared-key: "rust"
# check it builds
- name: Build
run: cargo build --verbose --all-targets --all-features
# run tests
- name: Run tests
run: cargo test --verbose --all-features
benchmark:
runs-on: ubuntu-latest
if: github.ref != 'refs/heads/main'
steps:
# checkout repo, install dependencies
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
# restore cargo cache from previous runs
- name: Rust Cache
uses: Swatinem/rust-cache@v2.0.0
## Benchmarks
- name: install valgrind for benchmarks
run: sudo apt-get install valgrind
- 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
- name: Checkout PR branch
run: git checkout -
- name: Run bench against baseline
run: cargo bench --no-default-features | sed '0,/^test result:/d' | tee 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.number }} > ./pr/pr_number.txt
mv bench.txt ./pr/bench.txt
- uses: actions/upload-artifact@v2
with:
name: pr
path: pr/