Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
codecov:
require_ci_to_pass: false

ignore:

Comment thread
al8n marked this conversation as resolved.
Resolved
coverage:
status:
project: # Overall project status
default:
target: auto
if_not_found: success
only_pulls: false
patch: # Status for the patch in pull requests
default:
target: auto
if_not_found: success
only_pulls: true
changes: false # Whether to comment on the coverage changes in pull requests

comment:
layout: "header, diff, files, footer"
behavior: default
require_changes: false
212 changes: 114 additions & 98 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ on:
- '**.md'
- '**.txt'
workflow_dispatch:
schedule: [cron: "0 1 */7 * *"]
schedule:
- cron: "0 1 1 * *"

env:
CARGO_TERM_COLOR: always
Expand All @@ -30,17 +31,6 @@ env:
nightly: nightly

jobs:
# Check formatting
rustfmt:
name: rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
run: rustup update stable && rustup default stable
- name: Check formatting
run: rustfmt --check --edition 2021 $(git ls-files '*.rs')

# This represents the minimum Rust version supported by
# Bytes. Updating this should be done in a dedicated PR.
#
Expand All @@ -50,115 +40,141 @@ jobs:
name: minrust
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Install Rust
run: rustup update 1.75.0 && rustup default 1.75.0
- name: Check
run: cargo check

# Apply clippy lints
clippy:
name: clippy
# Check formatting (platform-independent, one OS is enough)
rustfmt:
name: rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Apply clippy lints
run: cargo clippy --all-features
- uses: actions/checkout@v6
- name: Install Rust
run: rustup update stable && rustup default stable && rustup component add rustfmt
- name: Check formatting
run: cargo fmt --all -- --check

unit-tests:
name: unit tests
runs-on: ${{ matrix.os }}
# Apply clippy lints
clippy:
name: clippy
strategy:
matrix:
rust:
- nightly
os:
- ubuntu-latest
- macos-latest
- windows-latest
- ubuntu-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install latest nightly
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
override: true
components: rustfmt, clippy

- uses: Swatinem/rust-cache@v1
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/checkout@v6
- name: Install Rust
# --no-self-update is necessary because the windows environment cannot self-update rustup.exe.
run: rustup update stable --no-self-update && rustup default stable && rustup component add clippy
- name: Install cargo-hack
run: cargo install cargo-hack
- name: Apply clippy lints
run: cargo hack clippy --each-feature

- name: test all features
# Run sequentially to avoid race condition around file system size
run: cargo test --all-features -- --test-threads 1
docs:
name: docs
# Run tests on some extra platforms
cross:
name: cross
strategy:
matrix:
target:
- aarch64-unknown-linux-gnu
- aarch64-linux-android
- aarch64-unknown-linux-musl
- i686-linux-android
- x86_64-linux-android
- i686-pc-windows-gnu
- x86_64-pc-windows-gnu
- i686-unknown-linux-gnu
- powerpc64-unknown-linux-gnu
- riscv64gc-unknown-linux-gnu
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Cache cargo build and registry
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ubuntu-latest-docs-${{ hashFiles('**/Cargo.lock') }}
key: ${{ runner.os }}-cross-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
ubuntu-latest-docs-
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.nightly }}
override: true
- name: "doc --lib --all-features"
run: cargo doc --lib --no-deps --all-features
env:
RUSTFLAGS: --cfg docsrs
RUSTDOCFLAGS: --cfg docsrs -Dwarnings
${{ runner.os }}-cross-
- name: Install Rust
run: rustup update stable && rustup default stable
- name: Install MinGW toolchain for Windows GNU cross targets
# windows-sys >= 0.61 generates import libraries via `dlltool`
# when building for *-pc-windows-gnu. ubuntu-latest ships the
# x86_64 MinGW toolchain pre-installed, but not the i686 one.
if: contains(matrix.target, 'pc-windows-gnu')
run: |
sudo apt-get update
sudo apt-get install -y gcc-mingw-w64 binutils-mingw-w64
- name: cargo build --target ${{ matrix.target }}
run: |
rustup target add ${{ matrix.target }}
cargo build --target ${{ matrix.target }}

build:
name: build
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
- name: Cache cargo build and registry
uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-build-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-build-
- name: Install Rust
# --no-self-update is necessary because the windows environment cannot self-update rustup.exe.
run: rustup update stable --no-self-update && rustup default stable
- name: Install cargo-hack
run: cargo install cargo-hack
- name: Run build
run: cargo hack build --each-feature

coverage:
name: cargo tarpaulin
runs-on: ubuntu-latest
needs:
- unit-tests
- clippy
- rustfmt
- minrust
test:
name: test
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install latest nightly
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
- uses: actions-rs/install@v0.1
with:
crate: cargo-tarpaulin
version: latest
- name: Cache ~/.cargo
uses: actions/cache@v4
with:
path: ~/.cargo
key: ${{ runner.os }}-coverage-dotcargo
- name: Cache cargo build
uses: actions/cache@v4
with:
path: target
key: ${{ runner.os }}-coverage-cargo-build-target
- name: Run tarpaulin
uses: actions-rs/cargo@v1
with:
command: tarpaulin
args: --all-features --run-types tests --run-types doctests --workspace --out xml
- name: Upload to codecov.io
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
slug: al8n/fs4-rs
- uses: actions/checkout@v6
- name: Cache cargo build and registry
uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-test-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-test-
- name: Install Rust
# --no-self-update is necessary because the windows environment cannot self-update rustup.exe.
run: rustup update stable --no-self-update && rustup default stable
- name: Install cargo-hack
run: cargo install cargo-hack
- name: Run test
run: cargo hack test --each-feature -- --test-threads 1
Loading
Loading