From 1e512886c284bd4362b32aa39d8a22c6207e2e6b Mon Sep 17 00:00:00 2001 From: Daniel Egger Date: Tue, 2 Jun 2020 22:05:45 +0200 Subject: [PATCH 1/3] Switch from Travis to GitHub actions Signed-off-by: Daniel Egger --- .github/workflows/ci.yml | 40 +++++++++++++++++++++++++++ .github/workflows/clippy.yml | 17 ++++++++++++ .github/workflows/rustfmt.yml | 20 ++++++++++++++ .travis.yml | 51 ----------------------------------- ci/after_success.sh | 20 -------------- ci/install.sh | 10 ------- ci/script.sh | 12 --------- 7 files changed, 77 insertions(+), 93 deletions(-) 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 delete mode 100644 ci/after_success.sh delete mode 100644 ci/install.sh delete mode 100644 ci/script.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..2988cf209 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,40 @@ +on: + push: + branches: [ staging, trying, master ] + pull_request: + +name: Continuous integration + +jobs: + ci-linux: + 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, thumbv6m-none-eabi, thumbv7m-none-eabi] + + include: + # Test MSRV + - rust: 1.35.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 + - uses: actions-rs/cargo@v1 + with: + command: check + args: --target=${{ matrix.TARGET }} diff --git a/.github/workflows/clippy.yml b/.github/workflows/clippy.yml new file mode 100644 index 000000000..1818fafce --- /dev/null +++ b/.github/workflows/clippy.yml @@ -0,0 +1,17 @@ +on: [push, 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: stable + 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 000000000..8648da05d --- /dev/null +++ b/.github/workflows/rustfmt.yml @@ -0,0 +1,20 @@ +on: [push, 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 3961ae86e..000000000 --- a/.travis.yml +++ /dev/null @@ -1,51 +0,0 @@ -language: rust - -matrix: - include: - - env: TARGET=x86_64-unknown-linux-gnu - if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master) - - - env: TARGET=thumbv6m-none-eabi - rust: beta - if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master) - - - env: TARGET=thumbv7m-none-eabi - rust: beta - if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master) - - - env: TARGET=x86_64-unknown-linux-gnu - rust: nightly - if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master) - - # Minimum supported Rust version - - env: TARGET=x86_64-unknown-linux-gnu - rust: 1.35.0 - if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master) - -before_install: set -e - -install: - - bash ci/install.sh - -script: - - bash ci/script.sh - -after_script: set +e - -after_success: - - bash ci/after_success.sh - -cache: cargo -before_cache: - # Travis can't cache files that are not readable by "others" - - chmod -R a+r $HOME/.cargo - -branches: - only: - - master - - staging - - trying - -notifications: - email: - on_success: never diff --git a/ci/after_success.sh b/ci/after_success.sh deleted file mode 100644 index c44255907..000000000 --- a/ci/after_success.sh +++ /dev/null @@ -1,20 +0,0 @@ -set -euxo pipefail - -main() { - cargo doc --target $TARGET - - mkdir ghp-import - - curl -Ls https://github.com/davisp/ghp-import/archive/master.tar.gz | \ - tar --strip-components 1 -C ghp-import -xz - - ./ghp-import/ghp_import.py target/$TARGET/doc - - set +x - git push -fq https://$GH_TOKEN@github.com/$TRAVIS_REPO_SLUG.git gh-pages && \ - echo OK -} - -if [ "$TRAVIS_EVENT_TYPE" == "push" ] && [ "$TRAVIS_BRANCH" == "master" ]; then - main -fi diff --git a/ci/install.sh b/ci/install.sh deleted file mode 100644 index 1243fd15d..000000000 --- a/ci/install.sh +++ /dev/null @@ -1,10 +0,0 @@ -set -euxo pipefail - -main() { - if [ $TARGET != x86_64-unknown-linux-gnu ]; then - rustup target add $TARGET - fi - rustup component add rustfmt -} - -main diff --git a/ci/script.sh b/ci/script.sh deleted file mode 100644 index 600263659..000000000 --- a/ci/script.sh +++ /dev/null @@ -1,12 +0,0 @@ -set -euxo pipefail - -main() { - cargo check --target $TARGET - cargo fmt -- --check - - if [ $TRAVIS_RUST_VERSION = nightly ]; then - cargo test --target $TARGET - fi -} - -main From 63b5e3886dbc57b18928b12e7654ff2379d62987 Mon Sep 17 00:00:00 2001 From: Daniel Egger Date: Tue, 2 Jun 2020 22:12:37 +0200 Subject: [PATCH 2/3] Add adjusted bors configuration Signed-off-by: Daniel Egger --- .github/bors.toml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/bors.toml b/.github/bors.toml index ca42be0a5..b77072d8f 100644 --- a/.github/bors.toml +++ b/.github/bors.toml @@ -1,4 +1,9 @@ block_labels = ["needs-decision"] delete_merged_branches = true required_approvals = 1 -status = ["continuous-integration/travis-ci/push"] +status = [ + "ci-linux (stable, x86_64-unknown-linux-gnu)", + "ci-linux (stable, thumbv6m-none-eabi)", + "ci-linux (stable, thumbv7m-none-eabi)", + "ci-linux (1.35.0, x86_64-unknown-linux-gnu)", +] From 33e16f1ed90a0056dd07b07143585ff50f0a25f2 Mon Sep 17 00:00:00 2001 From: Daniel Egger Date: Tue, 2 Jun 2020 22:25:32 +0200 Subject: [PATCH 3/3] Don't run rustfmt and clippy multiple times per PR Signed-off-by: Daniel Egger --- .github/workflows/clippy.yml | 5 ++++- .github/workflows/rustfmt.yml | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/clippy.yml b/.github/workflows/clippy.yml index 1818fafce..adc3a6ed1 100644 --- a/.github/workflows/clippy.yml +++ b/.github/workflows/clippy.yml @@ -1,4 +1,7 @@ -on: [push, pull_request] +on: + push: + branches: [ staging, trying, master ] + pull_request: name: Clippy check jobs: diff --git a/.github/workflows/rustfmt.yml b/.github/workflows/rustfmt.yml index 8648da05d..9a55c0024 100644 --- a/.github/workflows/rustfmt.yml +++ b/.github/workflows/rustfmt.yml @@ -1,4 +1,7 @@ -on: [push, pull_request] +on: + push: + branches: [ staging, trying, master ] + pull_request: name: Code formatting check