Skip to content

Commit f4a2f71

Browse files
committed
Add github actions CI workflow
1 parent 9f90b36 commit f4a2f71

File tree

9 files changed

+85
-157
lines changed

9 files changed

+85
-157
lines changed

.github/workflows/ci.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: CI
2+
3+
on:
4+
pull_request: # Need to run on pull-requests, otherwise PRs from forks don't run
5+
push:
6+
branches:
7+
- 'master' # Always build head of master for the badge in the README
8+
9+
jobs:
10+
static_analysis:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout sources
14+
uses: actions/[email protected]
15+
16+
- name: Check formatting
17+
uses: dprint/[email protected]
18+
19+
- name: Run clippy with default features
20+
run: cargo clippy --workspace --all-targets -- -D warnings
21+
22+
- name: Run clippy with all features enabled
23+
run: cargo clippy --workspace --all-targets --all-features -- -D warnings
24+
25+
build:
26+
strategy:
27+
matrix:
28+
include:
29+
- target: x86_64-unknown-linux-gnu
30+
os: ubuntu-latest
31+
- target: armv7-unknown-linux-gnueabihf
32+
os: ubuntu-latest
33+
runs-on: ${{ matrix.os }}
34+
steps:
35+
36+
- name: Checkout sources
37+
uses: actions/[email protected]
38+
39+
- name: Install compiler for armhf arch
40+
if: matrix.target == 'armv7-unknown-linux-gnueabihf'
41+
run: |
42+
sudo apt-get update
43+
sudo apt-get install gcc-arm-linux-gnueabihf
44+
45+
- name: Build binary
46+
run: |
47+
cargo build -p rendezvous-server --target ${{ matrix.target }}
48+
49+
- name: Upload rendezvous-server binary
50+
uses: actions/upload-artifact@v2-preview
51+
with:
52+
name: rendezvous-server-${{ matrix.target }}
53+
path: target/${{ matrix.target }}/debug/rendezvous-server

Cargo.lock

Lines changed: 0 additions & 138 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,11 @@
22
name = "rendezvous-server"
33
version = "0.1.0"
44
edition = "2018"
5-
65
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
76

87
[dependencies]
98
anyhow = "1"
109
futures = { version = "0.3", default-features = false }
11-
tokio = { version = "1", features = [ "rt-multi-thread", "time", "macros", "sync", "process", "fs", "net" ] }
10+
libp2p = { git = "https://github.com/comit-network/rust-libp2p.git", rev = "96002105b0a7019330413826a332b3a12a7e8a57", default-features = false, features = [ "rendezvous", "tcp-tokio", "yamux", "mplex", "dns-tokio", "noise", "identify" ] }
1211
structopt = { version = "0.3", default-features = false }
13-
libp2p = { git = "https://github.com/comit-network/rust-libp2p.git", rev = "96002105b0a7019330413826a332b3a12a7e8a57", default-features = false, features = [ "rendezvous", "tcp-tokio", "yamux", "mplex", "dns-tokio", "noise", "identify" ] }
14-
15-
[dev-dependencies]
16-
assert_cmd = "0.10"
17-
predicates = "1"
12+
tokio = { version = "1", features = [ "rt-multi-thread", "time", "macros", "sync", "process", "fs", "net" ] }

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ The `register_once` example program can be used to register a namespace with a `
1414

1515
```
1616
register_once --port 8889 --secret-key 11111111111111111111111111111111 --rendezvous-peer_id 12D3KooWHj6UHDzDibbThLy3e3mAMSrneuohnMa3NnbmCYgHyGRg --rendezvous-addr /ip4/121.118.112.55/tcp/3020/p2p/12D3KoowHj6UHDzDibbThLy2e33aMDrneuoxnMa3NnbmCYgHyYgh
17-
```
17+
```

dprint.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"$schema": "https://dprint.dev/schemas/v0.json",
3+
"projectType": "openSource",
4+
"incremental": true,
5+
"markdown": {
6+
},
7+
"rustfmt": {
8+
"edition": 2018,
9+
"condense_wildcard_suffixes": true,
10+
"format_macro_matchers": true,
11+
"imports_granularity" : "Module",
12+
"use_field_init_shorthand": true,
13+
"format_code_in_doc_comments": true,
14+
"normalize_comments": true,
15+
"wrap_comments": true,
16+
"overflow_delimited_expr": true
17+
},
18+
"includes": ["**/*.{md}", "**/*.{toml}", "**/*.{rs}"],
19+
"excludes": [ "target/" ],
20+
"plugins": [
21+
"https://plugins.dprint.dev/markdown-0.6.1.wasm",
22+
"https://github.com/thomaseizinger/dprint-plugin-cargo-toml/releases/download/0.1.0/cargo-toml-0.1.0.wasm",
23+
"https://plugins.dprint.dev/rustfmt-0.4.0.exe-plugin@c6bb223ef6e5e87580177f6461a0ab0554ac9ea6b54f78ea7ae8bf63b14f5bc2"
24+
]
25+
}

examples/discover.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ use libp2p::futures::StreamExt;
44
use libp2p::rendezvous::{Config, Rendezvous};
55
use libp2p::swarm::{SwarmBuilder, SwarmEvent};
66
use libp2p::tcp::TokioTcpConfig;
7-
use libp2p::Transport;
8-
use libp2p::{identity, rendezvous};
9-
use libp2p::{Multiaddr, PeerId};
7+
use libp2p::{identity, rendezvous, Multiaddr, PeerId, Transport};
108
use rendezvous_server::transport::authenticate_and_multiplex;
119
use structopt::StructOpt;
1210

examples/register_once.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ use libp2p::identify::{Identify, IdentifyConfig, IdentifyEvent};
66
use libp2p::rendezvous::{Config, Rendezvous};
77
use libp2p::swarm::{SwarmBuilder, SwarmEvent};
88
use libp2p::tcp::TokioTcpConfig;
9-
use libp2p::Transport;
10-
use libp2p::{identity, rendezvous};
11-
use libp2p::{Multiaddr, PeerId};
9+
use libp2p::{identity, rendezvous, Multiaddr, PeerId, Transport};
1210
use rendezvous_server::transport::authenticate_and_multiplex;
1311
use rendezvous_server::{parse_secret_key, Behaviour, Event};
1412
use structopt::StructOpt;

src/bin/rendezvous_server.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@ use libp2p::core::identity::ed25519::SecretKey;
33
use libp2p::dns::TokioDnsConfig;
44
use libp2p::futures::StreamExt;
55
use libp2p::identify::{Identify, IdentifyConfig};
6-
use libp2p::identity;
76
use libp2p::rendezvous::{Config, Rendezvous};
87
use libp2p::swarm::SwarmBuilder;
98
use libp2p::tcp::TokioTcpConfig;
10-
use libp2p::PeerId;
11-
use libp2p::Transport;
9+
use libp2p::{identity, PeerId, Transport};
1210
use rendezvous_server::transport::authenticate_and_multiplex;
1311
use rendezvous_server::{parse_secret_key, Behaviour};
1412
use structopt::StructOpt;

src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
use anyhow::Result;
22
use libp2p::core::identity::ed25519::SecretKey;
33
use libp2p::identify::{Identify, IdentifyEvent};
4-
use libp2p::rendezvous;
54
use libp2p::rendezvous::Rendezvous;
6-
use libp2p::NetworkBehaviour;
5+
use libp2p::{rendezvous, NetworkBehaviour};
76

87
pub mod transport;
98

0 commit comments

Comments
 (0)