name: test

permissions:
  contents: read

on:
  pull_request:
  push:
    branches:
    - master

jobs:
  test:
    runs-on: ubuntu-latest

    steps:
    - name: Checkout the repo
      uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
      with:
        persist-credentials: false

    - name: Install Rust
      uses: dtolnay/rust-toolchain@b3b07ba8b418998c39fb20f53e8b695cdcc8de1b # v1
      with:
        toolchain: 1.87.0
        components: rustfmt, clippy

    - name: Check formatting
      run: |
        cargo fmt --manifest-path=native/Cargo.toml --all -- --check

    - name: Check clippy warnings
      run: |
        cargo clippy --manifest-path=native/Cargo.toml -- -D warnings
