mirror of
https://github.com/openharmony/third_party_rust_bytes.git
synced 2026-07-18 16:24:29 -04:00
Set up CI with Azure Pipelines (#275)
This commit is contained in:
-91
@@ -1,91 +0,0 @@
|
||||
---
|
||||
dist: trusty
|
||||
language: rust
|
||||
services: docker
|
||||
sudo: required
|
||||
rust: stable
|
||||
|
||||
env:
|
||||
global:
|
||||
- CRATE_NAME=bytes
|
||||
# Default job
|
||||
- TARGET=x86_64-unknown-linux-gnu
|
||||
- secure: "f17G5kb6uAQlAG9+GknFFYAmngGBqy9h+3FtNbp3mXTI0FOLltz00Ul5kGPysE4eagypm/dWOuvBkNjN01jhE6fCbekmInEsobIuanatrk6TvXT6caJqykxhPJC2cUoq8pKnMqEOuucEqPPUH6Qy6Hz4/2cRu5JV22Uv9dtS29Q="
|
||||
|
||||
matrix:
|
||||
include:
|
||||
# Run build on oldest supported rust version. Do not change the rust
|
||||
# version without a Github issue first.
|
||||
#
|
||||
# This job will also build and deploy the docs to gh-pages.
|
||||
- env: TARGET=x86_64-unknown-linux-gnu
|
||||
rust: 1.36.0
|
||||
after_success:
|
||||
- |
|
||||
pip install 'travis-cargo<0.2' --user &&
|
||||
export PATH=$HOME/.local/bin:$PATH
|
||||
- travis-cargo doc
|
||||
- travis-cargo doc-upload
|
||||
|
||||
# Run tests on some extra platforms
|
||||
- env: TARGET=i686-unknown-linux-gnu
|
||||
- env: TARGET=armv7-unknown-linux-gnueabihf
|
||||
- env: RUST_TEST_THREADS=1 TARGET=powerpc-unknown-linux-gnu
|
||||
- env: RUST_TEST_THREADS=1 TARGET=powerpc64-unknown-linux-gnu
|
||||
|
||||
# Serde implementation
|
||||
- env: EXTRA_ARGS="--features serde"
|
||||
|
||||
# 128 bit numbers
|
||||
- env: EXTRA_ARGS="--features i128"
|
||||
|
||||
# `Either` impls
|
||||
- env: EXTRA_ARGS="--features either"
|
||||
|
||||
# WASM support
|
||||
- rust: stable
|
||||
script:
|
||||
- rustup target add wasm32-unknown-unknown
|
||||
- cargo build --target=wasm32-unknown-unknown
|
||||
|
||||
# Sanitizers
|
||||
- rust: nightly
|
||||
os: linux
|
||||
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 --tests --target x86_64-unknown-linux-gnu
|
||||
|
||||
# Run thread sanitizer
|
||||
RUSTFLAGS="-Z sanitizer=thread" \
|
||||
cargo test --tests --target x86_64-unknown-linux-gnu
|
||||
|
||||
before_install: set -e
|
||||
|
||||
install:
|
||||
- sh ci/install.sh
|
||||
- source ~/.cargo/env || true
|
||||
|
||||
script:
|
||||
- bash ci/script.sh
|
||||
|
||||
after_script: set +e
|
||||
|
||||
before_deploy:
|
||||
- sh ci/before_deploy.sh
|
||||
|
||||
cache: cargo
|
||||
before_cache:
|
||||
# Travis can't cache files that are not readable by "others"
|
||||
- chmod -R a+r $HOME/.cargo
|
||||
|
||||
notifications:
|
||||
email:
|
||||
on_success: never
|
||||
@@ -14,13 +14,6 @@ documentation = "https://docs.rs/bytes"
|
||||
repository = "https://github.com/tokio-rs/bytes"
|
||||
readme = "README.md"
|
||||
keywords = ["buffers", "zero-copy", "io"]
|
||||
exclude = [
|
||||
".gitignore",
|
||||
".travis.yml",
|
||||
"deploy.sh",
|
||||
"bench/**/*",
|
||||
"test/**/*"
|
||||
]
|
||||
categories = ["network-programming", "data-structures"]
|
||||
edition = "2018"
|
||||
|
||||
|
||||
@@ -2,8 +2,13 @@
|
||||
|
||||
A utility library for working with bytes.
|
||||
|
||||
[](https://crates.io/crates/bytes)
|
||||
[](https://travis-ci.org/tokio-rs/bytes)
|
||||
[![Crates.io][crates-badge]][crates-url]
|
||||
[![Build Status][azure-badge]][azure-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
|
||||
|
||||
[Documentation](https://docs.rs/bytes)
|
||||
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
trigger: ["master"]
|
||||
pr: ["master"]
|
||||
|
||||
jobs:
|
||||
# Check formatting
|
||||
# - template: ci/azure-rustfmt.yml
|
||||
# parameters:
|
||||
# name: rustfmt
|
||||
|
||||
# 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.36.0
|
||||
cmd: check
|
||||
|
||||
# Stable
|
||||
- template: ci/azure-test-stable.yml
|
||||
parameters:
|
||||
name: stable
|
||||
cross: true
|
||||
features:
|
||||
- serde
|
||||
- i128
|
||||
- either
|
||||
|
||||
# Nightly
|
||||
- template: ci/azure-test-stable.yml
|
||||
parameters:
|
||||
name: nightly
|
||||
# Pin nightly to avoid being impacted by breakage
|
||||
rust_version: nightly-2019-07-17
|
||||
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
|
||||
|
||||
- template: ci/azure-deploy-docs.yml
|
||||
parameters:
|
||||
dependsOn:
|
||||
# - rustfmt
|
||||
# - clippy
|
||||
- stable
|
||||
- nightly
|
||||
- minrust
|
||||
- cross
|
||||
@@ -0,0 +1,55 @@
|
||||
parameters:
|
||||
cmd: test
|
||||
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}}
|
||||
|
||||
# FIXME(taiki-e): When https://github.com/rust-embedded/cross/pull/169 is
|
||||
# merged, switch to the installation from crates.io.
|
||||
# See https://nbsoftsolutions.com/blog/azure-pipelines-for-rust-projects#workaround-cross-compilation
|
||||
# for the current script.
|
||||
- script: |
|
||||
git clone https://github.com/rust-embedded/cross.git
|
||||
cd cross
|
||||
git apply ../ci/cross-patch
|
||||
cargo install --path .
|
||||
rm -rf 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')
|
||||
@@ -0,0 +1,39 @@
|
||||
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'
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
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
|
||||
@@ -0,0 +1,42 @@
|
||||
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.13
|
||||
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.value }}:
|
||||
- script: cargo ${{ parameters.cmd }} --features ${{ feature }}
|
||||
displayName: cargo ${{ parameters.cmd }} --tests --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
|
||||
@@ -0,0 +1,26 @@
|
||||
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 --tests --target x86_64-unknown-linux-gnu
|
||||
|
||||
# Run thread sanitizer
|
||||
RUSTFLAGS="-Z sanitizer=thread" \
|
||||
cargo test --tests --target x86_64-unknown-linux-gnu
|
||||
displayName: TSAN / MSAN
|
||||
@@ -1,23 +0,0 @@
|
||||
# This script takes care of packaging the build artifacts that will go in the
|
||||
# release zipfile
|
||||
|
||||
$SRC_DIR = $PWD.Path
|
||||
$STAGE = [System.Guid]::NewGuid().ToString()
|
||||
|
||||
Set-Location $ENV:Temp
|
||||
New-Item -Type Directory -Name $STAGE
|
||||
Set-Location $STAGE
|
||||
|
||||
$ZIP = "$SRC_DIR\$($Env:CRATE_NAME)-$($Env:APPVEYOR_REPO_TAG_NAME)-$($Env:TARGET).zip"
|
||||
|
||||
# TODO Update this to package the right artifacts
|
||||
Copy-Item "$SRC_DIR\target\$($Env:TARGET)\release\hello.exe" '.\'
|
||||
|
||||
7z a "$ZIP" *
|
||||
|
||||
Push-AppveyorArtifact "$ZIP"
|
||||
|
||||
Remove-Item *.* -Force
|
||||
Set-Location ..
|
||||
Remove-Item $STAGE
|
||||
Set-Location $SRC_DIR
|
||||
@@ -1,33 +0,0 @@
|
||||
# This script takes care of building your crate and packaging it for release
|
||||
|
||||
set -ex
|
||||
|
||||
main() {
|
||||
local src=$(pwd) \
|
||||
stage=
|
||||
|
||||
case $TRAVIS_OS_NAME in
|
||||
linux)
|
||||
stage=$(mktemp -d)
|
||||
;;
|
||||
osx)
|
||||
stage=$(mktemp -d -t tmp)
|
||||
;;
|
||||
esac
|
||||
|
||||
test -f Cargo.lock || cargo generate-lockfile
|
||||
|
||||
# TODO Update this to build the artifacts that matter to you
|
||||
cross rustc --bin hello --target $TARGET --release -- -C lto
|
||||
|
||||
# TODO Update this to package the right artifacts
|
||||
cp target/$TARGET/release/hello $stage/
|
||||
|
||||
cd $stage
|
||||
tar czf $src/$CRATE_NAME-$TRAVIS_TAG-$TARGET.tar.gz *
|
||||
cd $src
|
||||
|
||||
rm -rf $stage
|
||||
}
|
||||
|
||||
main
|
||||
@@ -0,0 +1,22 @@
|
||||
diff --git a/src/docker.rs b/src/docker.rs
|
||||
index 1525b87..5c9cd54 100644
|
||||
--- a/src/docker.rs
|
||||
+++ b/src/docker.rs
|
||||
@@ -62,7 +62,7 @@ pub fn register(target: &Target, verbose: bool) -> Result<()> {
|
||||
docker_command("run")
|
||||
.arg("--privileged")
|
||||
.arg("--rm")
|
||||
- .arg("-it")
|
||||
+ .arg("-i")
|
||||
.arg("ubuntu:16.04")
|
||||
.args(&["sh", "-c", cmd])
|
||||
.run(verbose)
|
||||
@@ -160,7 +160,7 @@ pub fn run(target: &Target,
|
||||
.args(&["-v", &format!("{}:/rust:ro", sysroot.display())])
|
||||
.args(&["-v", &format!("{}:/target", target_dir.display())])
|
||||
.args(&["-w", "/project"])
|
||||
- .args(&["-it", &image(toml, target)?])
|
||||
+ .args(&["-i", &image(toml, target)?])
|
||||
.args(&["sh", "-c", &format!("PATH=$PATH:/rust/bin {:?}", cmd)])
|
||||
.run_and_get_status(verbose)
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
set -ex
|
||||
|
||||
main() {
|
||||
curl https://sh.rustup.rs -sSf | \
|
||||
sh -s -- -y --default-toolchain $TRAVIS_RUST_VERSION
|
||||
|
||||
local target=
|
||||
if [ $TRAVIS_OS_NAME = linux ]; then
|
||||
target=x86_64-unknown-linux-gnu
|
||||
sort=sort
|
||||
else
|
||||
target=x86_64-apple-darwin
|
||||
sort=gsort # for `sort --sort-version`, from brew's coreutils.
|
||||
fi
|
||||
|
||||
# This fetches latest stable release
|
||||
local tag=$(git ls-remote --tags --refs --exit-code https://github.com/japaric/cross \
|
||||
| cut -d/ -f3 \
|
||||
| grep -E '^v[0-9.]+$' \
|
||||
| $sort --version-sort \
|
||||
| tail -n1)
|
||||
echo cross version: $tag
|
||||
curl -LSfs https://japaric.github.io/trust/install.sh | \
|
||||
sh -s -- \
|
||||
--force \
|
||||
--git japaric/cross \
|
||||
--tag $tag \
|
||||
--target $target
|
||||
}
|
||||
|
||||
main
|
||||
@@ -1,18 +0,0 @@
|
||||
# This script takes care of testing your crate
|
||||
|
||||
set -ex
|
||||
|
||||
main() {
|
||||
cross build --target $TARGET $EXTRA_ARGS
|
||||
|
||||
if [ ! -z $DISABLE_TESTS ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
cross test --target $TARGET $EXTRA_ARGS
|
||||
}
|
||||
|
||||
# we don't run the "test phase" when doing deploys
|
||||
if [ -z $TRAVIS_TAG ]; then
|
||||
main
|
||||
fi
|
||||
Reference in New Issue
Block a user