diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml new file mode 100644 index 00000000..77fd2683 --- /dev/null +++ b/.github/workflows/rust.yml @@ -0,0 +1,53 @@ +name: CI + +on: [push, pull_request] + +jobs: + windows: + runs-on: windows-latest + steps: + - uses: actions/checkout@v2 + - run: ci/set_rust_version.bash ${{ matrix.channel }} ${{ matrix.target }} + shell: bash + - run: ci/build.bash cargo ${{ matrix.target }} + shell: bash + - run: ci/test.bash cargo ${{ matrix.target }} + shell: bash + + strategy: + fail-fast: false + matrix: + channel: [stable] + target: + - x86_64-pc-windows-msvc + - x86_64-pc-windows-gnu + + macos: + runs-on: macos-latest + steps: + - uses: actions/checkout@v2 + - run: ci/set_rust_version.bash ${{ matrix.channel }} ${{ matrix.target }} + - run: ci/build.bash cargo ${{ matrix.target }} + - run: ci/test.bash cargo ${{ matrix.target }} + + strategy: + fail-fast: false + matrix: + channel: [stable] + target: + - x86_64-apple-darwin + + linux: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: ci/set_rust_version.bash ${{ matrix.channel }} ${{ matrix.target }} + - run: ci/build.bash cargo ${{ matrix.target }} + - run: ci/test.bash cargo ${{ matrix.target }} + + strategy: + fail-fast: false + matrix: + channel: [stable] + target: + - x86_64-unknown-linux-gnu diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 89190a67..00000000 --- a/.travis.yml +++ /dev/null @@ -1,19 +0,0 @@ -language: rust -matrix: - fast_finish: true - include: - - os: linux - - rust: stable - -sudo: false -dist: bionic - -cache: - apt: true - directories: - - target/debug/deps - - target/debug/build - -script: - - cargo build --all - - cargo test --all diff --git a/ci/build.bash b/ci/build.bash new file mode 100755 index 00000000..c323a3e8 --- /dev/null +++ b/ci/build.bash @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +# Script for building your rust projects. +set -e + +source ci/common.bash + +# $1 {path} = Path to cross/cargo executable +CROSS=$1 +# $2 {string} = +TARGET_TRIPLE=$2 +# $3 {boolean} = Whether or not building for release or not. +RELEASE_BUILD=$3 + +required_arg $CROSS 'CROSS' +required_arg $TARGET_TRIPLE '' + +if [ -z "$RELEASE_BUILD" ]; then + $CROSS build --target $TARGET_TRIPLE --workspace + $CROSS build --target $TARGET_TRIPLE --all-features --workspace +else + $CROSS build --target $TARGET_TRIPLE --all-features --release --workspace +fi + diff --git a/ci/common.bash b/ci/common.bash new file mode 100644 index 00000000..6b0a21a3 --- /dev/null +++ b/ci/common.bash @@ -0,0 +1,6 @@ +required_arg() { + if [ -z "$1" ]; then + echo "Required argument $2 missing" + exit 1 + fi +} diff --git a/ci/set_rust_version.bash b/ci/set_rust_version.bash new file mode 100755 index 00000000..6c013506 --- /dev/null +++ b/ci/set_rust_version.bash @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +set -e +rustup update +rustup default $1 +rustup target add $2 diff --git a/ci/test.bash b/ci/test.bash new file mode 100755 index 00000000..fb12d7c0 --- /dev/null +++ b/ci/test.bash @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +# Script for building your rust projects. +set -e + +source ci/common.bash + +# $1 {path} = Path to cross/cargo executable +CROSS=$1 +# $2 {string} = +TARGET_TRIPLE=$2 + +required_arg $CROSS 'CROSS' +required_arg $TARGET_TRIPLE '' + +$CROSS test --target $TARGET_TRIPLE --workspace +$CROSS build --target $TARGET_TRIPLE --all-features --workspace diff --git a/ipp/Cargo.toml b/ipp/Cargo.toml index aeabaece..08fff744 100644 --- a/ipp/Cargo.toml +++ b/ipp/Cargo.toml @@ -19,7 +19,7 @@ enum-primitive-derive = "0.3" futures-executor = { version = "0.3", optional = true } log = "0.4" num-traits = "0.2" -bytes = "1" +bytes = { version = "1", features = ["serde"] } thiserror = "1" http = "1" serde = { version = "1", optional = true, features = ["derive"] }