diff --git a/.github/workflows/cd_deploy_docs.yml b/.github/workflows/cd_deploy_docs.yml deleted file mode 100644 index cdb10a39..00000000 --- a/.github/workflows/cd_deploy_docs.yml +++ /dev/null @@ -1,97 +0,0 @@ -name: Deploy Documentation - -on: - push: - branches: - - ci/deploy-docs - - master - workflow_dispatch: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -env: - RUST_BACKTRACE: 1 - -jobs: - build-docs: - strategy: - matrix: - include: - - os: ubuntu-latest - target: x86_64-unknown-linux-gnu - artifact-name: docs-linux - - os: windows-latest - target: x86_64-pc-windows-msvc - artifact-name: docs-windows - - os: macos-latest - target: aarch64-apple-darwin - artifact-name: docs-darwin - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v4 - - - name: Setup Rust Toolchain - run: | - rustup toolchain install nightly - rustup default nightly - rustup target add ${{ matrix.target }} - - - name: Build Documentation for ${{ matrix.target }} - shell: bash - run: | - GIT_SHA=$(git rev-parse --short HEAD) - export RUSTDOCFLAGS="-Zunstable-options --enable-index-page --cfg docsrs --crate-version $GIT_SHA" - cargo doc --workspace --no-deps --all-features --target ${{ matrix.target }} - - - name: Prepare documentation artifact - shell: bash - run: | - mkdir -p docs-output/${{ matrix.target }} - cp -r target/${{ matrix.target }}/doc/* docs-output/${{ matrix.target }}/ - - - name: Upload documentation artifact - uses: actions/upload-artifact@v4 - with: - name: ${{ matrix.artifact-name }} - path: docs-output/${{ matrix.target }} - retention-days: 1 - - deploy: - needs: build-docs - runs-on: ubuntu-latest - permissions: - contents: read - deployments: write - steps: - - uses: actions/checkout@v4 - - - name: Download Linux docs - uses: actions/download-artifact@v4 - with: - name: docs-linux - path: public/x86_64-unknown-linux-gnu - - - name: Download Windows docs - uses: actions/download-artifact@v4 - with: - name: docs-windows - path: public/x86_64-pc-windows-msvc - - - name: Download Darwin docs - uses: actions/download-artifact@v4 - with: - name: docs-darwin - path: public/aarch64-apple-darwin - - - name: Copy index page - run: | - cp docs/index.html public/index.html - - - name: Deploy to Cloudflare Pages - uses: cloudflare/wrangler-action@v3 - with: - apiToken: ${{ secrets.CF_API_TOKEN }} - accountId: ${{ secrets.CF_ACCOUNT_ID }} - command: deploy --assets public --name compio-docs --compatibility-date 2026-01-23 diff --git a/.github/workflows/cd_release.yml b/.github/workflows/cd_release.yml deleted file mode 100644 index 3c1029a4..00000000 --- a/.github/workflows/cd_release.yml +++ /dev/null @@ -1,56 +0,0 @@ -name: Release-plz - -on: - push: - branches: - - master - -jobs: - - # Release unpublished packages. - release-plz-release: - name: Release-plz release - runs-on: ubuntu-latest - # Buggy currently - if: false - permissions: - contents: write - steps: - - &checkout - name: Checkout repository - uses: actions/checkout@v6 - with: - fetch-depth: 0 - persist-credentials: false - - &install-rust - name: Install Rust toolchain - uses: dtolnay/rust-toolchain@nightly - - name: Run release-plz - uses: release-plz/action@v0.5 - with: - command: release - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} - - # Create a PR with the new versions and changelog, preparing the next release. - release-plz-pr: - name: Release-plz PR - runs-on: ubuntu-latest - if: ${{ github.repository_owner == 'compio-rs' }} - permissions: - contents: write - pull-requests: write - concurrency: - group: release-plz-${{ github.ref }} - cancel-in-progress: false - steps: - - *checkout - - *install-rust - - name: Run release-plz - uses: release-plz/action@v0.5 - with: - command: release-pr - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} diff --git a/.github/workflows/ci_check.yml b/.github/workflows/ci_check.yml deleted file mode 100644 index 91aa66bc..00000000 --- a/.github/workflows/ci_check.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: Check - -on: - push: - branches: - - master - paths: - - '**/Cargo.toml' - - '**/*.rs' - - '.github/workflows/ci_check.yml' - pull_request: - branches: - - master - paths: - - '**/Cargo.toml' - - '**/*.rs' - - '.github/workflows/ci_check.yml' - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} - cancel-in-progress: true - -env: - RUST_BACKTRACE: 1 - -jobs: - check: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-22.04, windows-latest, macos-latest] - steps: - - uses: actions/checkout@v4 - - name: Setup Rust Toolchain - run: | - rustup default nightly - rustup component add clippy - - name: Check clippy - shell: bash - run: | - cargo clippy --all-features --all-targets -- -Dwarnings - - name: Check Docs - run: | - cargo doc --workspace --all-features --no-deps - - check_stub: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4 - - name: Setup Rust Toolchain - run: | - rustup default nightly - - name: Check - shell: bash - # We only make sure that the stub driver compiles. - run: | - cargo check --features all,nightly,ring,sync --no-default-features --all-targets diff --git a/.github/workflows/ci_check_minimal.yml b/.github/workflows/ci_check_minimal.yml deleted file mode 100644 index e65a4a1d..00000000 --- a/.github/workflows/ci_check_minimal.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: Check (Minimal Versions) - -on: - push: - branches: - - master - paths: - - '**/Cargo.toml' - - '**/*.rs' - - '.github/workflows/ci_check_minimal.yml' - pull_request: - branches: - - master - paths: - - '**/Cargo.toml' - - '**/*.rs' - - '.github/workflows/ci_check_minimal.yml' - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} - cancel-in-progress: true - -env: - RUST_BACKTRACE: 1 - -jobs: - check: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-22.04, windows-latest, macos-latest] - steps: - - uses: actions/checkout@v4 - - name: Setup Rust Toolchain - run: | - rustup default nightly - rustup component add clippy - - uses: taiki-e/install-action@cargo-no-dev-deps - - name: Check clippy - shell: bash - run: | - cargo no-dev-deps -Zminimal-versions clippy --all-features --lib - - name: Check Docs - run: | - cargo no-dev-deps -Zminimal-versions doc --workspace --all-features --no-deps diff --git a/.github/workflows/ci_commitlint.yml b/.github/workflows/ci_commitlint.yml deleted file mode 100644 index ee6fd58e..00000000 --- a/.github/workflows/ci_commitlint.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: Lint Commit Messages -on: - - pull_request - - push - -permissions: - contents: read - pull-requests: read - -jobs: - commitlint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: wagoid/commitlint-github-action@v6 diff --git a/.github/workflows/ci_format.yml b/.github/workflows/ci_format.yml deleted file mode 100644 index 1449b87d..00000000 --- a/.github/workflows/ci_format.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: Check Code Format - -on: - push: - branches: - - master - paths: - - 'rustfmt.toml' - - '**/Cargo.toml' - - '**/*.rs' - - '.github/workflows/ci_format.yml' - pull_request: - branches: - - master - paths: - - 'rustfmt.toml' - - '**/*.rs' - - '.github/workflows/ci_format.yml' - -env: - RUST_BACKTRACE: 1 - -jobs: - check: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4 - - name: Setup Rust Toolchain - run: | - rustup default nightly - rustup component add rustfmt - - name: Check Format - run: cargo fmt --all -- --check diff --git a/.github/workflows/ci_test.yml b/.github/workflows/ci_test.yml deleted file mode 100644 index edcb1781..00000000 --- a/.github/workflows/ci_test.yml +++ /dev/null @@ -1,97 +0,0 @@ -name: Test - -on: - push: - branches: - - master - paths: - - '**/*.rs' - - '**/Cargo.toml' - - '.github/workflows/ci_test.yml' - pull_request: - branches: - - master - paths: - - '**/*.rs' - - '**/Cargo.toml' - - '.github/workflows/ci_test.yml' - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} - cancel-in-progress: true - -env: - RUST_BACKTRACE: 1 - -jobs: - test: - runs-on: ${{ matrix.setup.os }} - strategy: - matrix: - toolchain: ['nightly', 'beta', 'stable'] - setup: - - os: 'ubuntu-22.04' - - os: 'ubuntu-22.04' - features: 'sync' - - os: 'ubuntu-22.04' - features: 'polling' # fusion - - os: 'ubuntu-22.04' - features: 'io-uring-sqe128,io-uring-cqe32' - - os: 'ubuntu-22.04' - features: 'polling,ring' - no_default_features: true - - os: 'ubuntu-22.04' - features: 'polling,native-tls,ring' - no_default_features: true - - os: 'ubuntu-22.04' - features: 'codec-serde-json' - - os: 'windows-latest' - target: 'x86_64-pc-windows-msvc' - - os: 'windows-latest' - target: 'x86_64-pc-windows-gnu' - - os: 'windows-latest' - target: 'i686-pc-windows-msvc' - - os: 'windows-latest' - target: 'x86_64-pc-windows-msvc' - features: 'iocp-global' - - os: 'windows-latest' - target: 'x86_64-pc-windows-msvc' - features: 'iocp-wait-packet' - - os: 'macos-14' - - os: 'macos-15' - steps: - - uses: actions/checkout@v4 - - name: Setup Rust Toolchain - run: rustup toolchain install ${{ matrix.toolchain }} - - name: Setup target - if: ${{ matrix.setup.target }} - run: rustup +${{ matrix.toolchain }} target install ${{ matrix.setup.target }} - - name: Test on ${{ matrix.setup.os }} ${{ matrix.toolchain }} ${{ matrix.setup.target }} - shell: bash - run: | - set -ex - - ARGS=("--features" "all") - - # Add feature "nightly" if toolchain is nightly - if [[ "${{ matrix.toolchain }}" == "nightly" ]]; then - ARGS+=("--features" "nightly") - fi - # Add features if features is not empty - if [[ -n "${{ matrix.setup.features }}" ]]; then - ARGS+=("--features" "${{ matrix.setup.features }}") - fi - # Add no-default-features if no_default_features is true - if [[ -n "${{ matrix.setup.no_default_features }}" ]]; then - ARGS+=("--no-default-features") - fi - # Specify target if target is not empty - if [[ -n "${{ matrix.setup.target }}" ]]; then - ARGS+=("--target" "${{ matrix.setup.target }}") - fi - # Add doctest-xcompile if on windows and nightly - if [[ "${{ matrix.setup.os }}" == "windows-latest" && ${{ matrix.toolchain }} == "nightly" ]]; then - ARGS+=("-Z" "doctest-xcompile") - fi - - cargo +${{ matrix.toolchain }} test --workspace "${ARGS[@]}" diff --git a/.github/workflows/ci_test_illumos.yml b/.github/workflows/ci_test_illumos.yml index 033ff94e..17a0b27a 100644 --- a/.github/workflows/ci_test_illumos.yml +++ b/.github/workflows/ci_test_illumos.yml @@ -25,7 +25,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - toolchain: ['nightly', 'beta', 'stable'] + toolchain: ['nightly'] steps: - uses: actions/checkout@v4 - name: Test in Illumos @@ -51,4 +51,4 @@ jobs: ARGS="$ARGS --features nightly" fi - RUST_BACKTRACE=1 cargo +${{ matrix.toolchain }} test --workspace $ARGS + RUST_BACKTRACE=1 cargo +${{ matrix.toolchain }} test --workspace $ARGS -- --no-capture diff --git a/.github/workflows/ci_test_musl.yml b/.github/workflows/ci_test_musl.yml deleted file mode 100644 index b7141166..00000000 --- a/.github/workflows/ci_test_musl.yml +++ /dev/null @@ -1,56 +0,0 @@ -name: TestMusl - -on: - push: - branches: - - master - paths: - - '**/*.rs' - - '**/Cargo.toml' - - '.github/workflows/ci_test_musl.yml' - pull_request: - branches: - - master - paths: - - '**/*.rs' - - '**/Cargo.toml' - - '.github/workflows/ci_test_musl.yml' - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} - cancel-in-progress: true - -env: - RUST_BACKTRACE: 1 - -jobs: - test: - runs-on: ubuntu-latest - strategy: - matrix: - setup: - - target: 'x86_64-unknown-linux-musl' - features: 'native-tls-vendored,ring,sync,polling' - - target: 'aarch64-unknown-linux-musl' - features: 'native-tls-vendored,ring,sync,polling' - steps: - - uses: actions/checkout@v4 - - name: Setup cross-rs - uses: taiki-e/install-action@cross - - name: Test for ${{ matrix.setup.target }} - shell: bash - run: | - set -ex - - ARGS=("--features" "all") - - # Add features if features is not empty - if [[ -n "${{ matrix.setup.features }}" ]]; then - ARGS+=("--features" "${{ matrix.setup.features }}") - fi - # Specify target if target is not empty - if [[ -n "${{ matrix.setup.target }}" ]]; then - ARGS+=("--target" "${{ matrix.setup.target }}") - fi - - cross test --workspace "${ARGS[@]}" diff --git a/compio-driver/Cargo.toml b/compio-driver/Cargo.toml index a36133b1..d24b3c3e 100644 --- a/compio-driver/Cargo.toml +++ b/compio-driver/Cargo.toml @@ -57,6 +57,7 @@ slab = { workspace = true, optional = true } [dev-dependencies] nix = { workspace = true, features = ["fs"] } +tracing-subscriber = { workspace = true } # Other platform dependencies [target.'cfg(all(not(target_os = "linux"), unix))'.dependencies] diff --git a/compio-driver/src/sys/poll/mod.rs b/compio-driver/src/sys/poll/mod.rs index 6788afe8..7a42f6ad 100644 --- a/compio-driver/src/sys/poll/mod.rs +++ b/compio-driver/src/sys/poll/mod.rs @@ -13,7 +13,7 @@ use std::{ time::Duration, }; -use compio_log::{instrument, trace}; +use compio_log::{instrument, trace, warn}; use flume::{Receiver, Sender}; use polling::{Event, Events, Poller}; use smallvec::SmallVec; @@ -598,6 +598,7 @@ impl Driver { pub fn poll(&mut self, timeout: Option) -> io::Result<()> { instrument!(compio_log::Level::TRACE, "poll", ?timeout); if self.poll_completed() { + warn!("completed blocking entry"); return Ok(()); } self.events.clear(); @@ -605,6 +606,7 @@ impl Driver { if self.events.is_empty() && timeout.is_some() { return Err(io::Error::from_raw_os_error(libc::ETIMEDOUT)); } + warn!("{} events received: {:?}", self.events.len(), self.events); self.with_events(|this, events| { for event in events.iter() { trace!("receive {} for {:?}", event.key, event); diff --git a/compio-driver/tests/file.rs b/compio-driver/tests/file.rs index 388361dc..f0d9de38 100644 --- a/compio-driver/tests/file.rs +++ b/compio-driver/tests/file.rs @@ -96,10 +96,17 @@ fn push_and_wait(driver: &mut Proactor, op: O) -> BufResult #[test] fn timeout() { + tracing_subscriber::fmt() + .with_max_level(compio_log::Level::TRACE) + .init(); + let mut driver = Proactor::new().unwrap(); let err = driver.poll(Some(Duration::from_secs(1))).unwrap_err(); assert_eq!(err.kind(), io::ErrorKind::TimedOut); + + let err = driver.poll(Some(Duration::from_millis(1))).unwrap_err(); + assert_eq!(err.kind(), io::ErrorKind::TimedOut); } #[test] diff --git a/compio-tls/tests/connect.rs b/compio-tls/tests/connect.rs deleted file mode 100644 index 58a21d13..00000000 --- a/compio-tls/tests/connect.rs +++ /dev/null @@ -1,41 +0,0 @@ -use compio_io::{AsyncReadExt, AsyncWrite, AsyncWriteExt}; -use compio_net::TcpStream; -use compio_tls::TlsConnector; - -async fn connect(connector: TlsConnector) { - let stream = TcpStream::connect("www.example.com:443").await.unwrap(); - let mut stream = connector.connect("www.example.com", stream).await.unwrap(); - - stream - .write_all("GET / HTTP/1.1\r\nHost:www.example.com\r\nConnection: close\r\n\r\n") - .await - .unwrap(); - stream.flush().await.unwrap(); - let (_, res) = stream.read_to_end(vec![]).await.unwrap(); - println!("{}", String::from_utf8_lossy(&res)); -} - -#[cfg(feature = "native-tls")] -#[compio_macros::test] -async fn native() { - let connector = TlsConnector::from(native_tls::TlsConnector::new().unwrap()); - - connect(connector).await; -} - -#[cfg(feature = "rustls")] -#[compio_macros::test] -async fn rtls() { - let mut store = rustls::RootCertStore::empty(); - for cert in rustls_native_certs::load_native_certs().unwrap() { - store.add(cert).unwrap(); - } - - let connector = TlsConnector::from(std::sync::Arc::new( - rustls::ClientConfig::builder() - .with_root_certificates(store) - .with_no_client_auth(), - )); - - connect(connector).await; -}