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

Add GitHub Action for Pull Requests #1

Merged
merged 1 commit into from
Jun 25, 2023
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
79 changes: 79 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: "Checks"

on:
pull_request:

jobs:
check:
name: "Cargo check"
runs-on: "ubuntu-latest"
steps:
- name: "Check out the repo"
uses: actions/checkout@v3

- uses: "actions-rs/toolchain@v1"
with:
profile: "minimal"
toolchain: "stable"
override: true

- uses: "actions-rs/cargo@v1"
with:
command: "check"

test:
name: "Cargo test"
runs-on: "ubuntu-latest"
steps:
- name: "Check out the repo"
uses: actions/checkout@v3

- uses: "actions-rs/toolchain@v1"
with:
profile: "minimal"
toolchain: "stable"
override: true

- uses: "actions-rs/cargo@v1"
with:
command: "test"

fmt:
name: "Cargo format"
runs-on: "ubuntu-latest"
steps:
- name: "Check out the repo"
uses: actions/checkout@v3

- uses: "actions-rs/toolchain@v1"
with:
profile: "minimal"
toolchain: "stable"
override: true

- run: "rustup component add rustfmt"

- uses: "actions-rs/cargo@v1"
with:
command: "fmt"
args: "--all -- --check"

clippy:
name: "Cargo clippy"
runs-on: "ubuntu-latest"
steps:
- name: "Check out the repo"
uses: actions/checkout@v3

- uses: "actions-rs/toolchain@v1"
with:
profile: "minimal"
toolchain: "stable"
override: true

- run: "rustup component add clippy"

- uses: "actions-rs/cargo@v1"
with:
command: "clippy"
args: "-- -D warnings"
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ pub async fn run() -> Result<(), &'static str> {
timeout(my_duration, wait_for(args.addresses)).await
});

if let Err(_) = thread.join().unwrap().await {
if thread.join().unwrap().await.is_err() {
return Err("Connection timeout, could not connect to the addresses.");
}

Command::new(args.cmd[0].to_string())
Command::new(&args.cmd[0])
.args(&args.cmd[1..])
.spawn()
.expect("Failed to run the command.");
Expand Down
Loading