RUST-REF-005 Extract core application API #340
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| workflow_dispatch: | |
| concurrency: | |
| group: ci-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| CARGO_TERM_COLOR: always | |
| RUST_BACKTRACE: 1 | |
| # Pin the vendored MiniUPnP C source the native miniupnpc-sys build links against. | |
| MINIUPNP_REF: bced81fb0b73ae78c9b911c89e881fbc6d4a5c7c | |
| jobs: | |
| build-test: | |
| name: build+test (${{ matrix.os }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| steps: | |
| - name: Checkout emulebb-rust | |
| uses: actions/checkout@v4 | |
| - name: Checkout emulebb-miniupnp (native C source) | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: emulebb/emulebb-miniupnp | |
| ref: ${{ env.MINIUPNP_REF }} | |
| path: .ci/emulebb-miniupnp | |
| - name: Install Rust (stable) | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Cache cargo build | |
| uses: Swatinem/rust-cache@v2 | |
| # The local Kad swarm harness refuses loopback by design (node.rs | |
| # lan_bind_ip): bind through the runner's real primary IPv4 so the | |
| # multi-node tests exercise a genuine interface, exactly like the | |
| # operator split-tunnel machines do via X_LOCAL_IP. | |
| - name: Resolve runner LAN IP (X_LOCAL_IP) | |
| shell: bash | |
| run: | | |
| ip=$(python -c "import socket; s=socket.socket(socket.AF_INET, socket.SOCK_DGRAM); s.connect(('203.0.113.1', 9)); print(s.getsockname()[0])") | |
| echo "resolved X_LOCAL_IP=$ip" | |
| echo "X_LOCAL_IP=$ip" >> "$GITHUB_ENV" | |
| - name: Rust build/test gate | |
| env: | |
| MINIUPNP_ROOT: ${{ github.workspace }}/.ci/emulebb-miniupnp | |
| run: python tools/rust_quality_gate.py ci-test | |
| quality: | |
| name: policy + format + clippy | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout emulebb-rust | |
| uses: actions/checkout@v4 | |
| # clippy --workspace builds emulebb-miniupnpc-sys, whose build.rs compiles | |
| # the vendored MiniUPnP C source; provide it exactly as the build-test job | |
| # does so the clippy step is not blocked on a native build failure. | |
| - name: Checkout emulebb-miniupnp (native C source) | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: emulebb/emulebb-miniupnp | |
| ref: ${{ env.MINIUPNP_REF }} | |
| path: .ci/emulebb-miniupnp | |
| - name: Install Rust (stable + rustfmt, clippy) | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: rustfmt, clippy | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Rust quality gate | |
| env: | |
| MINIUPNP_ROOT: ${{ github.workspace }}/.ci/emulebb-miniupnp | |
| run: python tools/rust_quality_gate.py quick | |
| supply-chain: | |
| name: cargo-deny (advisories) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout emulebb-rust | |
| uses: actions/checkout@v4 | |
| - name: cargo-deny — security advisories | |
| uses: EmbarkStudios/cargo-deny-action@v2 | |
| with: | |
| # Advisories (vulnerabilities/yanked) are the hard gate from day one. | |
| # bans/licenses tighten after a dependency audit (see deny.toml). | |
| command: check advisories |