ping-rust 0.1.4

Menu-driven installer and manager for the shoes proxy server
name: CI

on:
  push:
  pull_request:

permissions:
  contents: read

jobs:
  ubuntu:
    name: Ubuntu ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-22.04, ubuntu-24.04]
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v5
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: rustfmt, clippy
      - uses: Swatinem/rust-cache@v2
      - name: Check one-click installer
        shell: bash
        run: |
          set -euo pipefail
          bash -n scripts/install.sh
          bash scripts/install.sh --help >/dev/null
          if bash scripts/install.sh --version invalid >/dev/null 2>&1; then
            echo "error: installer accepted an invalid version" >&2
            exit 1
          fi
          if bash scripts/install.sh --install-dir relative >/dev/null 2>&1; then
            echo "error: installer accepted a relative install directory" >&2
            exit 1
          fi
      - run: cargo fmt --all -- --check
      - run: cargo test --locked
      - run: cargo clippy --locked --all-targets -- -D warnings
      - run: cargo build --locked --release

  distro-build:
    name: ${{ matrix.name }}
    runs-on: ubuntu-24.04
    container: ${{ matrix.image }}
    strategy:
      fail-fast: false
      matrix:
        include:
          - name: Debian 12
            image: debian:12
            family: apt
          - name: Rocky Linux 9
            image: rockylinux:9
            family: rpm
          - name: AlmaLinux 9
            image: almalinux:9
            family: rpm
    steps:
      - name: Install build prerequisites
        shell: bash
        run: |
          if [ "${{ matrix.family }}" = "apt" ]; then
            apt-get update
            DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
              build-essential ca-certificates curl git pkg-config
          else
            dnf install -y \
              ca-certificates gcc gcc-c++ git gzip make \
              pkgconf-pkg-config tar
          fi
      - uses: actions/checkout@v5
      - uses: dtolnay/rust-toolchain@stable
      - uses: Swatinem/rust-cache@v2
        with:
          key: ${{ matrix.name }}
      - run: cargo test --locked
      - run: cargo build --locked --release