Merge pull request #18 from bastion-rs/ci_checks

Perform various rust checks in a github action
This commit is contained in:
Mahmut Bulut 2020-03-03 17:55:05 +01:00 committed by GitHub
commit 3d5492aa07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 192 additions and 59 deletions

52
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,52 @@
name: CI
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
strategy:
fail-fast: false
matrix:
toolchain:
- x86_64-pc-windows-msvc
- x86_64-pc-windows-gnu
- i686-pc-windows-msvc
- x86_64-unknown-linux-gnu
- x86_64-apple-darwin
version:
- stable
- nightly
include:
- toolchain: x86_64-pc-windows-msvc
os: windows-latest
- toolchain: x86_64-pc-windows-gnu
os: windows-latest
- toolchain: i686-pc-windows-msvc
os: windows-latest
- toolchain: x86_64-unknown-linux-gnu
os: ubuntu-latest
- toolchain: x86_64-apple-darwin
os: macOS-latest
name: ${{ matrix.version }} - ${{ matrix.toolchain }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@master
- name: Install ${{ matrix.version }}
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.version }}-${{ matrix.toolchain }}
default: true
- name: build
uses: actions-rs/cargo@v1
with:
command: build
args: --all-targets --all-features --verbose

View File

@ -1,9 +1,14 @@
name: CI
on: [push, pull_request]
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build_and_test:
check:
strategy:
fail-fast: false
matrix:
@ -40,41 +45,8 @@ jobs:
toolchain: ${{ matrix.version }}-${{ matrix.toolchain }}
default: true
- name: check nightly
if: matrix.version == 'nightly'
- name: check
uses: actions-rs/cargo@v1
with:
command: check
args: --all --benches --bins --examples --tests
- name: check stable
if: matrix.version == 'stable'
uses: actions-rs/cargo@v1
with:
command: check
args: --all --bins --examples --tests
- name: tests
uses: actions-rs/cargo@v1
with:
command: test
args: --all
check_fmt_and_docs:
name: Checking fmt and docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Setup
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
default: true
components: rustfmt
- name: fmt
run: cargo fmt --all -- --check
- name: doc
run: cargo doc
args: --all-targets --all-features --verbose

View File

@ -1,16 +0,0 @@
on: pull_request
name: Clippy Check
jobs:
clippy_check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
components: clippy
override: true
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}

15
.github/workflows/doc.yml vendored Normal file
View File

@ -0,0 +1,15 @@
on: pull_request
name: Doc
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
command: doc

28
.github/workflows/lints.yml vendored Normal file
View File

@ -0,0 +1,28 @@
on: pull_request
name: Lints (Stable)
jobs:
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-targets --all-features -- -D warnings

30
.github/workflows/nightly_lints.yml vendored Normal file
View File

@ -0,0 +1,30 @@
on: pull_request
name: Lints (Nightly)
jobs:
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
- uses: actions-rs/cargo@v1
continue-on-error: true
with:
command: fmt
args: --all -- --check
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
- uses: actions-rs/clippy-check@v1
continue-on-error: true
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-targets --all-features -- -D warnings

52
.github/workflows/test.yml vendored Normal file
View File

@ -0,0 +1,52 @@
name: CI
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
strategy:
fail-fast: false
matrix:
toolchain:
- x86_64-pc-windows-msvc
- x86_64-pc-windows-gnu
- i686-pc-windows-msvc
- x86_64-unknown-linux-gnu
- x86_64-apple-darwin
version:
- stable
- nightly
include:
- toolchain: x86_64-pc-windows-msvc
os: windows-latest
- toolchain: x86_64-pc-windows-gnu
os: windows-latest
- toolchain: i686-pc-windows-msvc
os: windows-latest
- toolchain: x86_64-unknown-linux-gnu
os: ubuntu-latest
- toolchain: x86_64-apple-darwin
os: macOS-latest
name: ${{ matrix.version }} - ${{ matrix.toolchain }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@master
- name: Install ${{ matrix.version }}
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.version }}-${{ matrix.toolchain }}
default: true
- name: test
uses: actions-rs/cargo@v1
with:
command: test
args: --all-targets --all-features --verbose

View File

@ -66,7 +66,7 @@ fn main() {
let events_handle = spawn_blocking(
async move {
warn!("STARTED: Event Poller");
for (members, event) in ap_events.cluster().clone().events.iter() {
for (members, event) in ap_events.cluster().events.iter() {
warn!("");
warn!(" CLUSTER EVENT ");
warn!("===============");

View File

@ -129,7 +129,7 @@ fn get_cluster(listen_addr: &str, host_key: Uuid) -> &'static Cluster {
static CLUSTER: OnceCell<Cluster> = OnceCell::new();
CLUSTER.get_or_init(|| {
let config = ClusterConfig {
cluster_key: "artillery_local".as_bytes().to_vec(),
cluster_key: b"artillery_local".to_vec(),
listen_addr: (&listen_addr as &str)
.to_socket_addrs()
.unwrap()

View File

@ -65,7 +65,7 @@ fn main() {
let service_discovery = {
let sd_port = get_port();
if let Some(_) = seeker {
if seeker.is_some() {
MulticastServiceDiscoveryConfig {
timeout_delta: Duration::seconds(1),
discovery_addr: SocketAddr::from(([0, 0, 0, 0], sd_port)),
@ -97,7 +97,7 @@ fn main() {
let (tx, discoveries) = channel();
sd.register_seeker(tx).unwrap();
if let Some(_) = seeker {
if seeker.is_some() {
sd.seek_peers().unwrap();
} else {
sd.set_listen_for_peers(true).unwrap();
@ -168,7 +168,7 @@ fn get_cluster(listen_addr: &str, host_key: Uuid) -> &'static Cluster {
static CLUSTER: OnceCell<Cluster> = OnceCell::new();
CLUSTER.get_or_init(|| {
let config = ClusterConfig {
cluster_key: "artillery_local".as_bytes().to_vec(),
cluster_key: b"artillery_local".to_vec(),
listen_addr: (&listen_addr as &str)
.to_socket_addrs()
.unwrap()