mirror of https://github.com/smol-rs/polling
219 lines
6.7 KiB
YAML
219 lines
6.7 KiB
YAML
name: CI
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches:
|
|
- master
|
|
schedule:
|
|
- cron: '0 2 * * 0'
|
|
|
|
env:
|
|
CARGO_INCREMENTAL: 0
|
|
CARGO_NET_GIT_FETCH_WITH_CLI: true
|
|
CARGO_NET_RETRY: 10
|
|
CARGO_TERM_COLOR: always
|
|
RUST_BACKTRACE: 1
|
|
RUSTFLAGS: -D warnings
|
|
RUSTDOCFLAGS: -D warnings
|
|
RUSTUP_MAX_RETRIES: 10
|
|
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
rust: [nightly, beta, stable]
|
|
include:
|
|
- os: windows-latest
|
|
rust: nightly-x86_64-pc-windows-gnu
|
|
- os: windows-latest
|
|
rust: nightly-i686-pc-windows-msvc
|
|
- os: windows-latest
|
|
rust: nightly-i686-pc-windows-gnu
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- 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 test
|
|
env:
|
|
# Note: This cfg is intended to make it easy for polling developers to test
|
|
# the backend that uses poll, and is not a public API.
|
|
RUSTFLAGS: ${{ env.RUSTFLAGS }} --cfg polling_test_poll_backend
|
|
if: startsWith(matrix.os, 'ubuntu')
|
|
- 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@v3
|
|
- name: Install Rust
|
|
run: rustup update stable
|
|
- name: Install cross
|
|
uses: taiki-e/install-action@v2
|
|
with:
|
|
# https://github.com/cross-rs/cross/issues/724
|
|
tool: cross@0.2.1
|
|
- name: Android
|
|
if: startsWith(matrix.os, 'ubuntu')
|
|
run: cross test --target arm-linux-androideabi
|
|
- 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: Fuchsia
|
|
if: startsWith(matrix.os, 'ubuntu')
|
|
run: |
|
|
rustup target add x86_64-fuchsia
|
|
cargo build --target x86_64-fuchsia
|
|
- name: illumos
|
|
if: startsWith(matrix.os, 'ubuntu')
|
|
run: |
|
|
rustup target add x86_64-unknown-illumos
|
|
cargo build --target x86_64-unknown-illumos
|
|
|
|
netbsd:
|
|
runs-on: macos-12
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Test NetBSD
|
|
id: test
|
|
uses: vmactions/netbsd-vm@v0
|
|
with:
|
|
envs: CARGO_INCREMENTAL CARGO_NET_GIT_FETCH_WITH_CLI CARGO_NET_RETRY RUST_BACKTRACE RUSTFLAGS RUSTDOCFLAGS RUSTUP_MAX_RETRIES
|
|
usesh: true
|
|
prepare: |
|
|
pkg_add curl git
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain stable
|
|
run: |
|
|
. $HOME/.cargo/env
|
|
cargo test
|
|
|
|
openbsd:
|
|
runs-on: macos-12
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Test OpenBSD
|
|
id: test
|
|
uses: vmactions/openbsd-vm@v0
|
|
with:
|
|
envs: CARGO_INCREMENTAL CARGO_NET_GIT_FETCH_WITH_CLI CARGO_NET_RETRY RUST_BACKTRACE RUSTFLAGS RUSTDOCFLAGS RUSTUP_MAX_RETRIES
|
|
usesh: true
|
|
# OpenBSD is tier 3 target, so install rust from package manager instead of rustup
|
|
prepare: |
|
|
pkg_add git rust
|
|
run: |
|
|
cargo test
|
|
|
|
dragonfly:
|
|
runs-on: macos-12
|
|
steps:
|
|
- 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 rust
|
|
run: |
|
|
cargo test
|
|
|
|
wine:
|
|
runs-on: ubuntu-22.04
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Install Rust
|
|
run: rustup update stable
|
|
- uses: taiki-e/setup-cross-toolchain-action@v1
|
|
with:
|
|
target: x86_64-pc-windows-gnu
|
|
runner: wine@7.13
|
|
- run: cargo test --target x86_64-pc-windows-gnu
|
|
- 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
|
|
|
|
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.47']
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- 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
|
|
- name: Install Other Targets
|
|
if: startsWith(matrix.os, 'ubuntu')
|
|
run: rustup target add x86_64-unknown-freebsd x86_64-unknown-netbsd
|
|
- run: cargo build --target x86_64-unknown-freebsd
|
|
if: startsWith(matrix.os, 'ubuntu')
|
|
- run: cargo build --target x86_64-unknown-netbsd
|
|
if: startsWith(matrix.os, 'ubuntu')
|
|
|
|
clippy:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Install Rust
|
|
run: rustup update stable
|
|
- run: cargo clippy --all-features --all-targets
|
|
|
|
fmt:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Install Rust
|
|
run: rustup update stable
|
|
- run: cargo fmt --all --check
|
|
|
|
security_audit:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
# https://github.com/rustsec/audit-check/issues/2
|
|
- uses: rustsec/audit-check@master
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|