From 90aea2de1f8c1fd17677db03c62c1eb97a3d2fb6 Mon Sep 17 00:00:00 2001 From: Kim Nilsson <92694405+nilssonk@users.noreply.github.com> Date: Sat, 25 Jun 2022 20:32:35 +0000 Subject: [PATCH] Add CI workflow (#1) --- .github/workflows/build.yml | 16 ++++++++++++++++ Cargo.toml | 3 +++ src/main.rs | 2 ++ 3 files changed, 21 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..9997e9b --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,16 @@ +name: Build, Lint and Test +on: [push] +jobs: + Build-Lint-Test: + runs-on: [self-hosted] + steps: + - uses: actions/checkout@v2 + - name: Format + run: | + cargo fmt --all -- --check + - name: Clippy + run: | + cargo clippy -- -D warnings + - name: Test + run: | + cargo test --features=fail-on-warnings diff --git a/Cargo.toml b/Cargo.toml index 82577b0..7b4a791 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,5 +9,8 @@ repository = "https://github.com/nilssonk/rugged" categories = ["network-programming", "command-line-utilities"] edition = "2021" +[features] +fail-on-warnings = [] + [dependencies] rl2tp = "0.2.0" diff --git a/src/main.rs b/src/main.rs index e7a11a9..49dd9b0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,5 @@ +#![cfg_attr(feature = "fail-on-warnings", deny(warnings))] + fn main() { println!("Hello, world!"); }