diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1e59d5a..63056ab 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,7 +7,7 @@ on: pull_request: push: branches: - - master + - taiki-e/nosigpipe schedule: - cron: '0 2 * * 0' @@ -26,132 +26,150 @@ defaults: shell: bash 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@v4 - - 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 }} - - run: cargo build --all --all-features --all-targets - - name: Run cargo check (without dev-dependencies to catch missing feature flags) - if: startsWith(matrix.rust, 'nightly') - run: cargo check -Z features=dev_dep - - name: Add rust-src - if: startsWith(matrix.rust, 'nightly') - run: rustup component add rust-src -# https://github.com/smol-rs/async-io/pull/144#issuecomment-1666927490 -# - name: Check selected Tier 3 targets -# if: startsWith(matrix.rust, 'nightly') && matrix.os == 'ubuntu-latest' -# run: cargo check -Z build-std --target=riscv32imc-esp-espidf - - run: cargo test +# 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@v4 +# - 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 }} +# - run: cargo build --all --all-features --all-targets +# - name: Run cargo check (without dev-dependencies to catch missing feature flags) +# if: startsWith(matrix.rust, 'nightly') +# run: cargo check -Z features=dev_dep +# - name: Add rust-src +# if: startsWith(matrix.rust, 'nightly') +# run: rustup component add rust-src +# # https://github.com/smol-rs/async-io/pull/144#issuecomment-1666927490 +# # - name: Check selected Tier 3 targets +# # if: startsWith(matrix.rust, 'nightly') && matrix.os == 'ubuntu-latest' +# # run: cargo check -Z build-std --target=riscv32imc-esp-espidf +# - run: cargo test - # Copied from: https://github.com/rust-lang/stacker/pull/19/files - windows_gnu: - runs-on: windows-latest - strategy: - matrix: - rust: [nightly] - target: - - x86_64-pc-windows-gnu - steps: - - uses: actions/checkout@v4 - - 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 }} - - run: rustup target add ${{ matrix.target }} - # https://github.com/rust-lang/rust/issues/49078 - - name: Fix windows-gnu rust-mingw - run : | - for i in crt2.o dllcrt2.o libmingwex.a libmsvcrt.a ; do - cp -f "/C/ProgramData/Chocolatey/lib/mingw/tools/install/mingw64/x86_64-w64-mingw32/lib/$i" "`rustc --print sysroot`/lib/rustlib/x86_64-pc-windows-gnu/lib" - done - - run: cargo build --target ${{ matrix.target }} --all --all-features --all-targets - - run: cargo test --target ${{ matrix.target }} +# # Copied from: https://github.com/rust-lang/stacker/pull/19/files +# windows_gnu: +# runs-on: windows-latest +# strategy: +# matrix: +# rust: [nightly] +# target: +# - x86_64-pc-windows-gnu +# steps: +# - uses: actions/checkout@v4 +# - 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 }} +# - run: rustup target add ${{ matrix.target }} +# # https://github.com/rust-lang/rust/issues/49078 +# - name: Fix windows-gnu rust-mingw +# run : | +# for i in crt2.o dllcrt2.o libmingwex.a libmsvcrt.a ; do +# cp -f "/C/ProgramData/Chocolatey/lib/mingw/tools/install/mingw64/x86_64-w64-mingw32/lib/$i" "`rustc --print sysroot`/lib/rustlib/x86_64-pc-windows-gnu/lib" +# done +# - run: cargo build --target ${{ matrix.target }} --all --all-features --all-targets +# - run: cargo test --target ${{ matrix.target }} - cross: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, macos-latest] - steps: - - uses: actions/checkout@v4 - - name: Install Rust - run: rustup update stable - - name: Install cross - uses: taiki-e/install-action@cross - # We don't test BSDs, since we already test them in Cirrus. - - name: Android - if: startsWith(matrix.os, 'ubuntu') - run: cross test --target arm-linux-androideabi - - name: iOS - if: startsWith(matrix.os, 'macos') - run: | - rustup target add aarch64-apple-ios - cross build --target aarch64-apple-ios - - name: Linux x32 - if: startsWith(matrix.os, 'ubuntu') - run: | - rustup target add x86_64-unknown-linux-gnux32 - cross check --target x86_64-unknown-linux-gnux32 - - name: Fuchsia - if: startsWith(matrix.os, 'ubuntu') - run: | - rustup target add x86_64-unknown-fuchsia - cargo build --target x86_64-unknown-fuchsia - - name: illumos - if: startsWith(matrix.os, 'ubuntu') - run: | - rustup target add x86_64-unknown-illumos - cargo build --target x86_64-unknown-illumos +# cross: +# runs-on: ${{ matrix.os }} +# strategy: +# fail-fast: false +# matrix: +# os: [ubuntu-latest, macos-latest] +# steps: +# - uses: actions/checkout@v4 +# - name: Install Rust +# run: rustup update stable +# - name: Install cross +# uses: taiki-e/install-action@cross +# # We don't test BSDs, since we already test them in Cirrus. +# - name: Android +# if: startsWith(matrix.os, 'ubuntu') +# run: cross test --target arm-linux-androideabi +# - name: iOS +# if: startsWith(matrix.os, 'macos') +# run: | +# rustup target add aarch64-apple-ios +# cross build --target aarch64-apple-ios +# - name: Linux x32 +# if: startsWith(matrix.os, 'ubuntu') +# run: | +# rustup target add x86_64-unknown-linux-gnux32 +# cross check --target x86_64-unknown-linux-gnux32 +# - name: Fuchsia +# if: startsWith(matrix.os, 'ubuntu') +# run: | +# rustup target add x86_64-unknown-fuchsia +# cargo build --target x86_64-unknown-fuchsia +# - name: illumos +# if: startsWith(matrix.os, 'ubuntu') +# run: | +# rustup target add x86_64-unknown-illumos +# cargo build --target x86_64-unknown-illumos - msrv: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, windows-latest] - # When updating this, the reminder to update the minimum supported - # Rust version in Cargo.toml. - rust: ['1.63'] - steps: - - uses: actions/checkout@v4 - - 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 }} - - run: cargo build +# msrv: +# runs-on: ${{ matrix.os }} +# strategy: +# fail-fast: false +# matrix: +# os: [ubuntu-latest, windows-latest] +# # When updating this, the reminder to update the minimum supported +# # Rust version in Cargo.toml. +# rust: ['1.63'] +# steps: +# - uses: actions/checkout@v4 +# - 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 }} +# - run: cargo build - clippy: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Install Rust - run: rustup update stable - - run: cargo clippy --all-features --all-targets +# clippy: +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v4 +# - name: Install Rust +# run: rustup update stable +# - run: cargo clippy --all-features --all-targets - fmt: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Install Rust - run: rustup update stable - - run: cargo fmt --all --check +# fmt: +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v4 +# - name: Install Rust +# run: rustup update stable +# - run: cargo fmt --all --check + +# security_audit: +# permissions: +# checks: write +# contents: read +# issues: write +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v4 +# # https://github.com/rustsec/audit-check/issues/2 +# - uses: rustsec/audit-check@master +# with: +# token: ${{ secrets.GITHUB_TOKEN }} - security_audit: - permissions: - checks: write - contents: read - issues: write - runs-on: ubuntu-latest + dragonfly: + runs-on: macos-12 steps: - - uses: actions/checkout@v4 - # https://github.com/rustsec/audit-check/issues/2 - - uses: rustsec/audit-check@master - with: - token: ${{ secrets.GITHUB_TOKEN }} + - uses: actions/checkout@v3 + - name: Test Dragonfly BSD + id: test + uses: vmactions/dragonflybsd-vm@v0 + with: + envs: CARGO_INCREMENTAL CARGO_NET_GIT_FETCH_WITH_CLI CARGO_NET_RETRY RUST_BACKTRACE RUSTFLAGS RUSTDOCFLAGS RUSTUP_MAX_RETRIES + usesh: true + # Dragonfly BSD is tier 3 target, so install rust from package manager instead of rustup + prepare: | + pkg update -y + pkg upgrade -y + pkg install -y git rust + run: | + cargo test diff --git a/Cargo.toml b/Cargo.toml index 4c58a1e..533317f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,7 +30,7 @@ futures-io = { version = "0.3.28", default-features = false, features = ["std"] futures-lite = { version = "1.11.0", default-features = false } parking = "2.0.0" polling = "3.0.0" -rustix = { version = "0.38.2", default-features = false, features = ["fs", "net", "std"] } +rustix = { git = "https://github.com/taiki-e/rustix", branch = "nosigpipe", default-features = false, features = ["fs", "net", "std"] } slab = "0.4.2" tracing = { version = "0.1.37", default-features = false } waker-fn = "1.1.0" diff --git a/src/lib.rs b/src/lib.rs index da56eef..7473bf3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2139,7 +2139,9 @@ fn connect( target_os = "ios", target_os = "tvos", target_os = "watchos", - target_os = "freebsd" + target_os = "freebsd", + target_os = "netbsd", + target_os = "dragonfly", ))] rn::sockopt::set_socket_nosigpipe(&socket, true)?;