Add skeleton for automated performance testing in CI #1049
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
# TODO: | |
# - generate shasum for each published zip, include it in metadata.yaml and in the release description | |
# - consider stripping debug symbols from binaries | |
# - generate RELEASE.md changelog | |
# - change ubuntu to alpine in Dockerfile.ci and Dockerfile | |
# - merge Docker meta into one step | |
name: test_pr | |
on: | |
workflow_dispatch: | |
workflow_call: | |
pull_request: | |
branches: | |
- master | |
types: [ opened, synchronize, reopened ] | |
env: | |
CRATE_NAME: iggy | |
GITHUB_TOKEN: ${{ github.token }} | |
RUST_BACKTRACE: 1 | |
CARGO_TERM_COLOR: always | |
IGGY_CI_BUILD: true | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
sanity: | |
uses: ./.github/workflows/sanity.yml | |
backwards_compatibility: | |
uses: ./.github/workflows/backwards_compatibility.yml | |
needs: sanity | |
with: | |
pr_body: ${{ github.event.pull_request.body }} | |
build_and_test: | |
needs: sanity | |
name: ${{ matrix.platform.skip_tests == true && 'build' || 'build and test' }} ${{ matrix.platform.os_name }} | |
runs-on: ${{ matrix.platform.os }} | |
timeout-minutes: 45 | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: | |
- os_name: Linux-x86_64-musl | |
os: ubuntu-latest | |
target: x86_64-unknown-linux-musl | |
cargo_command: cargo | |
skip_tests: false | |
- os_name: Windows-x86_64 | |
os: windows-latest | |
target: x86_64-pc-windows-msvc | |
skip_tests: true | |
toolchain: | |
- stable | |
# - nightly | |
# - beta | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache cargo & target directories | |
uses: Swatinem/rust-cache@v2 | |
with: | |
key: "v2" | |
- name: Install musl-tools, gnome-keyring and keyutils on Linux | |
run: | | |
sudo apt-get update --yes && sudo apt-get install --yes musl-tools gnome-keyring keyutils | |
rm -f $HOME/.local/share/keyrings/* | |
echo -n "test" | gnome-keyring-daemon --unlock | |
if: ${{ matrix.platform.os == 'ubuntu-latest' }} | |
- name: Build binary (Linux) | |
uses: houseabsolute/actions-rust-cross@v0 | |
with: | |
command: "build" | |
target: ${{ matrix.platform.target }} | |
toolchain: ${{ matrix.toolchain }} | |
args: "--verbose" | |
if: ${{ matrix.platform.os == 'ubuntu-latest' }} | |
- name: Build binary (Windows) | |
uses: houseabsolute/actions-rust-cross@v0 | |
env: | |
AWS_LC_SYS_NO_ASM: 1 | |
with: | |
command: "build" | |
target: ${{ matrix.platform.target }} | |
toolchain: ${{ matrix.toolchain }} | |
args: "--verbose" | |
if: ${{ matrix.platform.os == 'windows-latest' }} | |
- name: Run tests | |
uses: houseabsolute/actions-rust-cross@v0 | |
with: | |
command: "test" | |
target: ${{ matrix.platform.target }} | |
toolchain: ${{ matrix.toolchain }} | |
args: "--verbose" | |
if: ${{ !matrix.platform.skip_tests }} | |
- name: Check CLI examples from README | |
run: ./scripts/run-examples-from-readme.sh | |
if: ${{ matrix.platform.os == 'ubuntu-latest' }} | |
- name: Check if workspace is clean | |
run: git status | grep "working tree clean" || { git status ; exit 1; } | |
if: ${{ matrix.platform.os == 'ubuntu-latest' }} | |
# TODO: below job is nonblocking: temporary solution until we decide whether | |
# we want to use the new M1 macs for CI, determine cost and performance | |
build_and_test_macos: | |
needs: sanity | |
name: build and test macOS-aarch64 | |
runs-on: macos-latest | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- name: Cache cargo & target directories | |
uses: Swatinem/rust-cache@v2 | |
with: | |
key: "v2" | |
- name: Build binary | |
run: cargo build --verbose --target aarch64-apple-darwin | |
- name: Run tests | |
run: cargo test --verbose --target aarch64-apple-darwin | |
finalize_pr: | |
runs-on: ubuntu-latest | |
needs: | |
- sanity | |
- backwards_compatibility | |
- build_and_test | |
if: always() | |
steps: | |
- name: Everything is fine | |
if: ${{ !(contains(needs.*.result, 'failure')) }} | |
run: exit 0 | |
- name: Some tests failed | |
if: ${{ contains(needs.*.result, 'failure') }} | |
run: exit 1 |