Skip to content
This repository was archived by the owner on Dec 10, 2022. It is now read-only.

Commit 1198216

Browse files
committed
chore: add github actions
1 parent 6d19e80 commit 1198216

File tree

7 files changed

+98
-112
lines changed

7 files changed

+98
-112
lines changed

.appveyor.yml

Lines changed: 0 additions & 38 deletions
This file was deleted.

.github/workflows/commit-msg.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Commit message
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
commit-msg:
7+
name: Check commit messages
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v2
11+
with:
12+
fetch-depth: 0
13+
- name: Check PR commit messages
14+
run: |
15+
curl -s ${{ github.event.pull_request.commits_url }} |
16+
jq --raw-output '.[].sha' |
17+
xargs ./scripts/verify-commit-messages.sh

.github/workflows/rust.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Rust
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- master
8+
9+
jobs:
10+
build:
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
matrix:
14+
os: [ubuntu-latest, macos-latest, windows-latest]
15+
rust:
16+
- stable
17+
- 1.42.0
18+
steps:
19+
- uses: actions/checkout@v2
20+
- uses: actions-rs/toolchain@v1
21+
with:
22+
profile: minimal
23+
toolchain: ${{ matrix.rust }}
24+
override: true
25+
- name: Build
26+
run: cargo build --verbose
27+
- name: Run tests
28+
run: cargo test --verbose
29+
- name: Build docs
30+
run: cargo doc
31+
32+
clippy:
33+
name: Clippy
34+
runs-on: ubuntu-latest
35+
strategy:
36+
matrix:
37+
rust:
38+
- stable
39+
steps:
40+
- uses: actions/checkout@v2
41+
- uses: actions-rs/toolchain@v1
42+
with:
43+
profile: minimal
44+
toolchain: ${{ matrix.rust }}
45+
override: true
46+
- run: rustup component add clippy
47+
- uses: actions-rs/cargo@v1
48+
with:
49+
command: clippy
50+
args: -- -D warnings
51+
52+
deb:
53+
name: Deb
54+
runs-on: ubuntu-latest
55+
strategy:
56+
matrix:
57+
rust:
58+
- stable
59+
steps:
60+
- uses: actions/checkout@v2
61+
- uses: actions-rs/toolchain@v1
62+
with:
63+
profile: minimal
64+
toolchain: ${{ matrix.rust }}
65+
override: true
66+
- name: Run cargo-deb
67+
run: |
68+
cargo install cargo-deb -f
69+
cargo deb

.travis.yml

Lines changed: 0 additions & 55 deletions
This file was deleted.

scripts/verify-commit-messages.sh

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,20 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22

33
# Script for verifying conformance to commit message format of commits in commit
44
# range supplied.
55
#
66
# Scrpt fails (non-zero exit status) if commit messages don't conform.
77

88
# usage:
9-
# ./$script $commit_range
10-
#
11-
# $commit_range – in format `abdce..12345`
12-
13-
ARG="$1"
9+
# ./$script $commit_sha_list
1410

15-
echo "" # ← formatting
11+
REGEX_NORMAL="(feat|fix|docs|style|refactor|perf|revert|test|chore)(\(.+\))?:.{1,68})"
12+
REGEX_MERGE="(Merge pull request #[[:digit:]]{1,10}( from .*/.*)?"
13+
REGEX="^(${REGEX_NORMAL}|${REGEX_MERGE})$"
1614

17-
git checkout $CI_COMMIT_REF_NAME
15+
echo # formatting
1816

19-
if [[ $CI_COMMIT_REF_NAME == "master" ]]
20-
then
21-
fail=$(git log --format=format:'%s' "$ARG" | grep -v -E '^((feat|fix|docs|style|refactor|perf|revert|test|chore)(\(.+\))?:.{1,68})|(Merge pull request #[[:digit:]]{1,10}( from .*/.*)?)$')
22-
else
23-
fail=$(git log --format=format:'%s' "$CI_COMMIT_REF_NAME" ^master | grep -v -E '^((feat|fix|docs|style|refactor|perf|revert|test|chore)(\(.+\))?:.{1,68})|(Merge pull request #[[:digit:]]{1,10}( from .*/.*)?)$')
24-
fi
17+
fail=$(git show -s --format=format:'%s' "$@" | grep -v -E "${REGEX}")
2518

2619
echo "$fail"
2720

@@ -30,7 +23,7 @@ if [[ $fail ]]
3023
then
3124
echo ""
3225
echo "Above ↑ commits don't conform to commit message format:"
33-
echo "https://github.com/zetok/tox/blob/master/CONTRIBUTING.md#commit-message-format"
26+
echo "https://github.com/tox-rs/tox/blob/master/CONTRIBUTING.md#commit-message-format"
3427
echo ""
3528
echo "Pls fix."
3629
echo ""

src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ async fn run_tcp(config: &NodeConfig, dht_sk: SecretKey, mut tcp_onion: TcpOnion
161161
if config.tcp_addrs.is_empty() {
162162
// If TCP address is not specified don't start TCP server and only drop
163163
// all onion packets from DHT server
164-
while let Some(_) = tcp_onion.rx.next().await {}
164+
while tcp_onion.rx.next().await.is_some() {}
165165

166166
return Ok(())
167167
}
@@ -219,7 +219,7 @@ async fn run_udp(config: &NodeConfig, dht_pk: PublicKey, dht_sk: &SecretKey, mut
219219
} else {
220220
// If UDP address is not specified don't start DHT server and only drop
221221
// all onion packets from TCP server
222-
while let Some(_) = udp_onion.rx.next().await {}
222+
while udp_onion.rx.next().await.is_some() {}
223223

224224
return Ok(())
225225
};
@@ -347,7 +347,7 @@ fn main() {
347347
};
348348

349349
let tcp_config = config.clone();
350-
let tcp_dht_sk = dht_sk.clone();
350+
let tcp_dht_sk = dht_sk;
351351
let tcp_server_future = async move {
352352
run_tcp(&tcp_config, tcp_dht_sk, tcp_onion, tcp_tcp_stats).await
353353
};

src/node_config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ fn run_args(matches: &ArgMatches) -> NodeConfig {
363363
let bootstrap_nodes = matches
364364
.values_of("bootstrap-node")
365365
.into_iter()
366-
.flat_map(|values| values)
366+
.flatten()
367367
.tuples()
368368
.map(|(pk, addr)| {
369369
// get PK bytes of the bootstrap node

0 commit comments

Comments
 (0)