Files
New Futureandopenhands e9ad33e88b Feat/v5 web mcp (#745)
* feat(rust): add Web dashboard and MCP services

Share configuration, status and synchronization between Web and MCP; add authenticated HTTP, stdio lifecycle support, in-process scheduling and offline regression tests. Exercise native tests on the existing Windows/macOS/Linux CI matrix.

Co-authored-by: openhands <openhands@all-hands.dev>

* ci(rust): allow manual cross-platform validation

Enable workflow_dispatch for feature-branch CI without requiring PR creation. Preserve matrices, permissions, publishing boundaries and trusted-branch cache policy.

Co-authored-by: openhands <openhands@all-hands.dev>

* ci(rust): validate feature branch pushes

Run the existing Rust cross-platform matrix for feat/** pushes while retaining trusted-branch-only cache writes and unchanged release triggers.

Co-authored-by: openhands <openhands@all-hands.dev>

* ci(rust): remove temporary branch trigger

The v5 pull request now exists and runs the complete native matrix, so restore the original trusted push branches while retaining Web/MCP paths and tests.

Co-authored-by: openhands <openhands@all-hands.dev>

---------

Co-authored-by: openhands <openhands@all-hands.dev>
2026-09-12 12:09:26 +08:00

181 lines
6.5 KiB
YAML

name: Rust
on:
push:
branches: ["master", "main", "v5"]
paths:
- "rust/**"
- "web/**"
- "ddns/config/field-model.json"
- ".github/workflows/rust.yml"
- ".github/workflows/rust-python-checks.yml"
- ".github/workflows/publish-rust.yml"
- ".github/instructions/rust.instructions.md"
- "docker/rust.Dockerfile"
- "docs/public/install-rust.sh"
- "tests/scripts/test-install-rust.sh"
- "docs/dev/rust.md"
- "docs/en/dev/rust.md"
- "docs/install.md"
- "docs/en/install.md"
- "docs/docker.md"
- "docs/en/docker.md"
- "README.md"
- "README.en.md"
pull_request:
branches: ["master", "main", "abc", "v5"]
paths:
- "rust/**"
- "web/**"
- "ddns/config/field-model.json"
- ".github/workflows/rust.yml"
- ".github/workflows/rust-python-checks.yml"
- ".github/workflows/publish-rust.yml"
- ".github/instructions/rust.instructions.md"
- "docker/rust.Dockerfile"
- "docs/public/install-rust.sh"
- "tests/scripts/test-install-rust.sh"
- "docs/dev/rust.md"
- "docs/en/dev/rust.md"
- "docs/install.md"
- "docs/en/install.md"
- "docs/docker.md"
- "docs/en/docker.md"
- "README.md"
- "README.en.md"
permissions:
contents: read
concurrency:
group: "${{ github.workflow }}-${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
cancel-in-progress: true
jobs:
check:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy,rustfmt
- uses: Swatinem/rust-cache@v2
with:
workspaces: rust
save-if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/v5') }}
- run: cargo fmt --manifest-path rust/Cargo.toml --check
- run: cargo clippy --manifest-path rust/Cargo.toml --locked --all-targets --all-features -- -D warnings
- run: cargo test --manifest-path rust/Cargo.toml --locked
- run: sh tests/scripts/test-install-rust.sh
binary:
needs: check
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
artifact: ddns-rs-linux-x64
target: x86_64-unknown-linux-musl
- os: ubuntu-24.04-arm
artifact: ddns-rs-linux-arm64
target: aarch64-unknown-linux-musl
- os: windows-latest
artifact: ddns-rs-windows-x64
target: x86_64-pc-windows-msvc
- os: macos-15-intel
artifact: ddns-rs-macos-x64
target: x86_64-apple-darwin
- os: macos-latest
artifact: ddns-rs-macos-arm64
target: aarch64-apple-darwin
runs-on: ${{ matrix.os }}
timeout-minutes: 15
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
with:
workspaces: rust
save-if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/v5') }}
- name: Run native unit and process tests
run: cargo test --manifest-path rust/Cargo.toml --locked
- name: Install musl toolchain
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends musl-tools
- name: Build static Linux binary
if: runner.os == 'Linux'
run: cargo build --manifest-path rust/Cargo.toml --release --locked --target ${{ matrix.target }}
env:
CC: musl-gcc
- name: Build native binary
if: runner.os != 'Linux'
run: cargo build --manifest-path rust/Cargo.toml --release --locked --target ${{ matrix.target }}
- name: Smoke test binary
if: runner.os != 'Windows'
run: |
binary="rust/target/${{ matrix.target }}/release/ddns-rs"
"$binary" --version
"$binary" --help
"$binary" web --help
"$binary" mcp --help
"$binary" --dns debug --no-cache \
--index4 "shell:echo 192.0.2.44" --ipv4 v4.example.com \
--index6 "shell:echo 2001:db8::44" --ipv6 v6.example.com
- name: Smoke test Windows binary
if: runner.os == 'Windows'
shell: pwsh
run: |
$binary = "rust\target\${{ matrix.target }}\release\ddns-rs.exe"
& $binary --version
& $binary --help
& $binary web --help
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
& $binary mcp --help
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
& $binary --dns debug --no-cache `
--index4 "shell:echo 192.0.2.44" --ipv4 v4.example.com `
--index6 "shell:echo 2001:db8::44" --ipv6 v6.example.com
- uses: actions/upload-artifact@v7
with:
name: ${{ matrix.artifact }}
path: rust/target/${{ matrix.target }}/release/ddns-rs${{ runner.os == 'Windows' && '.exe' || '' }}
if-no-files-found: error
retention-days: ${{ github.event_name == 'push' && 30 || 3 }}
container:
needs: check
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
platform: linux/amd64
- os: ubuntu-24.04-arm
platform: linux/arm64
runs-on: ${{ matrix.os }}
timeout-minutes: 20
steps:
- uses: actions/checkout@v7
- uses: docker/setup-buildx-action@v4
- uses: docker/build-push-action@v7
with:
context: .
file: docker/rust.Dockerfile
platforms: ${{ matrix.platform }}
load: true
push: false
tags: ddns-rs:test
- name: Smoke test Rust container offline
run: |
docker run --rm --platform ${{ matrix.platform }} ddns-rs:test --version
docker run --rm --platform ${{ matrix.platform }} ddns-rs:test --help
docker run --rm --platform ${{ matrix.platform }} ddns-rs:test web --help
docker run --rm --platform ${{ matrix.platform }} ddns-rs:test mcp --help
docker run --rm --platform ${{ matrix.platform }} ddns-rs:test --dns debug --no-cache \
--index4 "shell:echo 192.0.2.44" --ipv4 v4.example.com \
--index6 "shell:echo 2001:db8::44" --ipv6 v6.example.com