Skip to content

Commit 1ac1453

Browse files
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 <[email protected]>
2 parents 89832a7 + ce04905 commit 1ac1453

File tree

9 files changed

+111
-113
lines changed

9 files changed

+111
-113
lines changed

cortex-m-rt/.github/bors.toml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
11
block_labels = ["needs-decision"]
22
delete_merged_branches = true
33
required_approvals = 1
4-
status = ["continuous-integration/travis-ci/push"]
4+
status = [
5+
"ci-linux (stable, x86_64-unknown-linux-gnu)",
6+
"ci-linux (stable, thumbv6m-none-eabi)",
7+
"ci-linux (stable, thumbv7m-none-eabi)",
8+
"ci-linux (stable, thumbv7em-none-eabi)",
9+
"ci-linux (stable, thumbv7em-none-eabihf)",
10+
"ci-linux (stable, thumbv8m.main-none-eabi)",
11+
"ci-linux (1.39.0, x86_64-unknown-linux-gnu)",
12+
"ci-linux (1.39.0, thumbv6m-none-eabi)",
13+
"ci-linux (1.39.0, thumbv7m-none-eabi)",
14+
"ci-linux (1.39.0, thumbv7em-none-eabi)",
15+
"ci-linux (1.39.0, thumbv7em-none-eabihf)",
16+
"ci-linux (1.39.0, thumbv8m.main-none-eabi)",
17+
"Rustfmt"
18+
]

cortex-m-rt/.github/workflows/ci.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
on:
2+
push:
3+
branches: [ staging, trying, master ]
4+
pull_request:
5+
6+
name: Continuous integration
7+
8+
jobs:
9+
ci-linux:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
# All generated code should be running on stable now
14+
rust: [nightly, stable, 1.39.0]
15+
16+
# The default target we're compiling on and for
17+
TARGET: [x86_64-unknown-linux-gnu, thumbv6m-none-eabi, thumbv7m-none-eabi, thumbv7em-none-eabi, thumbv7em-none-eabihf, thumbv8m.main-none-eabi]
18+
19+
include:
20+
# Nightly is only for reference and allowed to fail
21+
- rust: nightly
22+
experimental: true
23+
24+
steps:
25+
- uses: fiam/arm-none-eabi-gcc@v1
26+
with:
27+
release: '7-2018-q2'
28+
- uses: actions/checkout@v2
29+
- uses: actions-rs/toolchain@v1
30+
with:
31+
profile: minimal
32+
toolchain: ${{ matrix.rust }}
33+
target: ${{ matrix.TARGET }}
34+
override: true
35+
components: rustfmt
36+
- name: Install qemu
37+
run: sudo apt-get install qemu-system-arm
38+
- name: Run CI script for ${{ matrix.TARGET }} under ${{ matrix.rust }}
39+
run: TARGET=${{ matrix.TARGET }} TRAVIS_RUST_VERSION=${{ matrix.rust }} bash ci/script.sh
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
on:
2+
push:
3+
branches: [ staging, trying, master ]
4+
pull_request:
5+
6+
name: Clippy check
7+
jobs:
8+
clippy_check:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
- uses: actions-rs/toolchain@v1
13+
with:
14+
profile: minimal
15+
toolchain: stable
16+
override: true
17+
components: clippy
18+
- uses: actions-rs/clippy-check@v1
19+
with:
20+
token: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
on:
2+
push:
3+
branches: [ staging, trying, master ]
4+
pull_request:
5+
6+
name: Code formatting check
7+
8+
jobs:
9+
fmt:
10+
name: Rustfmt
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
- uses: actions-rs/toolchain@v1
15+
with:
16+
profile: minimal
17+
toolchain: stable
18+
override: true
19+
components: rustfmt
20+
- uses: actions-rs/cargo@v1
21+
with:
22+
command: fmt
23+
args: --all -- --check

cortex-m-rt/.travis.yml

Lines changed: 0 additions & 83 deletions
This file was deleted.

cortex-m-rt/build.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ fn main() {
1313
fs::copy(
1414
format!("bin/{}.a", target),
1515
out_dir.join("libcortex-m-rt.a"),
16-
).unwrap();
16+
)
17+
.unwrap();
1718
println!("cargo:rustc-link-lib=static=cortex-m-rt");
1819
}
1920

@@ -34,7 +35,8 @@ fn main() {
3435
/* Provides weak aliases (cf. PROVIDED) for device specific interrupt handlers */
3536
/* This will usually be provided by a device crate generated using svd2rust (see `device.x`) */
3637
INCLUDE device.x"#
37-
).unwrap();
38+
)
39+
.unwrap();
3840
f
3941
} else {
4042
let mut f = File::create(out.join("link.x")).unwrap();
@@ -55,9 +57,9 @@ INCLUDE device.x"#
5557
println!("cargo:rustc-cfg=armv8m");
5658
240
5759
} else {
58-
// Non ARM target. We assume you're just testing the syntax.
59-
// This value seems as soon as any
60-
240
60+
// Non ARM target. We assume you're just testing the syntax.
61+
// This value seems as soon as any
62+
240
6163
};
6264

6365
// checking the size of the interrupts portion of the vector table is sub-architecture dependent
@@ -71,7 +73,8 @@ handlers.");
7173
"#,
7274
max_int_handlers * 4 + 0x40,
7375
max_int_handlers
74-
).unwrap();
76+
)
77+
.unwrap();
7578

7679
println!("cargo:rustc-link-search={}", out.display());
7780

cortex-m-rt/ci/install.sh

Lines changed: 0 additions & 19 deletions
This file was deleted.

cortex-m-rt/examples/data_overflow.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ use core::ptr;
1313
use rt::entry;
1414

1515
// This large static array uses most of .rodata
16-
static RODATA: [u8; 48*1024] = [1u8; 48*1024];
16+
static RODATA: [u8; 48 * 1024] = [1u8; 48 * 1024];
1717

1818
// This large mutable array causes .data to use the rest of FLASH
1919
// without also overflowing RAM.
20-
static mut DATA: [u8; 16*1024] = [1u8; 16*1024];
20+
static mut DATA: [u8; 16 * 1024] = [1u8; 16 * 1024];
2121

2222
#[entry]
2323
fn main() -> ! {

cortex-m-rt/tests/compiletest.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ fn run_mode(mode: &'static str) {
88
config.mode = mode.parse().expect("Invalid mode");
99
config.src_base = PathBuf::from(format!("tests/{}", mode));
1010
// config.link_deps(); // Populate config.target_rustcflags with dependencies on the path
11-
config.target_rustcflags =
12-
Some("-L target/debug -L target/debug/deps -C panic=abort --cfg feature=\"device\"".to_owned());
11+
config.target_rustcflags = Some(
12+
"-L target/debug -L target/debug/deps -C panic=abort --cfg feature=\"device\"".to_owned(),
13+
);
1314
// config.clean_rmeta(); // If your tests import the parent crate, this helps with E0464
1415

1516
compiletest::run_tests(&config);

0 commit comments

Comments
 (0)