Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make serde an optional dependency of zeroconf #60

Merged
merged 6 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 46 additions & 45 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -1,60 +1,61 @@
name: Rust
name: Rust CI

on:
push:
branches: [master]
branches:
- master
pull_request:
branches: [master, release/**]
branches:
- master

env:
CARGO_TERM_COLOR: always

jobs:
macOS:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Prepare
run: rustup component add clippy
- name: Build
run: ./scripts/buildall.sh
- name: Check formatting
run: ./scripts/checkfmt.sh
- name: Run clippy
run: ./scripts/lintall.sh
- name: Run tests
run: cargo test --verbose -- --skip service_register_is_browsable
build:
name: zeroconf-rs
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
features: [serde, ""]

linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Prepare
run: "rustup component add clippy && sudo apt -y install avahi-daemon libavahi-client-dev && sudo systemctl start avahi-daemon.service"
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.os == 'windows-latest' && 'x86_64-pc-windows-msvc' || matrix.os == 'macos-latest' && 'x86_64-apple-darwin' || 'x86_64-unknown-linux-gnu' }}

- name: Prepare for Linux
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt -y install avahi-daemon libavahi-client-dev
sudo systemctl start avahi-daemon.service

- name: Prepare for Windows
if: matrix.os == 'windows-latest'
run: "choco install -y bonjour"

- name: Cache Cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Build
run: ./scripts/buildall.sh
- name: Check formatting
run: ./scripts/checkfmt.sh
- name: Run clippy
run: ./scripts/lintall.sh
run: cargo build --features "${{ matrix.features }}"

- name: Run tests
run: cargo test --verbose
run: cargo test --features "${{ matrix.features }}" -- --skip service_register_is_browsable

windows-latest:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Install Bonjour
run: choco install -y bonjour
- name: Prepare
run: "rustup component add clippy"
- name: Build
shell: pwsh
run: ./scripts/buildall.ps1
- name: Check formatting
run: ./scripts/checkfmt.ps1
- name: Run clippy
shell: pwsh
run: ./scripts/lintall.ps1
- name: Run tests
run: cargo test --verbose
run: cargo fmt -- --check

- name: Run Clippy
run: cargo clippy --features "${{ matrix.features }}" -- -D warnings
20 changes: 20 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
members = [
"zeroconf",
"zeroconf-macros",
"examples/browser",
"examples/service",
]
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,10 @@ fn on_service_discovered(
}
```

## Features

- `serde` - enables serialization on relevant data structures

## Resources

* [Avahi docs]
Expand Down
Loading
Loading