mirror of https://github.com/smol-rs/polling
Clean up CI config
This commit is contained in:
parent
89ce9bafaa
commit
dec94cb423
|
@ -0,0 +1 @@
|
|||
msrv = "1.31"
|
|
@ -1,65 +0,0 @@
|
|||
name: Build and test
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
build_and_test:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
rust: [nightly, beta, stable, 1.40.0]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Install latest ${{ matrix.rust }}
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: ${{ matrix.rust }}
|
||||
profile: minimal
|
||||
override: true
|
||||
|
||||
- name: Run basic cargo check
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: check
|
||||
args: --all --bins --all-features
|
||||
|
||||
- name: Run cargo check without default features
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: check
|
||||
args: --no-default-features
|
||||
|
||||
- name: Run cargo check
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: check
|
||||
args: --all --benches --bins --examples --tests --all-features
|
||||
|
||||
- name: Run cargo check (without dev-dependencies to catch missing feature flags)
|
||||
if: startsWith(matrix.rust, 'nightly')
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: check
|
||||
args: -Z features=dev_dep
|
||||
|
||||
- name: Run cargo test
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: test
|
||||
|
||||
- name: Clone async-io
|
||||
run: git clone https://github.com/smol-rs/async-io.git
|
||||
- name: Add patch section
|
||||
run: echo '[patch.crates-io]' >> async-io/Cargo.toml
|
||||
- name: Patch polling
|
||||
run: echo 'polling = { path = ".." }' >> async-io/Cargo.toml
|
||||
- name: Test async-io
|
||||
run: cargo test --manifest-path=async-io/Cargo.toml
|
||||
if: matrix.rust != '1.40.0'
|
|
@ -0,0 +1,114 @@
|
|||
name: CI
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
schedule:
|
||||
- cron: '0 2 * * *'
|
||||
|
||||
env:
|
||||
RUSTFLAGS: -D warnings
|
||||
RUST_BACKTRACE: 1
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
rust: [nightly, beta, stable]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install Rust
|
||||
# --no-self-update is necessary because the windows environment cannot self-update rustup.exe.
|
||||
run: rustup update ${{ matrix.rust }} --no-self-update && rustup default ${{ matrix.rust }}
|
||||
- name: Install cargo-hack
|
||||
uses: taiki-e/install-action@cargo-hack
|
||||
- run: cargo build --all --all-features --all-targets
|
||||
- run: cargo test
|
||||
- run: cargo hack build --feature-powerset --no-dev-deps
|
||||
- name: Clone async-io
|
||||
run: git clone https://github.com/smol-rs/async-io.git
|
||||
- name: Add patch section
|
||||
run: echo '[patch.crates-io]' >> async-io/Cargo.toml
|
||||
- name: Patch polling
|
||||
run: echo 'polling = { path = ".." }' >> async-io/Cargo.toml
|
||||
- name: Test async-io
|
||||
run: cargo test --manifest-path=async-io/Cargo.toml
|
||||
|
||||
cross:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install Rust
|
||||
run: rustup update stable
|
||||
- name: Install cross
|
||||
uses: taiki-e/install-action@cross
|
||||
- name: Android
|
||||
if: startsWith(matrix.os, 'ubuntu')
|
||||
run: cross test --target arm-linux-androideabi
|
||||
- name: NetBSD
|
||||
if: startsWith(matrix.os, 'ubuntu')
|
||||
run: cross build --target x86_64-unknown-netbsd
|
||||
- name: FreeBSD
|
||||
if: startsWith(matrix.os, 'ubuntu')
|
||||
run: cross build --target x86_64-unknown-freebsd
|
||||
- name: iOS
|
||||
if: startsWith(matrix.os, 'macos')
|
||||
run: cross build --target aarch64-apple-ios
|
||||
- name: Linux x32
|
||||
if: startsWith(matrix.os, 'ubuntu')
|
||||
run: cross check --target x86_64-unknown-linux-gnux32
|
||||
- name: Add fuchsia target
|
||||
if: startsWith(matrix.os, 'ubuntu')
|
||||
run: rustup target add x86_64-fuchsia
|
||||
- name: Fuchsia
|
||||
if: startsWith(matrix.os, 'ubuntu')
|
||||
run: cross build --target x86_64-fuchsia
|
||||
# - name: illumos
|
||||
# if: startsWith(matrix.os, 'ubuntu')
|
||||
# run: cross build --target x86_64-unknown-illumos
|
||||
|
||||
msrv:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
# When updating this, the reminder to update the minimum supported
|
||||
# Rust version in Cargo.toml and .clippy.toml.
|
||||
rust: ['1.31']
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install Rust
|
||||
run: rustup update ${{ matrix.rust }} && rustup default ${{ matrix.rust }}
|
||||
- run: cargo build
|
||||
|
||||
clippy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install Rust
|
||||
run: rustup update stable
|
||||
- run: cargo clippy --all-features
|
||||
|
||||
fmt:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install Rust
|
||||
run: rustup update stable
|
||||
- run: cargo fmt --all -- --check
|
||||
|
||||
security_audit:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions-rs/audit-check@v1
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
@ -1,59 +0,0 @@
|
|||
name: Cross compile
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
cross:
|
||||
name: Cross compile
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
|
||||
- name: Install nightly
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: nightly
|
||||
override: true
|
||||
|
||||
- name: Install cross
|
||||
run: cargo install cross
|
||||
|
||||
- name: Android
|
||||
if: startsWith(matrix.os, 'ubuntu')
|
||||
run: cross test --target arm-linux-androideabi
|
||||
|
||||
- name: NetBSD
|
||||
if: startsWith(matrix.os, 'ubuntu')
|
||||
run: cross build --target x86_64-unknown-netbsd
|
||||
|
||||
- name: FreeBSD
|
||||
if: startsWith(matrix.os, 'ubuntu')
|
||||
run: cross build --target x86_64-unknown-freebsd
|
||||
|
||||
- name: iOS
|
||||
if: startsWith(matrix.os, 'macos')
|
||||
run: cross build --target aarch64-apple-ios
|
||||
|
||||
- name: Linux x32
|
||||
if: startsWith(matrix.os, 'ubuntu')
|
||||
run: cross check --target x86_64-unknown-linux-gnux32
|
||||
|
||||
- name: Add fuchsia target
|
||||
if: startsWith(matrix.os, 'ubuntu')
|
||||
run: rustup target add x86_64-fuchsia
|
||||
|
||||
- name: Fuchsia
|
||||
if: startsWith(matrix.os, 'ubuntu')
|
||||
run: cross build --target x86_64-fuchsia
|
||||
|
||||
# - name: illumos
|
||||
# if: startsWith(matrix.os, 'ubuntu')
|
||||
# run: cross build --target x86_64-unknown-illumos
|
|
@ -1,24 +0,0 @@
|
|||
name: Lint
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
clippy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
profile: minimal
|
||||
components: clippy
|
||||
|
||||
- uses: actions-rs/clippy-check@v1
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
args: --all-features -- -W clippy::all
|
|
@ -1,17 +0,0 @@
|
|||
name: Security audit
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
security_audit:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- uses: actions-rs/audit-check@v1
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
@ -6,6 +6,7 @@ name = "polling"
|
|||
version = "2.2.0"
|
||||
authors = ["Stjepan Glavina <stjepang@gmail.com>"]
|
||||
edition = "2018"
|
||||
rust-version = "1.31"
|
||||
description = "Portable interface to epoll, kqueue, event ports, and wepoll"
|
||||
license = "Apache-2.0 OR MIT"
|
||||
repository = "https://github.com/smol-rs/polling"
|
||||
|
@ -13,6 +14,7 @@ homepage = "https://github.com/smol-rs/polling"
|
|||
documentation = "https://docs.rs/polling"
|
||||
keywords = ["mio", "epoll", "kqueue", "iocp", "wepoll"]
|
||||
categories = ["asynchronous", "network-programming", "os"]
|
||||
exclude = ["/.*"]
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
|
|
10
src/lib.rs
10
src/lib.rs
|
@ -76,13 +76,13 @@ macro_rules! syscall {
|
|||
cfg_if! {
|
||||
if #[cfg(any(target_os = "linux", target_os = "android"))] {
|
||||
mod epoll;
|
||||
use epoll as sys;
|
||||
use self::epoll as sys;
|
||||
} else if #[cfg(any(
|
||||
target_os = "illumos",
|
||||
target_os = "solaris",
|
||||
))] {
|
||||
mod port;
|
||||
use port as sys;
|
||||
use self::port as sys;
|
||||
} else if #[cfg(any(
|
||||
target_os = "macos",
|
||||
target_os = "ios",
|
||||
|
@ -92,17 +92,17 @@ cfg_if! {
|
|||
target_os = "dragonfly",
|
||||
))] {
|
||||
mod kqueue;
|
||||
use kqueue as sys;
|
||||
use self::kqueue as sys;
|
||||
} else if #[cfg(any(
|
||||
target_os = "vxworks",
|
||||
target_os = "fuchsia",
|
||||
unix,
|
||||
))] {
|
||||
mod poll;
|
||||
use poll as sys;
|
||||
use self::poll as sys;
|
||||
} else if #[cfg(target_os = "windows")] {
|
||||
mod wepoll;
|
||||
use wepoll as sys;
|
||||
use self::wepoll as sys;
|
||||
} else {
|
||||
compile_error!("polling does not support this target OS");
|
||||
}
|
||||
|
|
|
@ -149,7 +149,9 @@ impl Poller {
|
|||
}
|
||||
we::epoll_event {
|
||||
events: flags as u32,
|
||||
data: we::epoll_data { u64_: ev.key as u64 },
|
||||
data: we::epoll_data {
|
||||
u64_: ev.key as u64,
|
||||
},
|
||||
}
|
||||
});
|
||||
wepoll!(epoll_ctl(
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
use std::time::Duration;
|
||||
use std::io::{self, Write};
|
||||
use std::net::{TcpListener, TcpStream};
|
||||
use std::thread;
|
||||
use std::io::{self, Write};
|
||||
use std::time::Duration;
|
||||
|
||||
use easy_parallel::Parallel;
|
||||
use polling::{Poller, Event};
|
||||
use polling::{Event, Poller};
|
||||
|
||||
#[test]
|
||||
fn concurrent_add() -> io::Result<()> {
|
||||
|
|
Loading…
Reference in New Issue