Skip to content

Commit 1f11075

Browse files
fevo1971tomusdrw
authored andcommitted
Integrate gitlab ci (#503)
* added giltab-ci * removed '--lock' from test * no time command in onw windows * added stage: checkstyle * shortend the config a bit * bit more compact ci-file * gitlab-ci intergation * changed order of ci jobs * Re-format.
1 parent d3d8c6b commit 1f11075

10 files changed

Lines changed: 102 additions & 49 deletions

File tree

.gitlab-ci.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
stages:
2+
- checkstyle
3+
- test
4+
5+
.test_and_build: &test_and_build
6+
script:
7+
- cargo build --all
8+
- cargo test --all
9+
10+
.only: &only
11+
only:
12+
- triggers
13+
- tags
14+
- master
15+
- schedules
16+
- web
17+
- /^[0-9]+$/
18+
19+
# test rust stable
20+
test-linux-stable:
21+
image: parity/rust-builder:latest
22+
stage: test
23+
<<: *test_and_build
24+
<<: *only
25+
tags:
26+
- linux-docker
27+
28+
test-windows-stable:
29+
stage: test
30+
<<: *test_and_build
31+
<<: *only
32+
tags:
33+
- rust-windows
34+
35+
test-mac-stable:
36+
stage: test
37+
<<: *test_and_build
38+
<<: *only
39+
tags:
40+
- rust-mac
41+
42+
# check style
43+
checkstyle-linux-stable:
44+
image: parity/rust-builder:latest
45+
stage: checkstyle
46+
script:
47+
- rustup component add rustfmt
48+
- cargo fmt --all -- --check
49+
allow_failure: true
50+
<<: *only
51+
tags:
52+
- linux-docker

core-client/transports/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,5 +509,4 @@ mod tests {
509509
"Expected at least one received item."
510510
);
511511
}
512-
513512
}

core/src/io.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
use std::collections::{hash_map::{Iter, IntoIter}, HashMap};
1+
use std::collections::{
2+
hash_map::{IntoIter, Iter},
3+
HashMap,
4+
};
25
use std::ops::{Deref, DerefMut};
36
use std::sync::Arc;
47

core/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ extern crate serde_derive;
2828

2929
pub use futures;
3030

31-
#[doc(hidden)]
32-
pub extern crate serde_json;
3331
#[doc(hidden)]
3432
pub extern crate serde;
33+
#[doc(hidden)]
34+
pub extern crate serde_json;
3535

3636
mod calls;
3737
mod io;

core/src/types/response.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,11 @@ fn should_parse_empty_response_as_batch() {
286286

287287
let dsr = r#""#;
288288

289-
let deserialized1: Result<Response, _>= serde_json::from_str(dsr);
289+
let deserialized1: Result<Response, _> = serde_json::from_str(dsr);
290290
let deserialized2: Result<Response, _> = Response::from_json(dsr);
291-
assert!(deserialized1.is_err(), "Empty string is not valid JSON, so we should get an error.");
291+
assert!(
292+
deserialized1.is_err(),
293+
"Empty string is not valid JSON, so we should get an error."
294+
);
292295
assert_eq!(deserialized2.unwrap(), Response::Batch(vec![]));
293296
}

http/src/lib.rs

Lines changed: 37 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -530,42 +530,43 @@ fn serve<M: jsonrpc::Metadata, S: jsonrpc::Middleware<M>>(
530530
}
531531
};
532532

533-
bind_result.and_then(move |(listener, local_addr)| {
534-
let allowed_hosts = server_utils::hosts::update(allowed_hosts, &local_addr);
535-
536-
let mut http = server::conn::Http::new();
537-
http.keep_alive(keep_alive);
538-
let tcp_stream = SuspendableStream::new(listener.incoming());
539-
540-
tcp_stream
541-
.map(move |socket| {
542-
let service = ServerHandler::new(
543-
jsonrpc_handler.clone(),
544-
cors_domains.clone(),
545-
cors_max_age,
546-
allowed_headers.clone(),
547-
allowed_hosts.clone(),
548-
request_middleware.clone(),
549-
rest_api,
550-
health_api.clone(),
551-
max_request_body_size,
552-
keep_alive,
553-
);
554-
555-
http.serve_connection(socket, service)
556-
.map_err(|e| error!("Error serving connection: {:?}", e))
557-
})
558-
.buffer_unordered(1024)
559-
.for_each(|_| Ok(()))
560-
.map_err(|e| {
561-
warn!("Incoming streams error, closing sever: {:?}", e);
562-
})
563-
.select(shutdown_signal.map_err(|e| {
564-
debug!("Shutdown signaller dropped, closing server: {:?}", e);
565-
}))
566-
.map_err(|_| ())
567-
})
568-
.and_then(|_| done_tx.send(()))
533+
bind_result
534+
.and_then(move |(listener, local_addr)| {
535+
let allowed_hosts = server_utils::hosts::update(allowed_hosts, &local_addr);
536+
537+
let mut http = server::conn::Http::new();
538+
http.keep_alive(keep_alive);
539+
let tcp_stream = SuspendableStream::new(listener.incoming());
540+
541+
tcp_stream
542+
.map(move |socket| {
543+
let service = ServerHandler::new(
544+
jsonrpc_handler.clone(),
545+
cors_domains.clone(),
546+
cors_max_age,
547+
allowed_headers.clone(),
548+
allowed_hosts.clone(),
549+
request_middleware.clone(),
550+
rest_api,
551+
health_api.clone(),
552+
max_request_body_size,
553+
keep_alive,
554+
);
555+
556+
http.serve_connection(socket, service)
557+
.map_err(|e| error!("Error serving connection: {:?}", e))
558+
})
559+
.buffer_unordered(1024)
560+
.for_each(|_| Ok(()))
561+
.map_err(|e| {
562+
warn!("Incoming streams error, closing sever: {:?}", e);
563+
})
564+
.select(shutdown_signal.map_err(|e| {
565+
debug!("Shutdown signaller dropped, closing server: {:?}", e);
566+
}))
567+
.map_err(|_| ())
568+
})
569+
.and_then(|_| done_tx.send(()))
569570
});
570571
}
571572

pubsub/src/handler.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,5 +146,4 @@ mod tests {
146146
assert_eq!(res, Some(response.into()));
147147
assert_eq!(called.load(Ordering::SeqCst), true);
148148
}
149-
150149
}

server-utils/src/cors.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,5 +590,4 @@ mod tests {
590590
// then
591591
assert_eq!(res, AllowCors::NotRequired);
592592
}
593-
594593
}

server-utils/src/reactor.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,7 @@ impl RpcEventLoop {
130130

131131
/// Blocks current thread and waits until the event loop is finished.
132132
pub fn wait(mut self) -> Result<(), ()> {
133-
self.handle
134-
.take()
135-
.ok_or(())?
136-
.wait()
133+
self.handle.take().ok_or(())?.wait()
137134
}
138135

139136
/// Finishes this event loop.

tcp/src/server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ impl<M: Metadata, S: Middleware<M> + 'static> ServerBuilder<M, S> {
164164
.map(|_| ())
165165
.map_err(|(e, _)| {
166166
error!("Error while executing the server: {:?}", e);
167-
})
167+
}),
168168
)
169169
}
170170
Err(e) => {

0 commit comments

Comments
 (0)