argmax 0.4.0

Rust library to deal with 'argument too long' errors
Documentation
name: CICD

env:
  MIN_SUPPORTED_RUST_VERSION: "1.69.0"
  CICD_INTERMEDIATES_DIR: "_cicd-intermediates"

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

jobs:
  min_version:
    name: Minimum supported rust version
    runs-on: ubuntu-24.04
    steps:
    - name: Checkout source code
      uses: actions/checkout@v2

    - name: Install rust toolchain (v${{ env.MIN_SUPPORTED_RUST_VERSION }})
      uses: actions-rs/toolchain@v1
      with:
        toolchain: ${{ env.MIN_SUPPORTED_RUST_VERSION }}
        default: true
        profile: minimal # minimal component installation (ie, no documentation)
        components: clippy, rustfmt
    - name: Ensure `cargo fmt` has been run
      uses: actions-rs/cargo@v1
      with:
        command: fmt
        args: -- --check
    - name: Run clippy (on minimum supported rust version to prevent warnings we can't fix)
      uses: actions-rs/cargo@v1
      with:
        command: clippy
        args: --all-targets --all-features -- --allow clippy::unknown_clippy_lints
    - name: Run tests
      uses: actions-rs/cargo@v1
      with:
        command: test

  documentation:
    name: Documentation
    runs-on: ubuntu-24.04
    steps:
    - name: Git checkout
      uses: actions/checkout@v2
    - name: Install Rust toolchain
      uses: actions-rs/toolchain@v1
      with:
        toolchain: stable
        default: true
        profile: minimal
    - name: Check documentation
      env:
        RUSTDOCFLAGS: -D warnings
      uses: actions-rs/cargo@v1
      with:
        command: doc
        args: --no-deps --document-private-items --all-features

  build:
    name: ${{ matrix.job.target }} (${{ matrix.job.os }})
    runs-on: ${{ matrix.job.os }}
    strategy:
      fail-fast: false
      matrix:
        job:
          - { target: aarch64-unknown-linux-gnu   , os: ubuntu-24.04, use-cross: true }
          - { target: arm-unknown-linux-gnueabihf , os: ubuntu-24.04, use-cross: true }
          - { target: arm-unknown-linux-musleabihf, os: ubuntu-24.04, use-cross: true }
          - { target: i686-pc-windows-msvc        , os: windows-2025                 }
          - { target: i686-unknown-linux-gnu      , os: ubuntu-24.04, use-cross: true }
          - { target: i686-unknown-linux-musl     , os: ubuntu-24.04, use-cross: true }
          - { target: x86_64-apple-darwin         , os: macos-13                      }
          - { target: x86_64-pc-windows-gnu       , os: windows-2025                  }
          - { target: x86_64-pc-windows-msvc      , os: windows-2025                  }
          - { target: x86_64-unknown-linux-gnu    , os: ubuntu-24.04                  }
          - { target: x86_64-unknown-linux-musl   , os: ubuntu-24.04, use-cross: true }
    steps:
    - name: Checkout source code
      uses: actions/checkout@v2

    - name: Install prerequisites
      shell: bash
      run: |
        case ${{ matrix.job.target }} in
          arm-unknown-linux-*) sudo apt-get -y update ; sudo apt-get -y install gcc-arm-linux-gnueabihf ;;
          aarch64-unknown-linux-gnu) sudo apt-get -y update ; sudo apt-get -y install gcc-aarch64-linux-gnu ;;
        esac

    - name: Extract crate information
      shell: bash
      run: |
        echo "PROJECT_NAME=$(sed -n 's/^name = "\(.*\)"/\1/p' Cargo.toml | head -n1)" >> $GITHUB_ENV
        echo "PROJECT_VERSION=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n1)" >> $GITHUB_ENV
        echo "PROJECT_MAINTAINER=$(sed -n 's/^authors = \["\(.*\)"\]/\1/p' Cargo.toml)" >> $GITHUB_ENV
        echo "PROJECT_HOMEPAGE=$(sed -n 's/^homepage = "\(.*\)"/\1/p' Cargo.toml)" >> $GITHUB_ENV

    - name: Install Rust toolchain
      uses: actions-rs/toolchain@v1
      with:
        toolchain: stable
        target: ${{ matrix.job.target }}
        override: true
        profile: minimal # minimal component installation (ie, no documentation)

    - name: Show version information (Rust, cargo, GCC)
      shell: bash
      run: |
        gcc --version || true
        rustup -V
        rustup toolchain list
        rustup default
        cargo -V
        rustc -V

    - name: Build
      uses: actions-rs/cargo@v1
      with:
        use-cross: ${{ matrix.job.use-cross }}
        command: build
        args: --release --target=${{ matrix.job.target }}

    - name: Set testing options
      id: test-options
      shell: bash
      run: |
        # test only library unit tests for arm-type targets
        unset CARGO_TEST_OPTIONS
        unset CARGO_TEST_OPTIONS ; case ${{ matrix.job.target }} in arm-* | aarch64-*) CARGO_TEST_OPTIONS="--lib ${PROJECT_NAME}" ;; esac;
        echo "CARGO_TEST_OPTIONS=${CARGO_TEST_OPTIONS}" >> $GITHUB_OUTPUT

    - name: Run tests
      uses: actions-rs/cargo@v1
      with:
        use-cross: ${{ matrix.job.use-cross }}
        command: test
        args: --target=${{ matrix.job.target }} ${{ steps.test-options.outputs.CARGO_TEST_OPTIONS}} -- --nocapture --test-threads 1