2024-09-05 07:32:31 +02:00
|
|
|
# SPDX-FileCopyrightText: 2024 Christina Sørensen
|
2024-03-15 09:55:00 +01:00
|
|
|
#
|
2024-09-05 07:32:31 +02:00
|
|
|
# SPDX-License-Identifier: EUPL-1.2
|
2024-03-15 09:55:00 +01:00
|
|
|
|
|
|
|
name: Unit tests
|
|
|
|
on:
|
|
|
|
push:
|
2024-09-05 07:32:31 +02:00
|
|
|
branches: [main]
|
2024-03-15 09:55:00 +01:00
|
|
|
paths:
|
|
|
|
- '.github/workflows/unit-tests.yml'
|
|
|
|
- 'src/**'
|
|
|
|
- 'Cargo.*'
|
|
|
|
- build.rs
|
|
|
|
pull_request:
|
2024-09-05 07:32:31 +02:00
|
|
|
branches: [main]
|
2024-03-15 09:55:00 +01:00
|
|
|
paths:
|
|
|
|
- '.github/workflows/unit-tests.yml'
|
|
|
|
- 'src/**'
|
|
|
|
- 'Cargo.*'
|
|
|
|
- build.rs
|
2024-09-05 07:32:31 +02:00
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
|
|
|
|
cancel-in-progress: true
|
2024-03-15 09:55:00 +01:00
|
|
|
env:
|
|
|
|
CARGO_TERM_COLOR: always
|
2024-09-05 07:32:31 +02:00
|
|
|
RUSTFLAGS: --deny warnings
|
2024-03-15 09:55:00 +01:00
|
|
|
jobs:
|
|
|
|
unit-tests:
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
continue-on-error: ${{ matrix.rust == 'nightly' }}
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
|
|
rust: [1.70.0, stable, beta, nightly]
|
|
|
|
steps:
|
|
|
|
- name: Checkout repository
|
|
|
|
uses: actions/checkout@v4
|
2024-09-05 07:32:31 +02:00
|
|
|
- run: rustup toolchain install ${{ matrix.rust }} --profile minimal
|
|
|
|
- uses: Swatinem/rust-cache@v2
|
2024-03-15 09:55:00 +01:00
|
|
|
- name: Install cargo-hack
|
|
|
|
uses: nick-fields/retry@v3
|
|
|
|
with:
|
|
|
|
timeout_minutes: 5
|
|
|
|
max_attempts: 5
|
|
|
|
command: cargo install cargo-hack
|
2024-09-05 07:32:31 +02:00
|
|
|
- name: Run rustfmt checks
|
|
|
|
run: cargo fmt --check
|
2024-03-15 09:55:00 +01:00
|
|
|
- name: Run clippy lints
|
2024-09-05 07:32:31 +02:00
|
|
|
run: cargo clippy -- -D warnings
|
|
|
|
- name: Run unit tests
|
|
|
|
run: cargo hack test
|