hisi-rf 0.1.0-alpha.86

Chip-selecting radio facade for HiSilicon embedded Rust
name: CI

on:
  push:
    branches: [main]
  pull_request:

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - uses: dtolnay/rust-toolchain@master
        with:
          toolchain: nightly-2026-07-09
          components: clippy,rust-src,rustfmt
      - uses: astral-sh/setup-uv@v7
      - run: cargo fmt --all -- --check
      - name: Test the complete WS63 WPA2 facade
        run: cargo test --locked --features chip-ws63,profile-wifi-wpa2-smoltcp
      - run: cargo clippy --locked --all-targets --features chip-ws63,profile-wifi-wpa2-smoltcp -- -D warnings
      - name: Reject a missing named profile
        run: |
          log="${RUNNER_TEMP}/hisi-rf-missing-profile.log"
          if cargo check -Zbuild-std=core --locked --target riscv32imfc-unknown-none-elf --features chip-ws63 2>"${log}"; then
            echo "hisi-rf unexpectedly accepted chip-ws63 without a named profile" >&2
            exit 1
          fi
          grep -F "select exactly one WS63 named profile" "${log}"
          ! grep -E 'E0428|E0432|E0433|SelectedProfile' "${log}"
      - name: Check WS63 WPA2 SoftAP composition
        run: cargo check -Zbuild-std=core,alloc --locked --target riscv32imfc-unknown-none-elf --features chip-ws63,profile-wifi-wpa2-softap
      - name: Check WS63 WPA3 SoftAP composition
        run: cargo check -Zbuild-std=core,alloc --locked --target riscv32imfc-unknown-none-elf --features chip-ws63,profile-wifi-wpa3-softap
      - name: Check WS63 WPA2 incremental composition
        run: cargo check -Zbuild-std=core --locked --target riscv32imfc-unknown-none-elf --features chip-ws63,profile-wifi-wpa2-smoltcp,incremental-backend-experiment
      - name: Check WS63 WPA2 incremental Embassy wait composition
        run: cargo check -Zbuild-std=core --locked --target riscv32imfc-unknown-none-elf --features chip-ws63,profile-wifi-wpa2-smoltcp,incremental-embassy-wait
      - name: Check WS63 WPA3 incremental composition
        run: cargo check -Zbuild-std=core --locked --target riscv32imfc-unknown-none-elf --features chip-ws63,profile-wifi-wpa3-smoltcp,incremental-backend-experiment
      - name: Check WS63 WPA2 composition
        run: cargo check -Zbuild-std=core --locked --target riscv32imfc-unknown-none-elf --features chip-ws63,profile-wifi-wpa2-smoltcp
      - name: Check WS63 WPA3 composition
        run: cargo check -Zbuild-std=core --locked --target riscv32imfc-unknown-none-elf --features chip-ws63,profile-wifi-wpa3-smoltcp
      - name: Build public facade documentation
        run: cargo doc --locked --features chip-ws63,profile-wifi-wpa2-smoltcp --no-deps
      - name: Check WPA2 dependency and public API boundaries
        run: uv run --script .github/scripts/check-boundaries.py --profile wpa2-personal --rustdoc target/doc/hisi_rf
      - name: Check WPA3 dependency boundaries
        run: uv run --script .github/scripts/check-boundaries.py --profile wpa3-personal
      - name: Install public API checker
        run: cargo install cargo-public-api --version 0.52.0 --locked
      - name: Check facade public API snapshot
        run: .github/scripts/check-public-api.sh
      - name: Reject a missing chip selection
        run: |
          log="${RUNNER_TEMP}/hisi-rf-missing-chip.log"
          if cargo check --locked --features profile-wifi-wpa2-smoltcp 2>"${log}"; then
            echo "hisi-rf unexpectedly accepted a named profile without a chip" >&2
            exit 1
          fi
          grep -F "select exactly one chip feature" "${log}"
      - name: Reject conflicting security profiles
        run: |
          log="${RUNNER_TEMP}/hisi-rf-profile-conflict.log"
          if cargo check --locked --features chip-ws63,profile-wifi-wpa2-smoltcp,profile-wifi-wpa3-smoltcp 2>"${log}"; then
            echo "hisi-rf unexpectedly accepted conflicting security profiles" >&2
            exit 1
          fi
          grep -E "select exactly one (WS63 )?Personal( security)? profile" "${log}"
          ! grep -E 'E0428|E0432|E0433|SelectedProfile' "${log}"
      - name: Reject mixed AP and STA target roles
        run: |
          log="${RUNNER_TEMP}/hisi-rf-role-conflict.log"
          if cargo check --locked --features chip-ws63,profile-wifi-wpa2-softap,profile-wifi-wpa2-smoltcp 2>"${log}"; then
            echo "hisi-rf unexpectedly accepted AP and STA target roles together" >&2
            exit 1
          fi
          grep -E "select either the (WS63 SoftAP profile or one station profile|AP authenticator or STA supplicant target archive)" "${log}"
      - name: Reject conflicting SoftAP security profiles
        run: |
          log="${RUNNER_TEMP}/hisi-rf-softap-conflict.log"
          if cargo check --locked --features chip-ws63,profile-wifi-wpa2-softap,profile-wifi-wpa3-softap 2>"${log}"; then
            echo "hisi-rf unexpectedly accepted conflicting SoftAP security profiles" >&2
            exit 1
          fi
          grep -E "select exactly one (WS63 SoftAP|AP authenticator) security profile" "${log}"
      - name: Package the current published chip backend
        run: cargo package --locked --features chip-ws63,profile-wifi-wpa2-smoltcp

  consumer-matrix:
    name: Consumer (${{ matrix.os }}, ${{ matrix.profile }})
    strategy:
      fail-fast: false
      matrix:
        include:
          - os: ubuntu-latest
            profile: wpa2-personal
            named-profile: profile-wifi-wpa2-smoltcp
          - os: ubuntu-latest
            profile: wpa3-personal
            named-profile: profile-wifi-wpa3-smoltcp
          - os: macos-14
            profile: wpa2-personal
            named-profile: profile-wifi-wpa2-smoltcp
          - os: macos-14
            profile: wpa3-personal
            named-profile: profile-wifi-wpa3-smoltcp
          - os: windows-latest
            profile: wpa2-personal
            named-profile: profile-wifi-wpa2-smoltcp
          - os: windows-latest
            profile: wpa3-personal
            named-profile: profile-wifi-wpa3-smoltcp
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v7
      - uses: dtolnay/rust-toolchain@master
        with:
          toolchain: nightly-2026-07-09
          components: rust-src
      - uses: astral-sh/setup-uv@v7
      - name: Build the facade-selected WS63 dependency graph
        run: cargo build -Zbuild-std=core --locked --release --target riscv32imfc-unknown-none-elf --features chip-ws63,${{ matrix.named-profile }}
      - name: Link a complete firmware through the public facade
        env:
          CARGO_TARGET_RISCV32IMFC_UNKNOWN_NONE_ELF_RUSTFLAGS: -C link-arg=-Thisi-riscv-link.x -C link-arg=--no-relax
        run: cargo build -Zbuild-std=core --locked --release --target riscv32imfc-unknown-none-elf --example ws63_plain_firmware --features chip-ws63,${{ matrix.named-profile }}
      - name: Build the released facade from an external crates.io-only fixture
        working-directory: .github/fixtures/ws63-consumer
        env:
          CARGO_TARGET_DIR: ${{ runner.temp }}/hisi rf build 构建/long external consumer path/${{ matrix.profile }}
        run: cargo build --release --locked --features ${{ matrix.profile }}
      - name: Check the released opt-in incremental contract externally
        if: matrix.os == 'ubuntu-latest' && matrix.profile == 'wpa2-personal'
        working-directory: .github/fixtures/ws63-consumer
        run: cargo check --locked --features ${{ matrix.profile }},incremental-contract
      - name: Rebuild offline with read-only registry sources
        env:
          CARGO_TARGET_DIR: ${{ runner.temp }}/hisi rf build 构建/long external consumer path/${{ matrix.profile }}
        run: uv run --script .github/scripts/check-portable-consumer.py readonly --profile ${{ matrix.profile }}
      - name: Build WPA2 and WPA3 consumers concurrently
        if: matrix.os == 'ubuntu-latest' && matrix.profile == 'wpa2-personal'
        run: uv run --script .github/scripts/check-portable-consumer.py concurrent