row 1.0.0

Row is a command line tool that helps you manage workflows on HPC resources.
Documentation
name: test

concurrency:
  group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
  cancel-in-progress: true

on:
  pull_request:
  push:
    branches:
    - trunk

  workflow_dispatch:

defaults:
  run:
    shell: bash

env:
  CARGO_TERM_COLOR: always
  ROW_COLOR: always
  CLICOLOR: 1

jobs:
  unit_test:
    name: Unit test [${{ matrix.mode }}-rust-${{ matrix.rust }}-${{ matrix.os }}]
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os:
          - ubuntu-24.04
          - macos-14
        rust:
          - 1.88.0
          - 1.91.1
        mode:
         - debug

        include:
        # Add a release build on linux with the latest version of rust
        - os: ubuntu-24.04
          rust: 1.91.1
          mode: release

    steps:
    - name: Checkout
      uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
    - name: Configure Rust
      id: rust_toolchain
      uses: dtolnay/rust-toolchain@0f44b27771c32bda9f458f75a1e241b09791b331
      with:
        toolchain: ${{ matrix.rust }}
    - name: Cache
      uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1
      with:
        key: ${{ matrix.mode }}
        cache-bin: false
    - name: Build
      run: cargo build ${{ matrix.mode == 'release' && '--release' || '' }} --verbose
    - name: Run tests
      run: cargo test ${{ matrix.mode == 'release' && '--release' || '' }} --verbose

  execute_tutorials:
    name: Execute tutorials
    runs-on: ubuntu-24.04
    steps:
    - name: Checkout
      uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
    - name: Configure Rust
      id: rust_toolchain
      uses: dtolnay/rust-toolchain@0f44b27771c32bda9f458f75a1e241b09791b331
      with:
        toolchain: 1.91.1
    - name: Cache
      uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1
      with:
        cache-bin: false
    - name: Install
      run: cargo install --path . --locked --verbose
    - name: Run hello.sh
      run: bash hello.sh
      working-directory: doc/src/guide/tutorial
      env:
        ROW_YES: "true"
    - name: Run group.sh
      run:  bash group.sh
      working-directory: doc/src/guide/tutorial
      env:
        ROW_YES: "true"
    # The signac test requires python
    - name: Set up Python
      uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
      with:
        python-version: "3.14"
    - name: Set up Python environment
      uses: glotzerlab/workflows/setup-uv@894d9678188a02b06560fdeb2b9ba98d016cd371 # 0.10.0
      with:
        lockfile: ".github/workflows/signac-requirements.txt"
    - name: Run signac.sh
      run: bash signac.sh
      working-directory: doc/src/guide/python
      env:
        ROW_YES: "true"

  build_documentation:
    name: Build documentation
    runs-on: ubuntu-24.04
    steps:
    - name: Checkout
      uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
    - name: Set up mdbook
      uses: glotzerlab/workflows/setup-mdbook@894d9678188a02b06560fdeb2b9ba98d016cd371 # 0.10.0
      with:
        mdbook_version: 0.5.0
    - name: Build documentation
      run: mdbook build doc
      env:
        RUST_LOG: "mdbook=info"
    - name: Check links
      uses: lycheeverse/lychee-action@a8c4c7cb88f0c7386610c35eb25108e448569cb0  # v2.7.0
      with:
        args: -n .
        fail: true

  tests_complete:
    name: All tests
    if: always()
    needs: [unit_test, execute_tutorials, build_documentation]
    runs-on: ubuntu-24.04

    steps:
    - run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'
    - name: Done
      run: exit 0