diff options
author | 2020-07-21 14:10:50 +0000 | |
---|---|---|
committer | 2020-07-21 14:10:50 +0000 | |
commit | 1ac145307c2d3a7668660108bc80484f4c0463ff (patch) | |
tree | 36790471bea81835117034b071bbe65a00338a3d | |
parent | 89832a7e1d467e75ac6093fe9560fd1dec65c51f (diff) | |
parent | ce049059f5b7e1b396f9d73eb069356f654a1789 (diff) | |
download | cortex-m-1ac145307c2d3a7668660108bc80484f4c0463ff.tar.gz cortex-m-1ac145307c2d3a7668660108bc80484f4c0463ff.tar.zst cortex-m-1ac145307c2d3a7668660108bc80484f4c0463ff.zip |
Merge #270
270: Add GitHub actions for CI r=adamgreig a=therealprof
This changes CI from Travis CI to GHA which should not only vastly simplify the maintenance (by getting rid of pulling custom binaries from japaric's repository) but also speeds up the CI process and adds rustfmt as well as clippy checks for good measure.
There's still room for optimisation but this has taken me long enough and plenty of sweat to get to this stage so my recommendation would be to merge it.
Co-authored-by: Daniel Egger <daniel@eggers-club.de>
-rw-r--r-- | cortex-m-rt/.github/bors.toml | 16 | ||||
-rw-r--r-- | cortex-m-rt/.github/workflows/ci.yml | 39 | ||||
-rw-r--r-- | cortex-m-rt/.github/workflows/clippy.yml | 20 | ||||
-rw-r--r-- | cortex-m-rt/.github/workflows/rustfmt.yml | 23 | ||||
-rw-r--r-- | cortex-m-rt/.travis.yml | 83 | ||||
-rw-r--r-- | cortex-m-rt/build.rs | 15 | ||||
-rwxr-xr-x | cortex-m-rt/ci/install.sh | 19 | ||||
-rw-r--r-- | cortex-m-rt/examples/data_overflow.rs | 4 | ||||
-rw-r--r-- | cortex-m-rt/tests/compiletest.rs | 5 |
9 files changed, 111 insertions, 113 deletions
diff --git a/cortex-m-rt/.github/bors.toml b/cortex-m-rt/.github/bors.toml index ca42be0..1972ab0 100644 --- a/cortex-m-rt/.github/bors.toml +++ b/cortex-m-rt/.github/bors.toml @@ -1,4 +1,18 @@ 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 (stable, thumbv7em-none-eabi)", + "ci-linux (stable, thumbv7em-none-eabihf)", + "ci-linux (stable, thumbv8m.main-none-eabi)", + "ci-linux (1.39.0, x86_64-unknown-linux-gnu)", + "ci-linux (1.39.0, thumbv6m-none-eabi)", + "ci-linux (1.39.0, thumbv7m-none-eabi)", + "ci-linux (1.39.0, thumbv7em-none-eabi)", + "ci-linux (1.39.0, thumbv7em-none-eabihf)", + "ci-linux (1.39.0, thumbv8m.main-none-eabi)", + "Rustfmt" +] diff --git a/cortex-m-rt/.github/workflows/ci.yml b/cortex-m-rt/.github/workflows/ci.yml new file mode 100644 index 0000000..6905827 --- /dev/null +++ b/cortex-m-rt/.github/workflows/ci.yml @@ -0,0 +1,39 @@ +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: [nightly, stable, 1.39.0] + + # The default target we're compiling on and for + TARGET: [x86_64-unknown-linux-gnu, thumbv6m-none-eabi, thumbv7m-none-eabi, thumbv7em-none-eabi, thumbv7em-none-eabihf, thumbv8m.main-none-eabi] + + include: + # Nightly is only for reference and allowed to fail + - rust: nightly + experimental: true + + steps: + - uses: fiam/arm-none-eabi-gcc@v1 + with: + release: '7-2018-q2' + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: ${{ matrix.rust }} + target: ${{ matrix.TARGET }} + override: true + components: rustfmt + - name: Install qemu + run: sudo apt-get install qemu-system-arm + - name: Run CI script for ${{ matrix.TARGET }} under ${{ matrix.rust }} + run: TARGET=${{ matrix.TARGET }} TRAVIS_RUST_VERSION=${{ matrix.rust }} bash ci/script.sh diff --git a/cortex-m-rt/.github/workflows/clippy.yml b/cortex-m-rt/.github/workflows/clippy.yml new file mode 100644 index 0000000..adc3a6e --- /dev/null +++ b/cortex-m-rt/.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/cortex-m-rt/.github/workflows/rustfmt.yml b/cortex-m-rt/.github/workflows/rustfmt.yml new file mode 100644 index 0000000..9a55c00 --- /dev/null +++ b/cortex-m-rt/.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/cortex-m-rt/.travis.yml b/cortex-m-rt/.travis.yml deleted file mode 100644 index 4043e4a..0000000 --- a/cortex-m-rt/.travis.yml +++ /dev/null @@ -1,83 +0,0 @@ -language: rust - -matrix: - allow_failures: - - rust: nightly - include: - # MSRV 1.39.0 ############################################################# - - env: TARGET=x86_64-unknown-linux-gnu - rust: 1.39.0 - - - env: TARGET=thumbv6m-none-eabi - rust: 1.39.0 - - - env: TARGET=thumbv7m-none-eabi - rust: 1.39.0 - - - env: TARGET=thumbv7em-none-eabi - rust: 1.39.0 - - - env: TARGET=thumbv7em-none-eabihf - rust: 1.39.0 - - - env: TARGET=thumbv8m.main-none-eabi - rust: 1.39.0 - - # Stable ################################################################## - - env: TARGET=x86_64-unknown-linux-gnu - rust: stable - - - env: TARGET=thumbv6m-none-eabi - rust: stable - - - env: TARGET=thumbv7m-none-eabi - rust: stable - - - env: TARGET=thumbv7em-none-eabi - rust: stable - - - env: TARGET=thumbv7em-none-eabihf - rust: stable - - - env: TARGET=thumbv8m.main-none-eabi - rust: stable - - # Nightly ################################################################# - - env: TARGET=x86_64-unknown-linux-gnu - rust: nightly - - - env: TARGET=thumbv6m-none-eabi - rust: nightly - - - env: TARGET=thumbv7m-none-eabi - rust: nightly - - - env: TARGET=thumbv7em-none-eabi - rust: nightly - - - env: TARGET=thumbv7em-none-eabihf - rust: nightly - - - env: TARGET=thumbv8m.main-none-eabi - rust: nightly - -before_install: set -e - -install: - - bash ci/install.sh - - export PATH="$PATH:$PWD/gcc/bin:$PWD/qemu" - -script: - - bash ci/script.sh - -after_script: set +e - -branches: - only: - - master - - staging - - trying - -notifications: - email: - on_success: never diff --git a/cortex-m-rt/build.rs b/cortex-m-rt/build.rs index 87f000a..67cdfab 100644 --- a/cortex-m-rt/build.rs +++ b/cortex-m-rt/build.rs @@ -13,7 +13,8 @@ fn main() { fs::copy( format!("bin/{}.a", target), out_dir.join("libcortex-m-rt.a"), - ).unwrap(); + ) + .unwrap(); println!("cargo:rustc-link-lib=static=cortex-m-rt"); } @@ -34,7 +35,8 @@ fn main() { /* Provides weak aliases (cf. PROVIDED) for device specific interrupt handlers */ /* This will usually be provided by a device crate generated using svd2rust (see `device.x`) */ INCLUDE device.x"# - ).unwrap(); + ) + .unwrap(); f } else { let mut f = File::create(out.join("link.x")).unwrap(); @@ -55,9 +57,9 @@ INCLUDE device.x"# println!("cargo:rustc-cfg=armv8m"); 240 } else { - // Non ARM target. We assume you're just testing the syntax. - // This value seems as soon as any - 240 + // Non ARM target. We assume you're just testing the syntax. + // This value seems as soon as any + 240 }; // checking the size of the interrupts portion of the vector table is sub-architecture dependent @@ -71,7 +73,8 @@ handlers."); "#, max_int_handlers * 4 + 0x40, max_int_handlers - ).unwrap(); + ) + .unwrap(); println!("cargo:rustc-link-search={}", out.display()); diff --git a/cortex-m-rt/ci/install.sh b/cortex-m-rt/ci/install.sh deleted file mode 100755 index 2086800..0000000 --- a/cortex-m-rt/ci/install.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env bash - -set -euxo pipefail - -main() { - if [ "$TARGET" != x86_64-unknown-linux-gnu ]; then - rustup target add "$TARGET" - fi - - mkdir gcc - - curl -L https://developer.arm.com/-/media/Files/downloads/gnu-rm/7-2018q2/gcc-arm-none-eabi-7-2018-q2-update-linux.tar.bz2?revision=bc2c96c0-14b5-4bb4-9f18-bceb4050fee7?product=GNU%20Arm%20Embedded%20Toolchain,64-bit,,Linux,7-2018-q2-update | tar --strip-components=1 -C gcc -xj - - mkdir qemu - curl -L https://github.com/japaric/qemu-bin/raw/master/14.04/qemu-system-arm-2.12.0 > qemu/qemu-system-arm - chmod +x qemu/qemu-system-arm -} - -main diff --git a/cortex-m-rt/examples/data_overflow.rs b/cortex-m-rt/examples/data_overflow.rs index ea48b23..a84ec12 100644 --- a/cortex-m-rt/examples/data_overflow.rs +++ b/cortex-m-rt/examples/data_overflow.rs @@ -13,11 +13,11 @@ use core::ptr; use rt::entry; // This large static array uses most of .rodata -static RODATA: [u8; 48*1024] = [1u8; 48*1024]; +static RODATA: [u8; 48 * 1024] = [1u8; 48 * 1024]; // This large mutable array causes .data to use the rest of FLASH // without also overflowing RAM. -static mut DATA: [u8; 16*1024] = [1u8; 16*1024]; +static mut DATA: [u8; 16 * 1024] = [1u8; 16 * 1024]; #[entry] fn main() -> ! { diff --git a/cortex-m-rt/tests/compiletest.rs b/cortex-m-rt/tests/compiletest.rs index 82dda07..ba2ef73 100644 --- a/cortex-m-rt/tests/compiletest.rs +++ b/cortex-m-rt/tests/compiletest.rs @@ -8,8 +8,9 @@ fn run_mode(mode: &'static str) { config.mode = mode.parse().expect("Invalid mode"); config.src_base = PathBuf::from(format!("tests/{}", mode)); // config.link_deps(); // Populate config.target_rustcflags with dependencies on the path - config.target_rustcflags = - Some("-L target/debug -L target/debug/deps -C panic=abort --cfg feature=\"device\"".to_owned()); + config.target_rustcflags = Some( + "-L target/debug -L target/debug/deps -C panic=abort --cfg feature=\"device\"".to_owned(), + ); // config.clean_rmeta(); // If your tests import the parent crate, this helps with E0464 compiletest::run_tests(&config); |