Add performance regression tests in CI #1
Workflow file for this run
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
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | |
# SPDX-License-Identifier: MIT-0 | |
name: Performance Regression Test | |
on: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
regression-test: | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout the code from the pull request branch | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
# Install the stable Rust toolchain | |
- name: Install Rust toolchain | |
id: toolchain | |
run: | | |
rustup toolchain install stable | |
rustup override set stable | |
# Update the package list on the runner | |
- name: Update package list | |
run: sudo apt-get update | |
# Download and install Valgrind 3.23 from source | |
- name: Download Valgrind 3.23 Source | |
run: | | |
wget https://sourceware.org/pub/valgrind/valgrind-3.23.0.tar.bz2 | |
tar -xjf valgrind-3.23.0.tar.bz2 | |
cd valgrind-3.23.0 | |
./configure | |
make | |
sudo make install | |
# Generate the necessary bindings | |
- name: Generate | |
run: ${{env.ROOT_PATH}}bindings/rust/generate.sh --skip-tests | |
# Run performance tests using Valgrind for current branch | |
- name: Run scalar performance test (curr) | |
env: | |
PERF_MODE: valgrind | |
run: cargo test --release --manifest-path=tests/regression/Cargo.toml | |
# Checkout the main branch | |
- name: Checkout mainline | |
run: | | |
git fetch origin main | |
git checkout main | |
# Regenrate bindings for main branch | |
- name: Generate | |
run: ${{env.ROOT_PATH}}bindings/rust/generate.sh --skip-tests | |
# Run performance tests using Valgrind for main branch | |
- name: Run scalar performance test (prev) | |
env: | |
PERF_MODE: valgrind | |
run: cargo test --release --manifest-path=tests/regression/Cargo.toml | |
# Checkout the pull request branch again | |
- name: Checkout pull request branch | |
run: git checkout ${{ github.event.pull_request.head.sha }} | |
# Run the differential performance test | |
- name: Run diff test | |
env: | |
PERF_MODE: diff | |
run: cargo test --release --manifest-path=tests/regression/Cargo.toml | |
# Get the commit hash to reference the output files for getting and storing files (next step) | |
- name: Get commit hash | |
if: ${{ always() }} | |
id: vars | |
run: echo "COMMIT_HASH=$(git rev-parse HEAD)" >> $GITHUB_ENV | |
# Store the annotated and diff results in perf_outputs/. | |
# Moves the current commit hash folder, then searches for the remaining folder and stores it by commit hash. | |
- name: Store annotated and diff results | |
if: ${{ always() }} | |
run: | | |
mkdir -p perf_outputs | |
mv tests/regression/target/$COMMIT_HASH perf_outputs/ | |
mainline_dir=$(find tests/regression/target -type f -name "*.annotated" -exec dirname {} \; | head -n 1) | |
cp -r "$mainline_dir" perf_outputs/ | |
mv tests/regression/target/diff/ perf_outputs/diff/ | |
# Upload the performance output artifacts. This runs even if run diff test fails so debug files can be accessed | |
- name: Upload artifacts | |
if: ${{ always() }} | |
uses: actions/upload-artifact@v2 | |
with: | |
name: perf-outputs | |
path: perf_outputs |