saal 1.3.3

Wrappers for the Standardized Astrodynamics Algorithms Library (SAAL)
name: Test

on:
  push:
    branches: ['dev']
  pull_request:
    branches: ['main']

env:
  BUILD_PYTHON_VERSION: '3.10'

jobs:
  build-linux-x86:
    runs-on: ubuntu-latest

    defaults:
      run:
        shell: bash
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable

      - name: Test Rust
        run: cargo test --target x86_64-unknown-linux-gnu --lib --tests --bins

      - name: Build wheel (manylinux x86)
        run: |
          docker run --rm \
            -v ${{ github.workspace }}:/io \
            -e HOME=/root \
            -w /io quay.io/pypa/manylinux2014_x86_64 \
            bash -c '
              yum install -y curl gcc gcc-c++ make openssl-devel openssl && \
              export CARGO_HOME="$HOME/.cargo" && export RUSTUP_HOME="$HOME/.rustup" && \
              curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain stable && \
              source "$CARGO_HOME/env" && \
              cargo clean && \
              cargo install --locked maturin && \
              export OPENSSL_DIR=/usr && \
              export OPENSSL_LIB_DIR=/usr/lib64 && \
              export OPENSSL_INCLUDE_DIR=/usr/include && \
              PYTHON_VERSION=${{ env.BUILD_PYTHON_VERSION }} && \
              TAG=${PYTHON_VERSION//./} && \
              PY_BIN=/opt/python/cp${TAG}-cp${TAG}/bin/python && \
              PIP="${PY_BIN%/python}/pip" && \
              $PIP install --upgrade pip setuptools wheel auditwheel && \
              maturin build --release --compatibility manylinux2014 -i $PY_BIN
            '

      - name: Upload wheel
        uses: actions/upload-artifact@v4
        with:
          name: wheels-linux-x86_64-gnu
          path: target/wheels/*.whl

  build-linux-arm:
    runs-on: ubuntu-24.04-arm
    defaults:
      run:
        shell: bash
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable

      - name: Test Rust
        run: |
          pwd
          find . -maxdepth 5 -type f -name 'libdllmain.so' -o -name 'libenvconst.so' -o -name 'libtimefunc.so'
          cargo test -vv --target aarch64-unknown-linux-gnu --lib --tests --bins

      - name: Build wheel (linux arm)
        run: |
          docker run --rm \
            -v ${{ github.workspace }}:/io \
            -e HOME=/root \
            -w /io quay.io/pypa/manylinux2014_aarch64 \
            bash -c '
              yum install -y curl gcc gcc-c++ make openssl-devel openssl && \
              export CARGO_HOME="$HOME/.cargo" && export RUSTUP_HOME="$HOME/.rustup" && \
              curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain stable && \
              source "$CARGO_HOME/env" && \
              cargo clean && \
              cargo install --locked maturin && \
              export OPENSSL_DIR=/usr && \
              export OPENSSL_LIB_DIR=/usr/lib64 && \
              export OPENSSL_INCLUDE_DIR=/usr/include && \
              PYTHON_VERSION=${{ env.BUILD_PYTHON_VERSION }} && \
              TAG=${PYTHON_VERSION//./} && \
              PY_BIN=/opt/python/cp${TAG}-cp${TAG}/bin/python && \
              PIP="${PY_BIN%/python}/pip" && \
              $PIP install --upgrade pip setuptools wheel auditwheel && \
              maturin build --release --compatibility manylinux2014 -i $PY_BIN
            '

      - name: Upload wheel
        uses: actions/upload-artifact@v4
        with:
          name: wheels-linux-aarch64-gnu
          path: target/wheels/*.whl

  build-macos-x86:
    runs-on: macos-15-intel
    defaults:
      run:
        shell: bash
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable

      - name: Setup Python
        uses: actions/setup-python@v5
        with:
          python-version: ${{ env.BUILD_PYTHON_VERSION }}

      - name: Test Rust
        run: cargo test --target x86_64-apple-darwin --lib --tests --bins

      - name: Build wheel
        run: |
          python -m pip install --upgrade pip maturin
          maturin build --release --locked --target x86_64-apple-darwin

      - name: Upload wheel
        uses: actions/upload-artifact@v4
        with:
          name: wheels-macos-x86_64
          path: target/wheels/*.whl

  build-macos-arm:
    runs-on: macos-latest
    defaults:
      run:
        shell: bash
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable

      - name: Setup Python
        uses: actions/setup-python@v5
        with:
          python-version: ${{ env.BUILD_PYTHON_VERSION }}

      - name: Test Rust
        run: cargo test --target aarch64-apple-darwin --lib --tests --bins

      - name: Build wheel
        run: |
          python -m pip install --upgrade pip maturin
          maturin build --release --locked --target aarch64-apple-darwin

      - name: Upload wheel
        uses: actions/upload-artifact@v4
        with:
          name: wheels-macos-aarch64
          path: target/wheels/*.whl

  build-windows:
    runs-on: windows-latest

    defaults:
      run:
        shell: bash
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable

      - name: Setup Python
        uses: actions/setup-python@v5
        with:
          python-version: ${{ env.BUILD_PYTHON_VERSION }}

      - name: Test Rust
        run: cargo test --target x86_64-pc-windows-msvc --lib --tests --bins

      - name: Build wheel
        run: |
          python -m pip install --upgrade pip maturin
          maturin build --release --locked --target x86_64-pc-windows-msvc

      - name: Upload wheel
        uses: actions/upload-artifact@v4
        with:
          name: wheels-windows-x86_64
          path: target/wheels/*.whl

  test-linux-x86:
    runs-on: ubuntu-latest
    needs: build-linux-x86
    strategy:
      fail-fast: false
      matrix:
        python-version: ['3.9', '3.14']
    defaults:
      run:
        shell: bash
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Setup Python
        uses: actions/setup-python@v5
        with:
          python-version: ${{ matrix.python-version }}

      - name: Download wheel
        uses: actions/download-artifact@v4
        with:
          name: wheels-linux-x86_64-gnu
          path: dist

      - name: Install and test
        run: |
          python -m pip install --upgrade pip pytest
          python -m pip install dist/*.whl
          python -m pytest

  test-linux-arm:
    runs-on: ubuntu-24.04-arm
    needs: build-linux-arm
    strategy:
      fail-fast: false
      matrix:
        python-version: ['3.9', '3.14']
    defaults:
      run:
        shell: bash
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Setup Python
        uses: actions/setup-python@v5
        with:
          python-version: ${{ matrix.python-version }}

      - name: Download wheel
        uses: actions/download-artifact@v4
        with:
          name: wheels-linux-aarch64-gnu
          path: dist

      - name: Install and test
        run: |
          python -m pip install --upgrade pip pytest
          python -m pip install dist/*.whl
          python -m pytest

  test-macos-x86:
    runs-on: macos-15-intel
    needs: build-macos-x86
    strategy:
      fail-fast: false
      matrix:
        python-version: ['3.9', '3.14']
    defaults:
      run:
        shell: bash
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Setup Python
        uses: actions/setup-python@v5
        with:
          python-version: ${{ matrix.python-version }}

      - name: Download wheel
        uses: actions/download-artifact@v4
        with:
          name: wheels-macos-x86_64
          path: dist

      - name: Install and test
        run: |
          python -m pip install --upgrade pip pytest
          python -m pip install dist/*.whl
          python -m pytest

  test-macos-arm:
    runs-on: macos-latest
    needs: build-macos-arm
    strategy:
      fail-fast: false
      matrix:
        python-version: ['3.9', '3.14']
    defaults:
      run:
        shell: bash
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Setup Python
        uses: actions/setup-python@v5
        with:
          python-version: ${{ matrix.python-version }}

      - name: Download wheel
        uses: actions/download-artifact@v4
        with:
          name: wheels-macos-aarch64
          path: dist

      - name: Install and test
        run: |
          python -m pip install --upgrade pip pytest
          python -m pip install dist/*.whl
          python -m pytest

  test-windows:
    runs-on: windows-latest
    needs: build-windows
    strategy:
      fail-fast: false
      matrix:
        python-version: ['3.9', '3.14']
    defaults:
      run:
        shell: bash
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Setup Python
        uses: actions/setup-python@v5
        with:
          python-version: ${{ matrix.python-version }}

      - name: Download wheel
        uses: actions/download-artifact@v4
        with:
          name: wheels-windows-x86_64
          path: dist

      - name: Install and test
        run: |
          python -m pip install --upgrade pip pytest
          python -m pip install dist/*.whl
          python -m pytest