diff --git a/.config/nextest.toml b/.config/nextest.toml new file mode 100644 index 0000000..3abe895 --- /dev/null +++ b/.config/nextest.toml @@ -0,0 +1,10 @@ +[profile.default] +# Flag tests that hang (e.g. a simulation loop that never converges). +slow-timeout = { period = "30s", terminate-after = 4 } + +[profile.ci] +fail-fast = false +failure-output = "immediate-final" + +[profile.ci.junit] +path = "junit.xml" diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml new file mode 100644 index 0000000..08e3288 --- /dev/null +++ b/.gitea/workflows/test.yml @@ -0,0 +1,55 @@ +name: Test + +on: + push: + branches: [main] + pull_request: + workflow_dispatch: + +env: + CARGO_TERM_COLOR: always + CARGO_INCREMENTAL: 0 + +jobs: + test: + name: Clippy and tests (nextest) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install system dependencies + run: | + SUDO=$(command -v sudo || true) + $SUDO apt-get update + $SUDO apt-get install -y --no-install-recommends pkg-config libasound2-dev libudev-dev libwayland-dev libxkbcommon-dev + + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + with: + components: clippy + + - name: Install cargo-nextest + uses: taiki-e/install-action@nextest + + - name: Cache cargo + uses: actions/cache@v4 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: test-${{ hashFiles('Cargo.lock') }} + restore-keys: test- + + - name: Clippy + run: cargo clippy --workspace --all-targets --locked -- -D warnings + + - name: Test + run: cargo nextest run --workspace --locked --profile ci + + - name: Upload test report + if: always() + uses: actions/upload-artifact@v3 + with: + name: junit + path: target/nextest/ci/junit.xml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..e14ded8 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,47 @@ +name: Test + +on: + push: + branches: [main] + pull_request: + workflow_dispatch: + +env: + CARGO_TERM_COLOR: always + CARGO_INCREMENTAL: 0 + +jobs: + test: + name: Clippy and tests (nextest) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install system dependencies + run: | + sudo apt-get update + sudo apt-get install -y --no-install-recommends pkg-config libasound2-dev libudev-dev libwayland-dev libxkbcommon-dev + + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + with: + components: clippy + + - name: Install cargo-nextest + uses: taiki-e/install-action@nextest + + - name: Cache cargo + uses: Swatinem/rust-cache@v2 + + - name: Clippy + run: cargo clippy --workspace --all-targets --locked -- -D warnings + + - name: Test + run: cargo nextest run --workspace --locked --profile ci + + - name: Upload test report + if: always() + uses: actions/upload-artifact@v4 + with: + name: junit + path: target/nextest/ci/junit.xml