name: CI on: push: branches: [main] pull_request: workflow_dispatch: env: CARGO_TERM_COLOR: always RUSTFLAGS: -D warnings # The default test set must not need the internet, a DHT, a public relay, # administrator rights or changes to OS network settings. RUST_BACKTRACE: 1 jobs: check: name: fmt + clippy runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable with: components: rustfmt, clippy - uses: Swatinem/rust-cache@v2 - run: cargo fmt --all -- --check - run: cargo clippy --locked --workspace --all-targets -- -D warnings test: name: test (${{ matrix.os }}) runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable - uses: Swatinem/rust-cache@v2 - run: cargo test --locked --workspace --all-targets - name: run the examples run: | cargo run --locked --example two_agents cargo run --locked --example wireguard_mesh # The real wg/ip backend changes the host's network and needs # CAP_NET_ADMIN, so it is never part of the default job above. It is run on # demand only. wireguard-system: name: wireguard system backend (opt-in) if: github.event_name == 'workflow_dispatch' runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable - uses: Swatinem/rust-cache@v2 - run: sudo apt-get update && sudo apt-get install -y wireguard-tools - run: sudo -E $(which cargo) test --locked --test wireguard_system -- --ignored --test-threads=1 docs: name: rustdoc runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable - uses: Swatinem/rust-cache@v2 - run: cargo doc --locked --workspace --no-deps env: RUSTDOCFLAGS: -D warnings msrv: name: minimum supported Rust version runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@1.91.0 - uses: Swatinem/rust-cache@v2 - run: cargo check --locked --workspace --all-targets