Skip to content

Commit

Permalink
Update CI config (#650)
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e authored Jan 7, 2024
1 parent fbc64bc commit 09214ba
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 30 deletions.
54 changes: 31 additions & 23 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on:
push:
branches:
- master
schedule:
- cron: '0 2 * * 0'

env:
RUSTFLAGS: -Dwarnings
Expand All @@ -23,19 +25,19 @@ jobs:
name: rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install Rust
run: rustup update stable && rustup default stable
run: rustup update stable
- name: Check formatting
run: cargo fmt --all -- --check
run: cargo fmt --all --check

# TODO
# # Apply clippy lints
# clippy:
# name: clippy
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - uses: actions/checkout@v4
# - name: Apply clippy lints
# run: cargo clippy --all-features

Expand All @@ -48,11 +50,11 @@ jobs:
name: minrust
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Rust
run: rustup update 1.39.0 && rustup default 1.39.0
- uses: actions/checkout@v4
- name: Install cargo-hack
uses: taiki-e/install-action@cargo-hack
- name: Check
run: . ci/test-stable.sh check
run: cargo hack check --feature-powerset --optional-deps --rust-version

# Stable
stable:
Expand All @@ -65,23 +67,27 @@ jobs:
- windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- 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
run: rustup update stable --no-self-update
- name: Install cargo-hack
uses: taiki-e/install-action@cargo-hack
- name: Test
run: . ci/test-stable.sh test
run: ci/test-stable.sh test

# Nightly
nightly:
name: nightly
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install Rust
run: rustup update $nightly && rustup default $nightly
- name: Install cargo-hack
uses: taiki-e/install-action@cargo-hack
- name: Test
run: . ci/test-stable.sh test
run: ci/test-stable.sh test

# Run tests on some extra platforms
cross:
Expand All @@ -96,13 +102,14 @@ jobs:
- wasm32-unknown-unknown
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install Rust
run: rustup update stable && rustup default stable
run: rustup update stable
- name: Install cross
uses: taiki-e/install-action@cross
if: matrix.target != 'wasm32-unknown-unknown'
- name: cross build --target ${{ matrix.target }}
run: |
cargo install cross
cross build --target ${{ matrix.target }}
run: cross build --target ${{ matrix.target }}
if: matrix.target != 'wasm32-unknown-unknown'
# WASM support
- name: cargo build --target ${{ matrix.target }}
Expand All @@ -116,18 +123,19 @@ jobs:
name: tsan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install Rust
run: rustup update $nightly && rustup default $nightly
- name: Install rust-src
run: rustup component add rust-src
- name: ASAN / TSAN
run: . ci/tsan.sh
run: ci/tsan.sh

miri:
name: miri
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Miri
run: ci/miri.sh

Expand All @@ -136,7 +144,7 @@ jobs:
name: loom
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install Rust
run: rustup update $nightly && rustup default $nightly
- name: Loom tests
Expand All @@ -155,7 +163,7 @@ jobs:
- loom
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install Rust
run: rustup update $nightly && rustup default $nightly
- name: Build documentation
Expand Down
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ name = "bytes"
# - Update CHANGELOG.md.
# - Create "v1.x.y" git tag.
version = "1.5.0"
edition = "2018"
rust-version = "1.39"
license = "MIT"
authors = [
"Carl Lerche <[email protected]>",
Expand All @@ -15,7 +17,6 @@ repository = "https://github.com/tokio-rs/bytes"
readme = "README.md"
keywords = ["buffers", "zero-copy", "io"]
categories = ["network-programming", "data-structures"]
edition = "2018"

[features]
default = ["std"]
Expand Down
6 changes: 0 additions & 6 deletions ci/test-stable.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,13 @@ set -ex

cmd="${1:-test}"

# Install cargo-hack for feature flag test
host=$(rustc -Vv | grep host | sed 's/host: //')
curl -LsSf https://github.com/taiki-e/cargo-hack/releases/latest/download/cargo-hack-$host.tar.gz | tar xzf - -C ~/.cargo/bin

# Run with each feature
# * --each-feature includes both default/no-default features
# * --optional-deps is needed for serde feature
cargo hack "${cmd}" --each-feature --optional-deps
# Run with all features
cargo "${cmd}" --all-features

cargo doc --no-deps --all-features

if [[ "${RUST_VERSION}" == "nightly"* ]]; then
# Check benchmarks
cargo check --benches
Expand Down
Empty file modified ci/tsan.sh
100644 → 100755
Empty file.

0 comments on commit 09214ba

Please sign in to comment.