gnss-dsp 0.3.0

Digital Signal Processing algorithms for GNSS
name: Rust

on:
  push:
    branches:
      - main
    tags:
      - '*'
  pull_request:
  workflow_dispatch:

permissions:
  contents: read

env:
  CARGO_TERM_COLOR: always
  # ubuntu install libcufft into /usr
  CUDA_PATH: /usr

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v5
    - name: Install CUDA and CUFFT
      run: |
        sudo apt-get update
        sudo apt-get install nvidia-cuda-toolkit nvidia-cuda-dev libcufft11
    - name: Format
      run: cargo fmt --all -- --check
    - name: Clippy
      run: cargo clippy --all-targets -- -D warnings
    - name: Doc
      run: RUSTDOCFLAGS="-D warnings" cargo doc
    - name: Build
      run: cargo build --verbose --all-targets
    # commented out because Github runners do not have a GPU
    # - name: Run tests
    #   run: cargo test --verbose --release

  publish:
    name: Publish to crates.io
    runs-on: ubuntu-latest
    if: "startsWith(github.ref, 'refs/tags/')"
    needs: build
    steps:
    - uses: actions/checkout@v5
    - name: Install CUDA and CUFFT
      run: |
        sudo apt-get update
        sudo apt-get install nvidia-cuda-toolkit nvidia-cuda-dev libcufft11
    - uses: katyo/publish-crates@v2
      with:
        registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}