From d53b65ca1bf7ad9a8da4f323930cbc7b502fbfe1 Mon Sep 17 00:00:00 2001 From: Mathias Koch Date: Fri, 11 Dec 2020 09:03:56 +0100 Subject: [PATCH 1/3] Remove existing travis CI, and replace it with the default REC github actions CI. Also remove the unnecessary requirement on nightly --- .github/workflows/ci.yml | 40 +++++++++++++++++++++++++++++ .github/workflows/clippy.yml | 20 +++++++++++++++ .github/workflows/rustfmt.yml | 23 +++++++++++++++++ .travis.yml | 47 ----------------------------------- ci/after_success.sh | 24 ------------------ ci/install.sh | 11 -------- ci/script.sh | 30 ---------------------- rust-toolchain | 2 +- 8 files changed, 84 insertions(+), 113 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..0194407cd --- /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.36.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..adc3a6ed1 --- /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: 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..9a55c0024 --- /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 f5a967776..000000000 --- a/.travis.yml +++ /dev/null @@ -1,47 +0,0 @@ -language: rust -rust: stable - -matrix: - include: - - env: TARGET=x86_64-unknown-linux-gnu - - # MSRV - - env: TARGET=x86_64-unknown-linux-gnu - rust: 1.31.0 - if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master) - - # no-std sanity check - - env: TARGET=thumbv7m-none-eabi - if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master) - - - env: TARGET=rustfmt - 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 db795674e..000000000 --- a/ci/after_success.sh +++ /dev/null @@ -1,24 +0,0 @@ -set -euxo pipefail - -main() { - if [ $TARGET = thumbv7m-none-eabi ]; then - return - fi - - cargo doc - - 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/doc - - set +x - git push -fq https://$GH_TOKEN@github.com/$TRAVIS_REPO_SLUG.git gh-pages && \ - echo OK -} - -if [ $TRAVIS_BRANCH = master ]; then - main -fi diff --git a/ci/install.sh b/ci/install.sh deleted file mode 100644 index e88d3ac61..000000000 --- a/ci/install.sh +++ /dev/null @@ -1,11 +0,0 @@ -set -euxo pipefail - -main() { - if [ $TARGET != rustfmt ]; then - rustup target add $TARGET - else - rustup component add rustfmt - fi -} - -main diff --git a/ci/script.sh b/ci/script.sh deleted file mode 100644 index 8d666e4ba..000000000 --- a/ci/script.sh +++ /dev/null @@ -1,30 +0,0 @@ -set -euxo pipefail - -main() { - if [ $TARGET = rustfmt ]; then - cargo fmt -- --check - return - fi - - cargo check --target $TARGET - - if [ $TARGET = x86_64-unknown-linux-gnu ]; then - cargo test --target $TARGET - cargo test --features custom-error-messages --target $TARGET - - return - fi -} - -# fake Travis variables to be able to run this on a local machine -if [ -z ${TRAVIS_BRANCH-} ]; then - TRAVIS_BRANCH=auto -fi - -if [ -z ${TARGET-} ]; then - TARGET=$(rustc -Vv | grep host | cut -d ' ' -f2) -fi - -if [ $TRAVIS_BRANCH != master ] || [ $TRAVIS_PULL_REQUEST != false ]; then - main -fi diff --git a/rust-toolchain b/rust-toolchain index bf867e0ae..2bf5ad044 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -nightly +stable From 7320da86027e6b66ce47b9f212ae2424e19505cf Mon Sep 17 00:00:00 2001 From: Mathias Koch Date: Fri, 11 Dec 2020 09:29:38 +0100 Subject: [PATCH 2/3] Update .github/workflows/ci.yml Co-authored-by: Diego Barrios Romero --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0194407cd..fd4939d02 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,5 +36,5 @@ jobs: override: true - uses: actions-rs/cargo@v1 with: - command: check + command: test args: --target=${{ matrix.TARGET }} From 992d1dbf4b614b57697371b804f86ab93305b27e Mon Sep 17 00:00:00 2001 From: Mathias Koch Date: Fri, 11 Dec 2020 09:29:44 +0100 Subject: [PATCH 3/3] Update .github/workflows/ci.yml Co-authored-by: Diego Barrios Romero --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fd4939d02..95a2233db 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,6 +5,9 @@ on: name: Continuous integration +env: + RUSTFLAGS: '--deny warnings' + jobs: ci-linux: runs-on: ubuntu-latest