foxy-io 0.3.4

A configuration-driven and hyper-extensible HTTP proxy library
Documentation
on:
  pull_request:
    branches:
      - develop
  push:
    branches:
      - develop

permissions:
  contents: read
  checks: write

name: Test and Audit Workflow

jobs:
  audit:
    name: Audit
    runs-on: ubuntu-latest
    timeout-minutes: 10
    steps:
      - uses: actions/checkout@v4
      - name: "Generate Cargo.lock"
        run: cargo generate-lockfile

      - name: cargo-audit cache restore
        id: cargo-audit_cache_restore
        uses: actions/cache/restore@v4
        with:
          path: ~/.cargo/bin/cargo-audit
          key: ${{ runner.os }}-cargo-audit

      - run: cargo install cargo-audit
        if: steps.cargo-audit_cache_restore.outputs.cache-hit != 'true'

      - name: cargo-audit cache save
        id: cargo-audit_cache_save
        uses: actions/cache/save@v4
        if: always() && steps.cargo-audit_cache_restore.outputs.cache-hit != 'true'
        with:
          path: ~/.cargo/bin/cargo-audit
          key: ${{ runner.os }}-cargo-audit

      - uses: rustsec/audit-check@v2
        with:
          token: ${{ secrets.GITHUB_TOKEN }}

  build_and_test_linux:
    name: Build and Test (Linux)
    runs-on: ubuntu-latest
    timeout-minutes: 10
    steps:
      - uses: actions/checkout@v4

      - name: Install Protobuf compiler
        run: |
          sudo apt-get update -qq
          sudo apt-get install -y protobuf-compiler
      - uses: dtolnay/rust-toolchain@stable

      - name: Cache cargo registry restore
        id: cargo_cache_restore_linux
        uses: actions/cache/restore@v4
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
          restore-keys: |
            ${{ runner.os }}-cargo-

      - name: "Build and test"
        run: cargo test --all-features

      - name: Cache cargo registry save
        id: cargo_cache_save_linux
        uses: actions/cache/save@v4
        if: always() && steps.cargo_cache_restore_linux.outputs.cache-hit != 'true'
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

  build_and_test_windows:
    name: Build and Test (Windows)
    runs-on: windows-latest
    timeout-minutes: 20
    steps:
      - uses: actions/checkout@v4

      - name: Install Protobuf compiler
        run: choco install protoc --no-progress -y
        shell: powershell

      - name: Cache cargo registry restore
        id: cargo_cache_restore_windows
        uses: actions/cache/restore@v4
        with:
         path: |
           ~/.cargo/registry
           ~/.cargo/git
           target
         key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
         restore-keys: |
           ${{ runner.os }}-cargo-

      - uses: dtolnay/rust-toolchain@stable
      - name: "Build and test"
        env:
          RUST_BACKTRACE: 1
        run: |
          echo "--- Network Diagnostics ---"
          ipconfig /all
          ping invalid-host-12345.example.com
          powershell -Command "Resolve-DnsName -Name invalid-host-12345.example.com"
          powershell -Command "Test-NetConnection -ComputerName invalid-host-12345.example.com -Port 80"
          powershell -Command "Get-NetFirewallRule -Action Block -Enabled True | Format-Table Name, DisplayName"
          echo "--- Running Tests ---"
          cargo test --all-features -- --test-threads=1

      - name: Cache cargo registry save
        id: cargo_cache_save_windows
        uses: actions/cache/save@v4
        if: always() && steps.cargo_cache_restore_windows.outputs.cache-hit != 'true'
        with:
         path: |
           ~/.cargo/registry
           ~/.cargo/git
           target
         key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}