name: Validate & Test
on:
push:
branches:
- main
pull_request:
jobs:
print-info:
name: Print info
runs-on: ubuntu-latest
steps:
- run: |
echo "User => ${{ github.actor }}"
echo "Event => ${{ github.event_name }}"
echo "Server => ${{ runner.os }}"
echo "Branch => ${{ github.ref }}"
echo "Repo => ${{ github.repository }}"
echo "Repo => ${{ github.workspace }}"
echo "Status => ${{ job.status }}."
env
fmt:
name: Formatting
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
uses: actions/checkout@v4
- name: Use the Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Setup up a cache for Rust
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- run: cargo fmt --all -- --check
test:
name: Tests
runs-on: ubuntu-latest
needs: [fmt]
steps:
- name: Checkout the repo
uses: actions/checkout@v4
- name: Use the Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Setup up a cache for Rust
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: Run the tests
run: |
cargo test --all-features --locked