add proper CI (#3)
* add proper CI * fmt * badge * bump edition * working badge for crates.io
This commit is contained in:
parent
819ff76864
commit
5162dbee8e
108
.github/workflows/rust.yml
vendored
108
.github/workflows/rust.yml
vendored
|
@ -1,22 +1,102 @@
|
||||||
name: Rust
|
name: Rust
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
|
||||||
branches: [ "master" ]
|
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ "master" ]
|
branches:
|
||||||
|
- master
|
||||||
env:
|
push:
|
||||||
CARGO_TERM_COLOR: always
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
test:
|
||||||
|
name: test
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- name: Cancel Previous Runs
|
||||||
- name: Build
|
uses: styfle/cancel-workflow-action@0.9.1
|
||||||
run: cargo build --verbose
|
with:
|
||||||
- name: Run tests
|
access_token: ${{ github.token }}
|
||||||
run: cargo test --verbose
|
- name: Checkout Sources
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Install Toolchain
|
||||||
|
uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: stable
|
||||||
|
profile: minimal
|
||||||
|
- name: Rust Cache
|
||||||
|
uses: Swatinem/rust-cache@v1.4.0
|
||||||
|
- name: Run tests
|
||||||
|
run: cargo test --verbose
|
||||||
|
|
||||||
|
|
||||||
|
lint:
|
||||||
|
name: Lint
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Cancel Previous Runs
|
||||||
|
uses: styfle/cancel-workflow-action@0.9.1
|
||||||
|
with:
|
||||||
|
access_token: ${{ github.token }}
|
||||||
|
- name: Checkout Sources
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Install Toolchain
|
||||||
|
uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: stable
|
||||||
|
profile: minimal
|
||||||
|
- name: Install Clippy
|
||||||
|
run: rustup component add clippy
|
||||||
|
- name: Install RustFmt
|
||||||
|
run: rustup component add rustfmt
|
||||||
|
- name: Rust Cache
|
||||||
|
uses: Swatinem/rust-cache@v1.4.0
|
||||||
|
- name: Run format check
|
||||||
|
run: cargo fmt --all --check
|
||||||
|
- name: Run clippy
|
||||||
|
run: cargo clippy --all --all-targets -- -D warnings
|
||||||
|
|
||||||
|
audit:
|
||||||
|
name: Audit
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout Sources
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Install Toolchain
|
||||||
|
uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: stable
|
||||||
|
profile: minimal
|
||||||
|
- name: Install Audit
|
||||||
|
run: cargo install cargo-audit
|
||||||
|
- name: Rust Cache
|
||||||
|
uses: Swatinem/rust-cache@v1.4.0
|
||||||
|
- name: Run Audit
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: audit
|
||||||
|
|
||||||
|
build:
|
||||||
|
name: Build
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, macos-latest]
|
||||||
|
rv: [stable, beta, nightly]
|
||||||
|
steps:
|
||||||
|
- name: Cancel Previous Runs
|
||||||
|
uses: styfle/cancel-workflow-action@0.9.1
|
||||||
|
with:
|
||||||
|
access_token: ${{ github.token }}
|
||||||
|
- name: Checkout Sources
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Install Toolchain
|
||||||
|
uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: ${{ matrix.rv }}
|
||||||
|
- name: Rust Cache
|
||||||
|
uses: Swatinem/rust-cache@v1.4.0
|
||||||
|
- name: Cargo Build
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: build
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
[package]
|
[package]
|
||||||
name = "wakey"
|
name = "wakey"
|
||||||
version = "0.1.2"
|
version = "0.2.0"
|
||||||
|
|
||||||
authors = ["Hubert Bugaj<lesny.rumcajs@gmail.com>"]
|
authors = ["Hubert Bugaj<lesny.rumcajs@gmail.com>"]
|
||||||
edition = "2018"
|
edition = "2021"
|
||||||
|
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
repository = "https://github.com/LesnyRumcajs/wakey"
|
repository = "https://github.com/LesnyRumcajs/wakey"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Wakey
|
# Wakey
|
||||||
[](https://travis-ci.com/LesnyRumcajs/wakey)
|
[](https://github.com/LesnyRumcajs/wakey/actions/workflows/rust.yml)
|
||||||
[](https://crates.io/crates/wakey/)
|
[](https://crates.io/crates/wakey)
|
||||||
[](https://docs.rs/wakey)
|
[](https://docs.rs/wakey)
|
||||||
|
|
||||||
Library for managing Wake-on-LAN packets. It supports:
|
Library for managing Wake-on-LAN packets. It supports:
|
||||||
|
|
|
@ -10,7 +10,7 @@ struct CmdArgs {
|
||||||
fn main() {
|
fn main() {
|
||||||
let args = CmdArgs::parse();
|
let args = CmdArgs::parse();
|
||||||
if let Some(m) = args.mac {
|
if let Some(m) = args.mac {
|
||||||
let sep = m.chars().find(|ch| *ch == ':' || *ch == '-').unwrap_or('/');
|
let sep = m.chars().find(|ch| *ch == ':' || *ch == '-').unwrap_or('/');
|
||||||
let wol = wakey::WolPacket::from_string(&m, sep);
|
let wol = wakey::WolPacket::from_string(&m, sep);
|
||||||
if wol.send_magic().is_ok() {
|
if wol.send_magic().is_ok() {
|
||||||
println!("sent the magic packet.");
|
println!("sent the magic packet.");
|
||||||
|
|
Loading…
Reference in New Issue
Block a user