aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/ci.yml163
-rw-r--r--Cargo.toml6
-rw-r--r--README.md7
-rw-r--r--azure-pipelines.yml69
-rw-r--r--ci/azure-cross-compile.yml46
-rw-r--r--ci/azure-deploy-docs.yml39
-rw-r--r--ci/azure-install-rust.yml33
-rw-r--r--ci/azure-loom.yml15
-rw-r--r--ci/azure-rustfmt.yml13
-rw-r--r--ci/azure-test-stable.yml50
-rw-r--r--ci/azure-tsan.yml26
-rw-r--r--ci/test-stable.sh27
-rw-r--r--ci/tsan.sh15
13 files changed, 210 insertions, 299 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..164ec13
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,163 @@
+name: CI
+
+on:
+ pull_request:
+ branches:
+ - master
+ push:
+ branches:
+ - master
+
+env:
+ RUSTFLAGS: -Dwarnings
+ RUST_BACKTRACE: 1
+
+defaults:
+ run:
+ shell: bash
+
+jobs:
+ # Check formatting
+ rustfmt:
+ name: rustfmt
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - name: Install Rust
+ run: rustup update stable && rustup default stable
+ - name: Check formatting
+ run: cargo fmt --all -- --check
+
+ # TODO
+ # # Apply clippy lints
+ # clippy:
+ # name: clippy
+ # runs-on: ubuntu-latest
+ # steps:
+ # - uses: actions/checkout@v2
+ # - name: Apply clippy lints
+ # run: cargo clippy --all-features
+
+ # This represents the minimum Rust version supported by
+ # Bytes. Updating this should be done in a dedicated PR.
+ #
+ # Tests are not run as tests may require newer versions of
+ # rust.
+ minrust:
+ name: minrust
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - name: Install Rust
+ run: rustup update 1.39.0 && rustup default 1.39.0
+ - name: Check
+ run: . ci/test-stable.sh check
+
+ # Stable
+ stable:
+ name: stable
+ strategy:
+ matrix:
+ os:
+ - ubuntu-latest
+ - macos-latest
+ - windows-latest
+ runs-on: ${{ matrix.os }}
+ steps:
+ - uses: actions/checkout@v2
+ - name: Install Rust
+ run: rustup update stable && rustup default stable
+ - name: Test
+ run: . ci/test-stable.sh test
+
+ # Nightly
+ nightly:
+ name: nightly
+ env:
+ # Pin nightly to avoid being impacted by breakage
+ RUST_VERSION: nightly-2019-09-25
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - name: Install Rust
+ run: rustup update $RUST_VERSION && rustup default $RUST_VERSION
+ - name: Test
+ run: . ci/test-stable.sh test
+
+ # Run tests on some extra platforms
+ cross:
+ name: cross
+ strategy:
+ matrix:
+ target:
+ - i686-unknown-linux-gnu
+ - armv7-unknown-linux-gnueabihf
+ - powerpc-unknown-linux-gnu
+ - powerpc64-unknown-linux-gnu
+ - wasm32-unknown-unknown
+ runs-on: ubuntu-16.04
+ steps:
+ - uses: actions/checkout@v2
+ - name: Install Rust
+ run: rustup update stable && rustup default stable
+ - name: cross build --target ${{ matrix.target }}
+ run: |
+ cargo install cross
+ cross build --target ${{ matrix.target }}
+ if: matrix.target != 'wasm32-unknown-unknown'
+ # WASM support
+ - name: cargo build --target ${{ matrix.target }}
+ run: |
+ rustup target add ${{ matrix.target }}
+ cargo build --target ${{ matrix.target }}
+ if: matrix.target == 'wasm32-unknown-unknown'
+
+ # Sanitizers
+ tsan:
+ name: tsan
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - name: Install Rust
+ run: rustup update nightly && rustup default nightly
+ - name: TSAN / MSAN
+ run: . ci/tsan.sh
+
+ # Loom
+ loom:
+ name: loom
+ env:
+ # Pin nightly to avoid being impacted by breakage
+ RUST_VERSION: nightly-2020-05-19
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - name: Install Rust
+ run: rustup update $RUST_VERSION && rustup default $RUST_VERSION
+ - name: Loom tests
+ run: RUSTFLAGS="--cfg loom -Dwarnings" cargo test --lib
+
+ publish_docs:
+ name: Publish Documentation
+ needs:
+ - rustfmt
+ # - clippy
+ - stable
+ - nightly
+ - minrust
+ - cross
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - name: Install Rust
+ run: rustup update stable && rustup default stable
+ - name: Build documentation
+ run: cargo doc --no-deps --all-features
+ - name: Publish documentation
+ run: |
+ cd target/doc
+ git init
+ git add .
+ git -c user.name='ci' -c user.email='ci' commit -m 'Deploy Bytes API documentation'
+ git push -f -q https://git:${{ secrets.github_token }}@github.com/${{ github.repository }} HEAD:gh-pages
+ if: github.event_name == 'push' && github.event.ref == 'refs/heads/master' && github.repository == 'tokio-rs/bytes'
diff --git a/Cargo.toml b/Cargo.toml
index c3ba228..2ccb39f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -25,12 +25,10 @@ default = ["std"]
std = []
[dependencies]
-serde = { version = "1.0", optional = true, default-features = false, features = ["alloc"] }
+serde = { version = "1.0.60", optional = true, default-features = false, features = ["alloc"] }
[dev-dependencies]
serde_test = "1.0"
-# loom is currently not compiling on windows.
-# See: https://github.com/Xudong-Huang/generator-rs/issues/19
-[target.'cfg(not(windows))'.dev-dependencies]
+[target.'cfg(loom)'.dependencies]
loom = "0.3"
diff --git a/README.md b/README.md
index afc2ed2..73c43ab 100644
--- a/README.md
+++ b/README.md
@@ -3,12 +3,12 @@
A utility library for working with bytes.
[![Crates.io][crates-badge]][crates-url]
-[![Build Status][azure-badge]][azure-url]
+[![Build Status][ci-badge]][ci-url]
[crates-badge]: https://img.shields.io/crates/v/bytes.svg
[crates-url]: https://crates.io/crates/bytes
-[azure-badge]: https://dev.azure.com/tokio-rs/bytes/_apis/build/status/tokio-rs.bytes?branchName=master
-[azure-url]: https://dev.azure.com/tokio-rs/bytes/_build/latest?definitionId=3&branchName=master
+[ci-badge]: https://github.com/tokio-rs/bytes/workflows/CI/badge.svg
+[ci-url]: https://github.com/tokio-rs/bytes/actions
[Documentation](https://docs.rs/bytes)
@@ -45,4 +45,3 @@ This project is licensed under the [MIT license](LICENSE).
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in `bytes` by you, shall be licensed as MIT, without any additional
terms or conditions.
-
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
deleted file mode 100644
index a92c3c4..0000000
--- a/azure-pipelines.yml
+++ /dev/null
@@ -1,69 +0,0 @@
-trigger: ["master"]
-pr: ["master"]
-
-jobs:
-# Check formatting
-- template: ci/azure-rustfmt.yml
- parameters:
- name: rustfmt
- rust_version: stable
-
-# Apply clippy lints
-# - template: ci/azure-clippy.yml
-# parameters:
-# name: clippy
-
-# This represents the minimum Rust version supported by
-# Bytes. Updating this should be done in a dedicated PR.
-#
-# Tests are not run as tests may require newer versions of
-# rust.
-- template: ci/azure-test-stable.yml
- parameters:
- name: minrust
- rust_version: 1.39.0
- cmd: check
-
-# Stable
-- template: ci/azure-test-stable.yml
- parameters:
- name: stable
- cross: true
- features:
- - serde
-
-# Nightly
-- template: ci/azure-test-stable.yml
- parameters:
- name: nightly
- # Pin nightly to avoid being impacted by breakage
- rust_version: nightly-2019-09-25
- benches: true
-
-# Run tests on some extra platforms
-- template: ci/azure-cross-compile.yml
- parameters:
- name: cross
-
-# Sanitizers
-- template: ci/azure-tsan.yml
- parameters:
- name: tsan
- rust_version: nightly
-
-# Loom
-- template: ci/azure-loom.yml
- parameters:
- name: loom
- rust_version: stable
-
-
-- template: ci/azure-deploy-docs.yml
- parameters:
- dependsOn:
- - rustfmt
- # - clippy
- - stable
- - nightly
- - minrust
- - cross
diff --git a/ci/azure-cross-compile.yml b/ci/azure-cross-compile.yml
deleted file mode 100644
index be46ca3..0000000
--- a/ci/azure-cross-compile.yml
+++ /dev/null
@@ -1,46 +0,0 @@
-parameters:
- cmd: build
- rust_version: stable
-
-jobs:
-- job: ${{ parameters.name }}
- displayName: Cross
- strategy:
- matrix:
- i686:
- vmImage: ubuntu-16.04
- target: i686-unknown-linux-gnu
- armv7:
- vmImage: ubuntu-16.04
- target: armv7-unknown-linux-gnueabihf
- powerpc:
- vmImage: ubuntu-16.04
- target: powerpc-unknown-linux-gnu
- powerpc64:
- vmImage: ubuntu-16.04
- target: powerpc64-unknown-linux-gnu
- wasm:
- vmImage: ubuntu-16.04
- target: wasm32-unknown-unknown
- pool:
- vmImage: $(vmImage)
-
- steps:
- - template: azure-install-rust.yml
- parameters:
- rust_version: ${{parameters.rust_version}}
-
- - script: cargo install cross
- displayName: Install cross
- condition: not(eq(variables['target'], 'wasm32-unknown-unknown'))
-
- - script: cross ${{ parameters.cmd }} --target $(target)
- displayName: cross ${{ parameters.cmd }} --target $(target)
- condition: not(eq(variables['target'], 'wasm32-unknown-unknown'))
-
- # WASM support
- - script: |
- rustup target add $(target)
- cargo build --target $(target)
- displayName: cargo build --target $(target)
- condition: eq(variables['target'], 'wasm32-unknown-unknown')
diff --git a/ci/azure-deploy-docs.yml b/ci/azure-deploy-docs.yml
deleted file mode 100644
index 52ac48f..0000000
--- a/ci/azure-deploy-docs.yml
+++ /dev/null
@@ -1,39 +0,0 @@
-parameters:
- dependsOn: []
-
-jobs:
-- job: documentation
- displayName: 'Deploy API Documentation'
- condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
- pool:
- vmImage: 'Ubuntu 16.04'
- dependsOn:
- - ${{ parameters.dependsOn }}
- steps:
- - template: azure-install-rust.yml
- parameters:
- rust_version: stable
- - script: |
- cargo doc --no-deps
- cp -R target/doc '$(Build.BinariesDirectory)'
- displayName: 'Generate Documentation'
- - script: |
- set -e
-
- git --version
- ls -la
- git init
- git config user.name 'Deployment Bot (from Azure Pipelines)'
- git config user.email 'deploy@tokio-rs.com'
- git config --global credential.helper 'store --file ~/.my-credentials'
- printf "protocol=https\nhost=github.com\nusername=carllerche\npassword=%s\n\n" "$GITHUB_TOKEN" | git credential-store --file ~/.my-credentials store
- git remote add origin https://github.com/tokio-rs/bytes
- git checkout -b gh-pages
- git add .
- git commit -m 'Deploy Bytes API documentation'
- git push -f origin gh-pages
- env:
- GITHUB_TOKEN: $(githubPersonalToken)
- workingDirectory: '$(Build.BinariesDirectory)'
- displayName: 'Deploy Documentation'
-
diff --git a/ci/azure-install-rust.yml b/ci/azure-install-rust.yml
deleted file mode 100644
index 0217659..0000000
--- a/ci/azure-install-rust.yml
+++ /dev/null
@@ -1,33 +0,0 @@
-steps:
- # Linux and macOS.
- - script: |
- set -e
- curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain none
- export PATH=$PATH:$HOME/.cargo/bin
- rustup toolchain install $RUSTUP_TOOLCHAIN
- rustup default $RUSTUP_TOOLCHAIN
- echo "##vso[task.setvariable variable=PATH;]$PATH:$HOME/.cargo/bin"
- env:
- RUSTUP_TOOLCHAIN: ${{parameters.rust_version}}
- displayName: "Install rust (*nix)"
- condition: not(eq(variables['Agent.OS'], 'Windows_NT'))
-
- # Windows.
- - script: |
- curl -sSf -o rustup-init.exe https://win.rustup.rs
- rustup-init.exe -y --default-toolchain none
- set PATH=%PATH%;%USERPROFILE%\.cargo\bin
- rustup toolchain install %RUSTUP_TOOLCHAIN%
- rustup default %RUSTUP_TOOLCHAIN%
- echo "##vso[task.setvariable variable=PATH;]%PATH%;%USERPROFILE%\.cargo\bin"
- env:
- RUSTUP_TOOLCHAIN: ${{parameters.rust_version}}
- displayName: "Install rust (windows)"
- condition: eq(variables['Agent.OS'], 'Windows_NT')
-
- # All platforms.
- - script: |
- rustup toolchain list
- rustc -Vv
- cargo -V
- displayName: Query rust and cargo versions
diff --git a/ci/azure-loom.yml b/ci/azure-loom.yml
deleted file mode 100644
index 1db9c3a..0000000
--- a/ci/azure-loom.yml
+++ /dev/null
@@ -1,15 +0,0 @@
-jobs:
-- job: ${{parameters.name}}
- displayName: Loom tests
- pool:
- vmImage: ubuntu-16.04
-
- steps:
- - template: azure-install-rust.yml
- parameters:
- rust_version: ${{parameters.rust_version}}
-
- - script: RUSTFLAGS="--cfg loom" cargo test --lib
- displayName: RUSTFLAGS="--cfg loom" cargo test --lib
-
-
diff --git a/ci/azure-rustfmt.yml b/ci/azure-rustfmt.yml
deleted file mode 100644
index a0a1338..0000000
--- a/ci/azure-rustfmt.yml
+++ /dev/null
@@ -1,13 +0,0 @@
-jobs:
-# Check formatting
-- job: ${{ parameters.name }}
- displayName: Check rustfmt
- pool:
- vmImage: ubuntu-16.04
- steps:
- - template: azure-install-rust.yml
- parameters:
- rust_version: ${{ parameters.rust_version }}
- - script: |
- cargo fmt --all -- --check
- displayName: Check formatting
diff --git a/ci/azure-test-stable.yml b/ci/azure-test-stable.yml
deleted file mode 100644
index b3e614a..0000000
--- a/ci/azure-test-stable.yml
+++ /dev/null
@@ -1,50 +0,0 @@
-parameters:
- cmd: test
- rust_version: stable
- features: []
-
-jobs:
-- job: ${{ parameters.name }}
- displayName: ${{ parameters.displayName }}
- strategy:
- matrix:
- Linux:
- vmImage: ubuntu-16.04
-
- ${{ if parameters.cross }}:
- MacOS:
- vmImage: macOS-10.14
- Windows:
- vmImage: vs2017-win2016
- pool:
- vmImage: $(vmImage)
-
- steps:
- - template: azure-install-rust.yml
- parameters:
- rust_version: ${{parameters.rust_version}}
-
- # Run with default crate features
- - script: cargo ${{ parameters.cmd }}
- displayName: cargo ${{ parameters.cmd }}
-
- # Run with each specified feature
- - ${{ each feature in parameters.features }}:
- - script: cargo ${{ parameters.cmd }} --features ${{ feature }}
- displayName: cargo ${{ parameters.cmd }} --features ${{ feature }}
-
- - ${{ if eq(parameters.cmd, 'test') }}:
- - script: cargo doc --no-deps
- displayName: cargo doc --no-deps
-
- - ${{ if parameters.benches }}:
- - script: cargo check --benches
- displayName: Check benchmarks
-
- # Run with all features
- - script: cargo ${{ parameters.cmd }} --all-features
- displayName: cargo ${{ parameters.cmd }} --all-features
-
- # Run with no default features
- - script: cargo check --no-default-features
- displayName: cargo check --no-default-features
diff --git a/ci/azure-tsan.yml b/ci/azure-tsan.yml
deleted file mode 100644
index 198b187..0000000
--- a/ci/azure-tsan.yml
+++ /dev/null
@@ -1,26 +0,0 @@
-jobs:
-- job: ${{ parameters.name }}
- displayName: TSAN
- pool:
- vmImage: ubuntu-16.04
-
- steps:
- - template: azure-install-rust.yml
- parameters:
- rust_version: ${{ parameters.rust_version }}
-
- - script: |
- set -e
-
- export RUST_TEST_THREADS=1
- export ASAN_OPTIONS="detect_odr_violation=0 detect_leaks=0"
- export TSAN_OPTIONS="suppressions=`pwd`/ci/tsan"
-
- # Run address sanitizer
- RUSTFLAGS="-Z sanitizer=address" \
- cargo test --target x86_64-unknown-linux-gnu --test test_bytes --test test_buf --test test_buf_mut
-
- # Run thread sanitizer
- RUSTFLAGS="-Z sanitizer=thread" \
- cargo test --target x86_64-unknown-linux-gnu --test test_bytes --test test_buf --test test_buf_mut
- displayName: TSAN / MSAN
diff --git a/ci/test-stable.sh b/ci/test-stable.sh
new file mode 100644
index 0000000..01a32f5
--- /dev/null
+++ b/ci/test-stable.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+set -ex
+
+cmd="${1:-test}"
+
+# Install cargo-hack for feature flag test
+cargo install cargo-hack
+
+# 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
+
+ # Check minimal versions
+ cargo clean
+ cargo update -Zminimal-versions
+ cargo check --all-features
+fi
diff --git a/ci/tsan.sh b/ci/tsan.sh
new file mode 100644
index 0000000..7e5b3be
--- /dev/null
+++ b/ci/tsan.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+set -ex
+
+export RUST_TEST_THREADS=1
+export ASAN_OPTIONS="detect_odr_violation=0 detect_leaks=0"
+export TSAN_OPTIONS="suppressions=$(pwd)/ci/tsan"
+
+# Run address sanitizer
+RUSTFLAGS="-Z sanitizer=address" \
+cargo test --target x86_64-unknown-linux-gnu --test test_bytes --test test_buf --test test_buf_mut
+
+# Run thread sanitizer
+RUSTFLAGS="-Z sanitizer=thread" \
+cargo test --target x86_64-unknown-linux-gnu --test test_bytes --test test_buf --test test_buf_mut