diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9d75c311..ac784ce3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,3 +1,5 @@ +name: Continuous integration + on: push: branches: @@ -6,29 +8,65 @@ on: branches: - master -name: Continuous integration +env: + RUSTFLAGS: -Dwarnings + RUSTDOCFLAGS: -Dwarnings + RUST_BACKTRACE: short + + CARGO_INCREMENTAL: 0 + CARGO_NET_RETRY: 10 + RUSTUP_MAX_RETRIES: 10 + + rust_nightly: nightly-2022-01-17 + # When updating this, also update: + # - README.md + # - src/lib.rs + # - down below in a matrix + rust_msrv: 1.58.0 jobs: - style: + # Depends on all action that are required for a "successful" CI run. + ci-pass: + name: CI succeeded + runs-on: ubuntu-latest + + needs: + - fmt + - test + - check-examples + - clippy + - doc + + steps: + - run: exit 0 + + fmt: + name: fmt runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - name: Checkout + uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 + - name: Install Rust ${{ env.rust_nightly }} + uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: nightly-2022-01-17 + toolchain: ${{ env.rust_nightly }} override: true components: rustfmt - - name: fmt + - name: Cache Dependencies + uses: Swatinem/rust-cache@v1 + + - name: Check formatting uses: actions-rs/cargo@v1 with: command: fmt - args: --all -- --check + args: --all -- --check test: + name: Test runs-on: ubuntu-latest strategy: matrix: @@ -49,45 +87,102 @@ jobs: toolchain: nightly-2022-01-17 features: "--all-features" - rust: msrv + toolchain: 1.58.0 features: "--features full" - toolchain: "1.58.0" - steps: - - uses: actions/checkout@v1 - - - uses: actions-rs/toolchain@v1 + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Install Rust ${{ matrix.toolchain }} + uses: actions-rs/toolchain@v1 with: profile: minimal toolchain: ${{ matrix.toolchain }} override: true - - - name: build + + - name: Cache Dependencies + uses: Swatinem/rust-cache@v1 + + - name: Compile uses: actions-rs/cargo@v1 with: - command: build - args: --verbose ${{ matrix.features }} + command: test + args: --no-run --verbose ${{ matrix.features }} - - name: test + - name: Test uses: actions-rs/cargo@v1 with: command: test args: --verbose ${{ matrix.features }} - clippy: + check-examples: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - name: Checkout + uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 + - name: Install Rust stable + uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: nightly-2022-01-17 + toolchain: stable + override: true + + - name: Cache Dependencies + uses: Swatinem/rust-cache@v1 + + - name: Check examples + uses: actions-rs/cargo@v1 + with: + command: check + args: --examples --features full + + clippy: + name: Run linter + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Install Rust ${{ env.rust_nightly }} + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: ${{ env.rust_nightly }} override: true components: clippy + - name: Cache Dependencies + uses: Swatinem/rust-cache@v1 + - name: clippy uses: actions-rs/cargo@v1 with: command: clippy - args: --all-targets --all-features -- -D warnings + args: --all-targets --all-features + + doc: + name: check docs + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Install Rust ${{ env.rust_nightly }} + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: ${{ env.rust_nightly }} + override: true + + - name: Cache Dependencies + uses: Swatinem/rust-cache@v1 + + - name: rustdoc + uses: actions-rs/cargo@v1 + with: + command: docs # from .cargo/config.toml diff --git a/Cargo.toml b/Cargo.toml index fcbd0d55..c49e7528 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -51,7 +51,7 @@ vecrem = { version = "0.1", optional = true } [dev-dependencies] pretty_env_logger = "0.4" -tokio = { version = "1.8.0", features = ["fs", "macros"] } +tokio = { version = "1.8.0", features = ["fs", "macros", "macros", "rt-multi-thread"] } cool_asserts = "2.0.3" [features] diff --git a/src/lib.rs b/src/lib.rs index 52bbb4a9..e2ff169c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -90,6 +90,8 @@ #![warn(clippy::print_stdout, clippy::dbg_macro)] // Unless this becomes machine applicable, I'm not adding 334 #[must_use]s (waffle) #![allow(clippy::return_self_not_must_use)] +// Workaround for CI +#![allow(rustdoc::bare_urls)] // The internal helper macros. #[macro_use]