name: test_rust

on:
  pull_request:
    branches: [ "*" ]
  push:
    branches: [ "main", "develop", "release" ]
  workflow_call:
  workflow_dispatch:

env:
  CARGO_TERM_COLOR: always

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v4
    - name: Install Rust toolchain
      uses: dtolnay/rust-toolchain@stable
    - name: Format
      run: cargo fmt --check --verbose
    - name: Lint
      run: cargo clippy
    - name: Check semver
      uses: obi1kenobi/cargo-semver-checks-action@v2
    - name: Run tests
      run: cargo test --verbose
