burbomath 0.0.1

Burbokop's rust math library
Documentation
name: CI

on:
  push:
    branches: [ master ]
    tags-ignore:
      - v*
  pull_request:
    branches: [ master ]
  workflow_call:
    secrets:
      envPAT:
        required: true

env:
  CARGO_TERM_COLOR: always

jobs:
  build:
    runs-on: ${{ matrix.os }}
    strategy:
      # Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
      fail-fast: false
      matrix:
        os: [ubuntu-22.04]
        channel: [1.85.0, 1.93.0, 1.95.0]
        features: [default, serde, std, libm, none]

    steps:
    - uses: actions/checkout@v4

    - name: Set reusable strings
      id: strings
      shell: bash
      run: |
        if [ "${{matrix.features}}" = "none" ]
        then
          echo "cargo-options=--no-default-features --verbose --release" >> "$GITHUB_OUTPUT"
        else
          echo "cargo-options=--no-default-features --features ${{matrix.features}} --verbose" >> "$GITHUB_OUTPUT"
        fi

    - name: Set channel
      run: |
        rustup update
        rustup default ${{matrix.channel}}
    - name: Build
      run: cargo build ${{steps.strings.outputs.cargo-options}}
    - name: Run tests
      shell: bash
      run: cargo test ${{steps.strings.outputs.cargo-options}}

  check-format:
    runs-on: ubuntu-22.04
    steps:
    - uses: actions/checkout@v4
    - name: Rust format
      run: cargo fmt --
    - name: Suggest format changes
      uses: reviewdog/action-suggester@v1
      with:
        tool_name: formatters
        level: error
        fail_level: warning

  check-publish-capability:
    runs-on: ubuntu-22.04
    steps:
    - uses: actions/checkout@v4
    - name: Check publish capability
      run: cargo publish --dry-run

  check-readme-version:
    runs-on: ubuntu-22.04
    steps:
    - uses: actions/checkout@v4
    - name: Check readme version
      shell: bash
      run: |
        export CARGO_VERSION=$(cargo metadata --format-version=1 --no-deps | jq '.packages[0].version' | tr -d '"')
        export README_VERSION=$(cat ./README.md | grep "burbomath = " | cut -d "=" -f2 | tr -d ' "')
        echo "Version in Cargo.toml: $CARGO_VERSION"
        echo "Version in README.md: $README_VERSION"
        if [[ "$CARGO_VERSION" != "$README_VERSION" ]]; then
          cat ./README.md | grep -B 2 -A 1 "burbomath = "
          echo "README.md version $README_VERSION does not match Cargo.toml version $CARGO_VERSION"
          exit 1
        fi