diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..f47c98f18 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,41 @@ +name: CI + +on: + pull_request: + push: + branches: + - master + +env: + RUST_BACKTRACE: 1 + RUSTFLAGS: "--deny=warnings" + +jobs: + build_and_test: + name: Rust ${{ matrix.rust }} on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + rust: [stable] + include: + - os: ubuntu-latest + rust: nightly + steps: + - uses: actions/checkout@v2 + - name: setup nightly + if: ${{ matrix.rust == 'nightly' }} + run: rustup default nightly + - name: check format + if: ${{ matrix.rust == 'stable' && matrix.os == 'ubuntu-latest' }} + run: cargo fmt --all -- --check + - name: check clippy + if: ${{ matrix.rust == 'stable' && matrix.os == 'ubuntu-latest' }} + run: cargo clippy --all --all-targets -- -D clippy::all && cargo clippy --no-default-features --features prost-codec -- -D clippy::all + - run: cargo test --all -- --nocapture + # Validate benches still work. + - run: cargo bench --all -- --test + # Because failpoints inject failure in code path, which will affect all concurrently running tests, Hence they need to be synchronized, which make tests slow. + - run: cargo test --tests --features failpoints -- --nocapture + # TODO: There is a bug in protobuf-build that cached size is not supported yet, so do not test harness. + - run: cargo test --no-default-features --features prost-codec -- --nocapture diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index e5545d846..000000000 --- a/.travis.yml +++ /dev/null @@ -1,44 +0,0 @@ -sudo: false - -language: rust -os: linux -rust: - - stable - - nightly - # Officially the oldest compiler we support. - - 1.44.0 -matrix: - include: - - os: windows - rust: stable - - os: osx - rust: stable -env: - global: - - RUST_BACKTRACE=1 - - RUSTFLAGS="-D warnings" - -# Inspired by https://levans.fr/rust_travis_cache.html -cache: - directories: - - /home/travis/.cargo -# But don't cache the cargo registry -before_cache: - - rm -rf /home/travis/.cargo/registry - - -install: - - if [[ $TRAVIS_RUST_VERSION == "stable" && $TRAVIS_OS_NAME == "linux" ]]; then rustup component add rustfmt; fi - - if [[ $TRAVIS_RUST_VERSION == "stable" && $TRAVIS_OS_NAME == "linux" ]]; then rustup component add clippy; fi - -script: - - if [[ $TRAVIS_RUST_VERSION == "stable" && $TRAVIS_OS_NAME == "linux" ]]; then cargo fmt --all -- --check; fi - - if [[ $TRAVIS_RUST_VERSION == "stable" && $TRAVIS_OS_NAME == "linux" ]]; then cargo clippy --all --all-targets -- -D clippy::all; fi - - if [[ $TRAVIS_RUST_VERSION == "stable" && $TRAVIS_OS_NAME == "linux" ]]; then cargo clippy --no-default-features --features prost-codec -- -D clippy::all; fi - - cargo test --all -- --nocapture - # Validate benches still work. - - cargo bench --all -- --test - # Because failpoints inject failure in code path, which will affect all concurrently running tests, Hence they need to be synchronized, which make tests slow. - - cargo test --tests --features failpoints -- --nocapture - # TODO: There is a bug in protobuf-build that cached size is not supported yet, so do not test harness. - - cargo test --no-default-features --features prost-codec -- --nocapture