mirror of
https://github.com/ntex-rs/ntex.git
synced 2025-04-04 13:27:39 +03:00
Cache tarpaulin (#7)
* cache tarpaulin * add rustfmt and clippy gh actions * add test timeout * fix clippy warnings * disable code cov for macros * adjst tarpaulin * adjust tarpaulin
This commit is contained in:
parent
cb4df30a86
commit
6f9c6aabea
7 changed files with 89 additions and 52 deletions
38
.github/workflows/checks.yml
vendored
Normal file
38
.github/workflows/checks.yml
vendored
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
name: Checks
|
||||||
|
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
clippy:
|
||||||
|
name: Clippy
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: nightly
|
||||||
|
components: clippy
|
||||||
|
override: true
|
||||||
|
- uses: actions-rs/clippy-check@v1
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
args: --all-features
|
||||||
|
|
||||||
|
fmt:
|
||||||
|
name: Rustfmt
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
rust:
|
||||||
|
- stable
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
profile: minimal
|
||||||
|
toolchain: ${{ matrix.rust }}
|
||||||
|
override: true
|
||||||
|
- uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: fmt
|
||||||
|
args: --all -- --check
|
7
.github/workflows/linux.yml
vendored
7
.github/workflows/linux.yml
vendored
|
@ -48,6 +48,13 @@ jobs:
|
||||||
path: target
|
path: target
|
||||||
key: ${{ matrix.version }}-x86_64-unknown-linux-gnu-cargo-build-trimmed-${{ hashFiles('**/Cargo.lock') }}
|
key: ${{ matrix.version }}-x86_64-unknown-linux-gnu-cargo-build-trimmed-${{ hashFiles('**/Cargo.lock') }}
|
||||||
|
|
||||||
|
- name: Cache cargo tarpaulin
|
||||||
|
if: matrix.version == 'stable' && (github.ref == 'refs/heads/master' || github.event_name == 'pull_request')
|
||||||
|
uses: actions/cache@v1
|
||||||
|
with:
|
||||||
|
path: ~/.cargo/bin/cargo-tarpaulin
|
||||||
|
key: ${{ matrix.version }}-x86_64-unknown-linux-gnu-tarpaulin
|
||||||
|
|
||||||
- name: check build
|
- name: check build
|
||||||
uses: actions-rs/cargo@v1
|
uses: actions-rs/cargo@v1
|
||||||
with:
|
with:
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<p><strong>This is personal project, please, do not use it</strong> </p>
|
<p><strong>This is personal project, please, do not use it</strong> </p>
|
||||||
<p>
|
<p>
|
||||||
|
|
||||||
[/badge.svg)](https://travis-ci.org/ntex-rs/ntex)
|
/badge.svg)
|
||||||
[](https://codecov.io/gh/ntex-rs/ntex)
|
[](https://codecov.io/gh/ntex-rs/ntex)
|
||||||
[](https://crates.io/crates/ntex)
|
[](https://crates.io/crates/ntex)
|
||||||
[](https://docs.rs/ntex)
|
[](https://docs.rs/ntex)
|
||||||
|
|
|
@ -2,6 +2,5 @@ ignore: # ignore codecoverage on following paths
|
||||||
- "**/tests"
|
- "**/tests"
|
||||||
- "**/benches"
|
- "**/benches"
|
||||||
- "**/examples"
|
- "**/examples"
|
||||||
- "**/actix-net"
|
- "ntex-macros"
|
||||||
- "actix-net"
|
- "ntex-rt-macros"
|
||||||
- "ntex-web-macros"
|
|
||||||
|
|
|
@ -256,7 +256,7 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
// keep-alive book-keeping
|
// keep-alive book-keeping
|
||||||
let _ = this.inner.poll_keepalive(cx, this.call.is_io())?;
|
this.inner.poll_keepalive(cx, this.call.is_io())?;
|
||||||
|
|
||||||
// shutdown process
|
// shutdown process
|
||||||
if this.inner.flags.contains(Flags::SHUTDOWN) {
|
if this.inner.flags.contains(Flags::SHUTDOWN) {
|
||||||
|
@ -542,52 +542,46 @@ where
|
||||||
fn poll_write(&mut self, cx: &mut Context<'_>) -> Result<PollWrite, DispatchError> {
|
fn poll_write(&mut self, cx: &mut Context<'_>) -> Result<PollWrite, DispatchError> {
|
||||||
let mut flushed = false;
|
let mut flushed = false;
|
||||||
|
|
||||||
loop {
|
while let Some(ref mut stream) = self.send_payload {
|
||||||
if let Some(ref mut stream) = self.send_payload {
|
// resize write buffer
|
||||||
// resize write buffer
|
let len = self.write_buf.len();
|
||||||
let len = self.write_buf.len();
|
let remaining = self.write_buf.capacity() - len;
|
||||||
let remaining = self.write_buf.capacity() - len;
|
if remaining < WRITE_LW_BUFFER_SIZE {
|
||||||
if remaining < WRITE_LW_BUFFER_SIZE {
|
self.write_buf.reserve(HW_BUFFER_SIZE - remaining);
|
||||||
self.write_buf.reserve(HW_BUFFER_SIZE - remaining);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if len < HW_BUFFER_SIZE {
|
if len < HW_BUFFER_SIZE {
|
||||||
match stream.poll_next_chunk(cx) {
|
match stream.poll_next_chunk(cx) {
|
||||||
Poll::Ready(Some(Ok(item))) => {
|
Poll::Ready(Some(Ok(item))) => {
|
||||||
flushed = false;
|
flushed = false;
|
||||||
self.codec.encode(
|
self.codec
|
||||||
Message::Chunk(Some(item)),
|
.encode(Message::Chunk(Some(item)), &mut self.write_buf)?;
|
||||||
&mut self.write_buf,
|
|
||||||
)?;
|
|
||||||
}
|
|
||||||
Poll::Ready(None) => {
|
|
||||||
flushed = false;
|
|
||||||
self.codec
|
|
||||||
.encode(Message::Chunk(None), &mut self.write_buf)?;
|
|
||||||
self.send_payload = None;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
Poll::Ready(Some(Err(_))) => return Err(DispatchError::Unknown),
|
|
||||||
Poll::Pending => {
|
|
||||||
// response payload stream is not ready
|
|
||||||
// we can only flush
|
|
||||||
if !flushed {
|
|
||||||
self.poll_flush(cx)?;
|
|
||||||
}
|
|
||||||
return Ok(PollWrite::Pending);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
Poll::Ready(None) => {
|
||||||
// write buffer is full, try to flush and check if we have
|
flushed = false;
|
||||||
// space in buffer
|
self.codec
|
||||||
flushed = true;
|
.encode(Message::Chunk(None), &mut self.write_buf)?;
|
||||||
self.poll_flush(cx)?;
|
self.send_payload = None;
|
||||||
if self.write_buf.len() >= HW_BUFFER_SIZE {
|
break;
|
||||||
|
}
|
||||||
|
Poll::Ready(Some(Err(_))) => return Err(DispatchError::Unknown),
|
||||||
|
Poll::Pending => {
|
||||||
|
// response payload stream is not ready
|
||||||
|
// we can only flush
|
||||||
|
if !flushed {
|
||||||
|
self.poll_flush(cx)?;
|
||||||
|
}
|
||||||
return Ok(PollWrite::Pending);
|
return Ok(PollWrite::Pending);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
break;
|
// write buffer is full, try to flush and check if we have
|
||||||
|
// space in buffer
|
||||||
|
flushed = true;
|
||||||
|
self.poll_flush(cx)?;
|
||||||
|
if self.write_buf.len() >= HW_BUFFER_SIZE {
|
||||||
|
return Ok(PollWrite::Pending);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -657,7 +651,7 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.read_buf.is_empty() {
|
if self.read_buf.is_empty() {
|
||||||
return Ok(PollRead::NoUpdates);
|
Ok(PollRead::NoUpdates)
|
||||||
} else {
|
} else {
|
||||||
let result = self.input_decode();
|
let result = self.input_decode();
|
||||||
|
|
||||||
|
|
|
@ -636,11 +636,7 @@ where
|
||||||
};
|
};
|
||||||
let (_, cfg, on_connect, peer_addr) = data.take().unwrap();
|
let (_, cfg, on_connect, peer_addr) = data.take().unwrap();
|
||||||
self.as_mut().project().state.set(State::H2(Dispatcher::new(
|
self.as_mut().project().state.set(State::H2(Dispatcher::new(
|
||||||
cfg.clone(),
|
cfg, conn, on_connect, None, peer_addr,
|
||||||
conn,
|
|
||||||
on_connect,
|
|
||||||
None,
|
|
||||||
peer_addr,
|
|
||||||
)));
|
)));
|
||||||
self.poll(cx)
|
self.poll(cx)
|
||||||
}
|
}
|
||||||
|
|
|
@ -220,7 +220,10 @@ async fn test_connection_force_close() {
|
||||||
assert!(response.status().is_success());
|
assert!(response.status().is_success());
|
||||||
|
|
||||||
// req 2
|
// req 2
|
||||||
let req = client.post(srv.url("/")).force_close();
|
let req = client
|
||||||
|
.post(srv.url("/"))
|
||||||
|
.timeout(Duration::from_secs(10))
|
||||||
|
.force_close();
|
||||||
let response = req.send().await.unwrap();
|
let response = req.send().await.unwrap();
|
||||||
assert!(response.status().is_success());
|
assert!(response.status().is_success());
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue