bgpkit-commons 0.10.3

A library for common BGP-related data and functions.
Documentation
name: Rust

on:
  push:
    branches: [ main ]
    paths:
      - '**.rs'
      - 'Cargo.toml'
      - 'Cargo.lock'
      - '.github/workflows/rust.yaml'
  pull_request:
    branches: [ main ]
    paths:
      - '**.rs'
      - 'Cargo.toml'
      - 'Cargo.lock'
      - '.github/workflows/rust.yaml'

env:
  CARGO_TERM_COLOR: always

jobs:
  build:

    runs-on: ubuntu-latest

    env:
      PEERINGDB_API_KEY: ${{ secrets.PEERINGDB_API_KEY }}

    steps:
      - uses: actions/checkout@v2

      # Test comprehensive feature combinations to ensure optional dependencies work correctly
      # Each module has its own feature flag that gates both the module and its dependencies
      
      - name: Build with no features
        run: cargo build --no-default-features

      - name: Build with default features (all modules)
        run: cargo build

      - name: Build individual features
        run: |
          cargo build --no-default-features --features asinfo
          cargo build --no-default-features --features as2rel
          cargo build --no-default-features --features bogons
          cargo build --no-default-features --features countries
          cargo build --no-default-features --features mrt_collectors
          cargo build --no-default-features --features rpki

      - name: Build feature combinations
        run: |
          cargo build --no-default-features --features "bogons,countries"
          cargo build --no-default-features --features "asinfo,rpki"
          cargo build --no-default-features --features "mrt_collectors,countries"

      - name: Build with all features explicitly
        run: cargo build --features all

      - name: Run format check
        run: cargo fmt --check

      - name: Run tests with default features
        run: cargo test

      - name: Run clippy on all features
        run: cargo clippy --all-features -- -D warnings

      - name: Run clippy on no-default-features
        run: cargo clippy --no-default-features

      - name: Run clippy on individual features
        run: |
          cargo clippy --no-default-features --features asinfo -- -D warnings
          cargo clippy --no-default-features --features bogons -- -D warnings
          cargo clippy --no-default-features --features countries -- -D warnings