Skip to content

Commit

Permalink
Make serde an optional dependency of zeroconf (#60)
Browse files Browse the repository at this point in the history
* separate serde into feature

Signed-off-by: Walker Crouse <walkercrouse@hotmail.com>

* move examples into the main workspace

Signed-off-by: Walker Crouse <walkercrouse@hotmail.com>

* re-work GitHub Actions workflow

Signed-off-by: Walker Crouse <walkercrouse@hotmail.com>

* color = better

Signed-off-by: Walker Crouse <walkercrouse@hotmail.com>

* remove old workflow

Signed-off-by: Walker Crouse <walkercrouse@hotmail.com>

* update README

Signed-off-by: Walker Crouse <walkercrouse@hotmail.com>

---------

Signed-off-by: Walker Crouse <walkercrouse@hotmail.com>
  • Loading branch information
windy1 committed Aug 19, 2024
1 parent 2e5ee10 commit 4d6a26a
Show file tree
Hide file tree
Showing 11 changed files with 87 additions and 826 deletions.
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

0 comments on commit 4d6a26a

Please sign in to comment.