nntp-proxy 0.5.0

High-performance NNTP proxy server with connection pooling and authentication
Documentation
name: Rust

on:
  push:
    branches:
      - main
    paths:
      - '**.rs'
      - 'Cargo.toml'
      - 'Cargo.lock'
      - 'rust-toolchain.toml'
      - 'flake.nix'
      - 'Dockerfile'
      - 'scripts/check-rust-version.sh'
      - '.cargo/**'
      - '.github/workflows/rust.yml'
  pull_request:
    paths:
      - '**.rs'
      - 'Cargo.toml'
      - 'Cargo.lock'
      - 'rust-toolchain.toml'
      - 'flake.nix'
      - 'Dockerfile'
      - 'scripts/check-rust-version.sh'
      - '.cargo/**'
      - '.github/workflows/rust.yml'

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

env:
  CARGO_TERM_COLOR: always
  CARGO_INCREMENTAL: 0
  CARGO_PROFILE_DEV_DEBUG: 0
  RUST_MIN_STACK: 8388608

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v6

    - name: Read Rust toolchain
      id: rust-toolchain
      run: |
        channel="$(sed -n 's/^channel = "\(.*\)"/\1/p' rust-toolchain.toml)"
        if [ -z "$channel" ]; then
          echo "Could not read channel from rust-toolchain.toml" >&2
          exit 1
        fi
        echo "channel=$channel" >> "$GITHUB_OUTPUT"

    - name: Check Rust version pins
      run: ./scripts/check-rust-version.sh

    - name: Install Rust
      uses: dtolnay/rust-toolchain@master
      with:
        toolchain: ${{ steps.rust-toolchain.outputs.channel }}
        components: llvm-tools-preview

    - name: Setup Rust cache
      uses: Swatinem/rust-cache@v2
      with:
        shared-key: "test"
        cache-on-failure: true

    - name: Setup mold linker
      uses: rui314/setup-mold@v1

    - name: Install tools
      uses: taiki-e/install-action@v2
      with:
        tool: cargo-nextest,cargo-llvm-cov

    - name: Run tests with coverage
      run: cargo llvm-cov nextest --workspace --lcov --output-path lcov.info

    - name: Upload coverage to Codecov
      uses: codecov/codecov-action@v6
      with:
        files: lcov.info
        flags: unittests
        name: codecov-umbrella
        token: ${{ secrets.CODECOV_TOKEN }}
        fail_ci_if_error: false
        verbose: true

    - name: Upload test results to Codecov
      if: ${{ !cancelled() }}
      uses: codecov/codecov-action@v6
      with:
        report_type: test_results
        token: ${{ secrets.CODECOV_TOKEN }}

    - name: Archive coverage results
      uses: actions/upload-artifact@v7
      with:
        name: coverage-report
        path: lcov.info