ci: print log on test failure and clean cache #1056
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
name: ci | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
fmt: | |
name: fmt | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install rustfmt from the rust stable toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
components: rustfmt | |
- name: Rustfmt | |
run: cargo fmt --all -- --check | |
build_and_test: | |
name: testing | |
runs-on: self-hosted | |
steps: | |
- uses: actions/checkout@v4 | |
- name: cargo build | |
run: cargo build --verbose --all | |
- name: cargo test | |
run: cargo test --verbose --all | |
- name: cargo xtask test | |
run: cargo xtask test | |
- name: print logs if tests fail | |
run: cat test_log/*.log | |
if: failure() | |
- name: cargo clean cache | |
run: cargo install cargo-cache --no-default-features --features ci-autoclean && cargo-cache |