port-file 0.1.0

Publish a server's bound socket address to a file, and discover it from a test harness without racy port probing.
Documentation
on:
  push:
    branches:
      - main
  pull_request:

name: CI

jobs:
  lint:
    name: Lint
    runs-on: ubuntu-latest
    env:
      RUSTFLAGS: -D warnings
    steps:
      - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: rustfmt, clippy
      - uses: Swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0 # v2.8.0
      - name: Install just, cargo-hack, and cargo-sync-rdme
        uses: taiki-e/install-action@v2
        with:
          tool: just,cargo-hack,cargo-sync-rdme
      - name: Lint (clippy)
        run: just powerset clippy --all-targets
      - name: Lint (rustfmt)
        run: cargo xfmt --check
      - name: Run rustdoc
        run: just rustdoc
      # Pin to a specific nightly for compatibility with cargo-sync-rdme.
      - name: Install nightly toolchain for cargo-sync-rdme
        uses: dtolnay/rust-toolchain@master
        with:
          toolchain: nightly-2026-04-30
      - name: Regenerate readmes
        run: just generate-readmes
      - name: Check for differences
        run: git diff --exit-code

  build-and-test:
    name: Build and test
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest, windows-latest]
        # 1.86 is the MSRV.
        rust-version: ["1.86", "stable"]
      fail-fast: false
    env:
      RUSTFLAGS: -D warnings
    steps:
      - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
      - uses: dtolnay/rust-toolchain@master
        with:
          toolchain: ${{ matrix.rust-version }}
      - uses: Swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0 # v2.8.0
        with:
          key: rust-${{ matrix.rust-version }}
      - uses: taiki-e/install-action@cargo-hack
      - uses: taiki-e/install-action@just
      - uses: taiki-e/install-action@nextest
      - name: Build
        run: just powerset build
      - name: Run tests
        run: just powerset nextest run
      - name: Doctests
        run: just powerset test --doc