Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Oct 8, 2023
1 parent 62e3454 commit 0b677c4
Show file tree
Hide file tree
Showing 6 changed files with 189 additions and 168 deletions.
64 changes: 32 additions & 32 deletions .cirrus.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
only_if: $CIRRUS_TAG == '' && ($CIRRUS_PR != '' || $CIRRUS_BRANCH == 'master')
only_if: $CIRRUS_TAG == '' && ($CIRRUS_PR != '' || $CIRRUS_BRANCH == 'taiki-e/nosigpipe')
auto_cancellation: $CIRRUS_BRANCH != 'master'
env:
CARGO_INCREMENTAL: '0'
Expand All @@ -11,23 +11,23 @@ env:
RUSTFLAGS: -D warnings
RUSTUP_MAX_RETRIES: '10'

freebsd_task:
name: test ($TARGET)
freebsd_instance:
image_family: freebsd-12-4
matrix:
- env:
TARGET: x86_64-unknown-freebsd
- env:
TARGET: i686-unknown-freebsd
setup_script:
# https://github.com/cirruslabs/cirrus-ci-docs/issues/483
- sudo sysctl net.inet.tcp.blackhole=0
- pkg install -y git
- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain stable --target $TARGET
test_script:
- . $HOME/.cargo/env
- cargo test --target $TARGET
# freebsd_task:
# name: test ($TARGET)
# freebsd_instance:
# image_family: freebsd-12-4
# matrix:
# - env:
# TARGET: x86_64-unknown-freebsd
# - env:
# TARGET: i686-unknown-freebsd
# setup_script:
# # https://github.com/cirruslabs/cirrus-ci-docs/issues/483
# - sudo sysctl net.inet.tcp.blackhole=0
# - pkg install -y git
# - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain stable --target $TARGET
# test_script:
# - . $HOME/.cargo/env
# - cargo test --target $TARGET

netbsd_task:
name: test ($TARGET)
Expand All @@ -45,17 +45,17 @@ netbsd_task:
- . $HOME/.cargo/env
- cargo test

openbsd_task:
name: test ($TARGET)
compute_engine_instance:
image_project: pg-ci-images
# https://github.com/anarazel/pg-vm-images/blob/main/packer/openbsd.pkrvars.hcl
image: family/pg-ci-openbsd-vanilla-7-2
platform: openbsd
env:
TARGET: x86_64-unknown-openbsd
setup_script:
# OpenBSD is tier 3 target, so install rust from package manager instead of rustup
- pkg_add git rust
test_script:
- cargo test
# openbsd_task:
# name: test ($TARGET)
# compute_engine_instance:
# image_project: pg-ci-images
# # https://github.com/anarazel/pg-vm-images/blob/main/packer/openbsd.pkrvars.hcl
# image: family/pg-ci-openbsd-vanilla-7-2
# platform: openbsd
# env:
# TARGET: x86_64-unknown-openbsd
# setup_script:
# # OpenBSD is tier 3 target, so install rust from package manager instead of rustup
# - pkg_add git rust
# test_script:
# - cargo test
9 changes: 9 additions & 0 deletions .external-types.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# cargo-check-external-types configuration
# https://crates.io/crates/cargo-check-external-types

# The following are types that are allowed to be exposed in our public API.
# The standard library is allowed by default.
allowed_external_types = [
"futures_core::*",
"futures_io::*",
]
262 changes: 139 additions & 123 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
pull_request:
push:
branches:
- master
- taiki-e/nosigpipe
schedule:
- cron: '0 2 * * 0'

Expand All @@ -26,132 +26,148 @@ 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 install -y git rust
run: |
cargo test
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Loading

0 comments on commit 0b677c4

Please sign in to comment.