Skip to content

Test

Test #615

Workflow file for this run

name: Test
on:
# Allow running this workflow manually from the Actions tab
workflow_dispatch:
pull_request:
push:
branches:
- main
tags:
- '*'
# Run weekly on the default branch to make sure it always builds with the latest rust release
schedule:
- cron: '30 5 * * 1'
jobs:
test-matrix:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- [self-hosted, linux, arm64]
- macos-latest
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust toolchain
run: |
curl --proto '=https' --tlsv1.2 -sSfL https://sh.rustup.rs \
| sh -s -- -y --default-toolchain stable --profile minimal -c clippy
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
- name: Test Stable
run: cargo +stable test
- name: Test Oldstable
run: |
oldstable=$(cat Cargo.toml | grep rust-version | sed 's/.*"\(.*\)".*/\1/')
rustup toolchain install --profile minimal $oldstable
cargo "+$oldstable" test
- name: Clippy
run: cargo +stable clippy
- name: Rustfmt
run: |
rustup toolchain install nightly -c rustfmt
cargo +nightly fmt -- --check
# This job reports the results of the test jobs above and is used
# to enforce status checks in the repo settings without needing
# to update those settings every time the test jobs are updated.
test-rollup:
name: Test rollup
runs-on: ubuntu-latest
if: always()
needs: test-matrix
steps:
- name: Check for test jobs failure or cancellation
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
run: exit 1