From 36954a613fd1333a921db8ba3b61d4152cd54116 Mon Sep 17 00:00:00 2001 From: Diego Barrios Romero Date: Thu, 16 Sep 2021 20:13:14 +0200 Subject: [PATCH] Use GHA instead of Travis for CI --- .github/CODEOWNERS | 1 + .github/bors.toml | 10 +++++ .github/workflows/ci.yml | 80 +++++++++++++++++++++++++++++++++++ .github/workflows/clippy.yml | 20 +++++++++ .github/workflows/rustfmt.yml | 23 ++++++++++ .travis.yml | 18 -------- README.md | 2 +- 7 files changed, 135 insertions(+), 19 deletions(-) create mode 100644 .github/CODEOWNERS create mode 100644 .github/bors.toml create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/clippy.yml create mode 100644 .github/workflows/rustfmt.yml delete mode 100644 .travis.yml diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 00000000..3024413f --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @rust-embedded/embedded-linux diff --git a/.github/bors.toml b/.github/bors.toml new file mode 100644 index 00000000..c11fc3bd --- /dev/null +++ b/.github/bors.toml @@ -0,0 +1,10 @@ +block_labels = ["needs-decision"] +delete_merged_branches = true +required_approvals = 1 +status = [ + "CI (stable, x86_64-unknown-linux-gnu)", + "CI (stable, armv7-unknown-linux-gnueabihf)", + "CI (1.46.0, x86_64-unknown-linux-gnu)", + "CI (stable, x86_64-apple-darwin)", + "CI (1.46.0, x86_64-apple-darwin)", +] diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..85f41199 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,80 @@ +on: + push: + branches: [ staging, trying, master ] + pull_request: + +name: Continuous integration + +jobs: + ci-linux: + name: CI + runs-on: ubuntu-latest + + strategy: + matrix: + # All generated code should be running on stable now + rust: [stable] + + # The default target we're compiling on and for + TARGET: [x86_64-unknown-linux-gnu, armv7-unknown-linux-gnueabihf] + + include: + # Test MSRV + - rust: 1.46.0 + TARGET: x86_64-unknown-linux-gnu + + # Test nightly but don't fail + - rust: nightly + experimental: true + TARGET: x86_64-unknown-linux-gnu + + steps: + - uses: actions/checkout@v2 + + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: ${{ matrix.rust }} + target: ${{ matrix.TARGET }} + override: true + + - name: Install armv7 libraries + if: ${{ matrix.TARGET == 'armv7-unknown-linux-gnueabihf' }} + run: sudo apt-get install -y libc6-armhf-cross libc6-dev-armhf-cross gcc-arm-linux-gnueabihf + + - uses: actions-rs/cargo@v1 + if: ${{ matrix.TARGET != 'armv7-unknown-linux-gnueabihf' }} + with: + command: test + args: --target=${{ matrix.TARGET }} + + + - uses: actions-rs/cargo@v1 + if: ${{ matrix.TARGET == 'armv7-unknown-linux-gnueabihf' }} + with: + command: build + args: --target=${{ matrix.TARGET }} + + ci-macos: + name: CI-macOS + runs-on: macos-11 + + strategy: + matrix: + rust: [stable, 1.46.0] + TARGET: [x86_64-apple-darwin] + + steps: + - uses: actions/checkout@v2 + + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: ${{ matrix.rust }} + target: ${{ matrix.TARGET }} + override: true + + - uses: actions-rs/cargo@v1 + with: + command: build + args: --target=${{ matrix.TARGET }} diff --git a/.github/workflows/clippy.yml b/.github/workflows/clippy.yml new file mode 100644 index 00000000..72d9a109 --- /dev/null +++ b/.github/workflows/clippy.yml @@ -0,0 +1,20 @@ +on: + push: + branches: [ staging, trying, master ] + pull_request: + +name: Clippy check +jobs: + clippy_check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: 1.55.0 + override: true + components: clippy + - uses: actions-rs/clippy-check@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/rustfmt.yml b/.github/workflows/rustfmt.yml new file mode 100644 index 00000000..9a55c002 --- /dev/null +++ b/.github/workflows/rustfmt.yml @@ -0,0 +1,23 @@ +on: + push: + branches: [ staging, trying, master ] + pull_request: + +name: Code formatting check + +jobs: + fmt: + name: Rustfmt + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + components: rustfmt + - uses: actions-rs/cargo@v1 + with: + command: fmt + args: --all -- --check diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index d963eb2f..00000000 --- a/.travis.yml +++ /dev/null @@ -1,18 +0,0 @@ -language: rust -sudo: false - -os: - - linux - - osx - -rust: - - nightly - - stable - # MSRV - - 1.32.0 - -script: - - rustup component add rustfmt - - cargo build --verbose - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then cargo test --verbose; fi - - cargo fmt -- --check diff --git a/README.md b/README.md index 3d6fc1af..9ca65c3a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Rust I2cdev -[![Build Status](https://travis-ci.org/rust-embedded/rust-i2cdev.svg?branch=master)](https://travis-ci.org/rust-embedded/rust-i2cdev) +[![Build Status](https://github.com/rust-embedded/rust-i2cdev/workflows/CI/badge.svg)](https://github.com/rust-embedded/rust-i2cdev/actions) [![Version](https://img.shields.io/crates/v/i2cdev.svg)](https://crates.io/crates/i2cdev) [![License](https://img.shields.io/crates/l/i2cdev.svg)](https://github.com/rust-embedded/rust-i2cdev/blob/master/README.md#license)