Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optimize CI #8

Merged
merged 1 commit into from
Oct 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
197 changes: 177 additions & 20 deletions .github/workflows/0001-configure-test-flip-link-app-for-nrf52840.patch
Original file line number Diff line number Diff line change
@@ -1,44 +1,52 @@
From 63a78c5c32d4003bb21c7af03354015da04fabd7 Mon Sep 17 00:00:00 2001
From 72381a44fc7c64eb444f067131d4cd6c40be0a94 Mon Sep 17 00:00:00 2001
From: Lotte Steenbrink <lotte.steenbrink@ferrous-systems.com>
Date: Tue, 22 Sep 2020 15:32:45 +0200
Date: Mon, 28 Sep 2020 17:31:33 +0200
Subject: [PATCH] configure test-flip-link-app for nrf52840

---
.cargo/config.toml | 7 ++++---
Cargo.toml | 2 +-
src/lib.rs | 2 +-
3 files changed, 6 insertions(+), 5 deletions(-)
.cargo/config.toml | 4 ++--
Cargo.toml | 6 +++---
src/bin/bitfield.rs | 4 ++--
src/bin/format.rs | 4 ++--
src/bin/hello.rs | 4 ++--
src/bin/levels.rs | 4 ++--
src/bin/overflow.rs | 4 ++--
src/bin/panic.rs | 2 +-
src/lib.rs | 2 +-
testsuite/Cargo.toml | 4 ++--
testsuite/tests/test.rs | 4 ++--
11 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/.cargo/config.toml b/.cargo/config.toml
index a6fd2d5..44cf970 100644
index c549fd0..55c43eb 100644
--- a/.cargo/config.toml
+++ b/.cargo/config.toml
@@ -1,7 +1,8 @@
[target.'cfg(all(target_arch = "arm", target_os = "none"))']
# TODO(2) replace `$CHIP` with your chip's name (see `probe-run --list-chips` output)
-runner = "probe-run --chip $CHIP --defmt"
+runner = "probe-run --chip --chip nRF52840_xxAA --defmt"
rustflags = [
+ "-C", "linker=flip-link",
"-C", "link-arg=-Tlink.x",
"-C", "link-arg=-Tdefmt.x",
]
@@ -10,9 +11,9 @@ rustflags = [
@@ -11,9 +11,9 @@ rustflags = [
# TODO(3) Adjust the compilation target.
# (`thumbv6m-*` is compatible with all ARM Cortex-M chips but using the right
# target improves performance)
-target = "thumbv6m-none-eabi" # Cortex-M0 and Cortex-M0+
+# target = "thumbv6m-none-eabi" # Cortex-M0 and Cortex-M0+
+#target = "thumbv6m-none-eabi" # Cortex-M0 and Cortex-M0+
# target = "thumbv7m-none-eabi" # Cortex-M3
-# target = "thumbv7em-none-eabi" # Cortex-M4 and Cortex-M7 (no FPU)
+target = "thumbv7em-none-eabi" # Cortex-M4 and Cortex-M7 (no FPU)
# target = "thumbv7em-none-eabihf" # Cortex-M4F and Cortex-M7F (with FPU)

[alias]
diff --git a/Cargo.toml b/Cargo.toml
index ef9c14d..7df7789 100644
index d775330..96ab344 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
# TODO(1) fix `authors` and `name` if you didn't use `cargo-generate`
-authors = ["{{authors}}"]
-name = "{{project-name}}"
+authors = ["CI <do_not_email_me@ferrous-systems.com>"]
+name = "test-flip-link-app"
edition = "2018"
version = "0.1.0"

@@ -24,7 +24,7 @@ branch = "main"
cortex-m = "0.6.3"
cortex-m-rt = "0.6.12"
Expand All @@ -48,6 +56,116 @@ index ef9c14d..7df7789 100644

[features]
# set logging levels here
diff --git a/src/bin/bitfield.rs b/src/bin/bitfield.rs
index f82c2a2..7550972 100644
--- a/src/bin/bitfield.rs
+++ b/src/bin/bitfield.rs
@@ -1,7 +1,7 @@
#![no_main]
#![no_std]

-use {{crate_name}} as _; // global logger + panicking-behavior + memory layout
+use test_flip_link_app as _; // global logger + panicking-behavior + memory layout

#[cortex_m_rt::entry]
fn main() -> ! {
@@ -9,5 +9,5 @@ fn main() -> ! {
let frequency: u32 = 276;
defmt::debug!("FREQUENCY: {0:0..7}, MAP: {0:8..9}", frequency);

- {{crate_name}}::exit()
+ test_flip_link_app::exit()
}
diff --git a/src/bin/format.rs b/src/bin/format.rs
index aa8c35f..fbab6b7 100644
--- a/src/bin/format.rs
+++ b/src/bin/format.rs
@@ -1,7 +1,7 @@
#![no_main]
#![no_std]

-use {{crate_name}} as _; // global logger + panicking-behavior + memory layout
+use test_flip_link_app as _; // global logger + panicking-behavior + memory layout
use defmt::Format; // <- derive attribute

#[derive(Format)]
@@ -22,5 +22,5 @@ fn main() -> ! {
let x = 42;
defmt::info!("x={:u8}", x);

- {{crate_name}}::exit()
+ test_flip_link_app::exit()
}
diff --git a/src/bin/hello.rs b/src/bin/hello.rs
index 4a39f24..677e2f2 100644
--- a/src/bin/hello.rs
+++ b/src/bin/hello.rs
@@ -1,11 +1,11 @@
#![no_main]
#![no_std]

-use {{crate_name}} as _; // global logger + panicking-behavior + memory layout
+use test_flip_link_app as _; // global logger + panicking-behavior + memory layout

#[cortex_m_rt::entry]
fn main() -> ! {
defmt::info!("Hello, world!");

- {{crate_name}}::exit()
+ test_flip_link_app::exit()
}
diff --git a/src/bin/levels.rs b/src/bin/levels.rs
index a944130..4440455 100644
--- a/src/bin/levels.rs
+++ b/src/bin/levels.rs
@@ -1,7 +1,7 @@
#![no_main]
#![no_std]

-use {{crate_name}} as _; // global logger + panicking-behavior + memory layout
+use test_flip_link_app as _; // global logger + panicking-behavior + memory layout

#[cortex_m_rt::entry]
fn main() -> ! {
@@ -11,5 +11,5 @@ fn main() -> ! {
defmt::debug!("debug");
defmt::error!("error");

- {{crate_name}}::exit()
+ test_flip_link_app::exit()
}
diff --git a/src/bin/overflow.rs b/src/bin/overflow.rs
index 03c2a47..5f9721f 100644
--- a/src/bin/overflow.rs
+++ b/src/bin/overflow.rs
@@ -1,12 +1,12 @@
#![no_main]
#![no_std]

-use {{crate_name}} as _; // global logger + panicking-behavior + memory layout
+use test_flip_link_app as _; // global logger + panicking-behavior + memory layout

#[cortex_m_rt::entry]
fn main() -> ! {
ack(10, 10);
- {{crate_name}}::exit()
+ test_flip_link_app::exit()
}

fn ack(m: u32, n: u32) -> u32 {
diff --git a/src/bin/panic.rs b/src/bin/panic.rs
index efc755a..868aade 100644
--- a/src/bin/panic.rs
+++ b/src/bin/panic.rs
@@ -1,7 +1,7 @@
#![no_main]
#![no_std]

-use {{crate_name}} as _; // global logger + panicking-behavior + memory layout
+use test_flip_link_app as _; // global logger + panicking-behavior + memory layout

#[cortex_m_rt::entry]
fn main() -> ! {
diff --git a/src/lib.rs b/src/lib.rs
index 52eb1bc..3c46ef9 100644
--- a/src/lib.rs
Expand All @@ -61,6 +179,45 @@ index 52eb1bc..3c46ef9 100644

#[defmt::timestamp]
fn timestamp() -> u64 {
diff --git a/testsuite/Cargo.toml b/testsuite/Cargo.toml
index 270d245..36bb554 100644
--- a/testsuite/Cargo.toml
+++ b/testsuite/Cargo.toml
@@ -1,6 +1,6 @@
[package]
# TODO(1) fix `authors` if you didn't use `cargo-generate`
-authors = ["{{authors}}"]
+authors = ["CI <do_not_email_me@ferrous-systems.com>"]
name = "testsuite"
publish = false
edition = "2018"
@@ -25,7 +25,7 @@ branch = "main"
features = ["print-defmt"]

[dependencies]
-{{project-name}} = { path = ".." }
+test-flip-link-app = { path = ".." }
cortex-m = "0.6.3"
cortex-m-rt = "0.6.12"

diff --git a/testsuite/tests/test.rs b/testsuite/tests/test.rs
index 2e8ad89..8f25776 100644
--- a/testsuite/tests/test.rs
+++ b/testsuite/tests/test.rs
@@ -2,11 +2,11 @@
#![no_main]

use cortex_m_rt::entry;
-use {{crate_name}} as _; // memory layout + panic handler
+use test_flip_link_app as _; // memory layout + panic handler

#[entry]
fn main() -> ! {
assert!(false, "TODO: Write actual tests");

- {{crate_name}}::exit();
+ test_flip_link_app::exit();
}
--
2.25.1

49 changes: 31 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ on:
branches: [ main]
pull_request:
branches: [ main ]

schedule:
# runs 1 min after 2 or 1 AM (summer/winter) berlin time
- cron: '1 0 * * *'
env:
CARGO_TERM_COLOR: always
APPNAME : test-flip-link-app
REPO_NAME : flip-link
APP_NAME : test-flip-link-app
CORE_TARGET: thumbv7em-none-eabi # needed by `core`
NRF_TARGET: thumbv7em-none-eabihf

Expand All @@ -18,12 +21,11 @@ jobs:
matrix:
rust:
- stable
#- nightly
- nightly
os:
- ubuntu-latest
# FIXME: Reenable macOS, Windows, and nightly
#- macOS-latest
#- windows-latest
- macOS-latest
- windows-latest
runs-on: ${{ matrix.os }}
timeout-minutes: 10
steps:
Expand All @@ -38,21 +40,34 @@ jobs:
shell: bash
- name: Check fmt
if: matrix.os == 'ubuntu-latest' # we only need to check fmt on one OS
run: cargo fmt --all -- --check
# nightly doesn't come with rustfmt so make sure it is installed
run: |
rustup component add rustfmt
cargo fmt --all -- --check

build_app:
strategy:
matrix:
rust:
- stable
#- nightly
- nightly
os:
- ubuntu-latest
# FIXME: enable macOS, Windows, and nightly
- macOS-latest
- windows-latest
runs-on: ${{ matrix.os }}
timeout-minutes: 20
steps:
- uses: actions/checkout@v2
- name: Check out flip-link repo
uses: actions/checkout@v2
with:
path: ${{ env.REPO_NAME }}
# note: we're avoiding `cargo-generate` due to its long install time
- name: Check out app template
uses: actions/checkout@v2
with:
repository: knurling-rs/app-template
path: ${{ env.APP_NAME }}
- uses: actions-rs/toolchain@v1
with:
profile: minimal
Expand All @@ -61,16 +76,14 @@ jobs:
target: ${{ env.NRF_TARGET }}
- name: Install dependencies
run: |
sudo apt-get update && sudo apt-get install libssl-dev
rustup target add ${{ env.CORE_TARGET }}
cargo install cargo-generate
cargo install --debug --path .
- name: Generate and configure App
cargo install --debug --path ${{ env.REPO_NAME }}
shell: bash
- name: Configure App
run: |
cargo generate --git https://github.com/knurling-rs/app-template --branch main --name ${{ env.APPNAME }}
cd ${{ env.APPNAME }}
git apply ../.github/workflows/0001-configure-test-flip-link-app-for-nrf52840.patch
cd ${{ env.APP_NAME }}
git apply ../${{ env.REPO_NAME }}/.github/workflows/0001-configure-test-flip-link-app-for-nrf52840.patch
- name: Build App
run: |
cd ${{ env.APPNAME }}
cd ${{ env.APP_NAME }}
cargo build --bins