mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-15 08:30:02 +00:00
compile for hosted and real hardware on main push
This commit is contained in:
parent
af2d7e9099
commit
cbd412a461
2 changed files with 47 additions and 2 deletions
37
.github/workflows/build.yml
vendored
Normal file
37
.github/workflows/build.yml
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
name: Build xous-core
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Setup Rust
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
task: ["hosted-ci", "renode-image"]
|
||||
steps:
|
||||
- name: Install Ubuntu dependencies
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install -y libxkbcommon-dev
|
||||
|
||||
- name: Install stable toolchain
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: "1.59.0"
|
||||
default: true
|
||||
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- uses: Swatinem/rust-cache@v1
|
||||
|
||||
- name: Install RISC-V toolkit
|
||||
run: cargo xtask install-toolkit
|
||||
|
||||
- name: Build hosted-ci
|
||||
run: cargo xtask ${{ matrix.task }}
|
||||
|
|
@ -165,6 +165,9 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
let lkey = args.nth(3);
|
||||
let kkey = args.nth(4);
|
||||
match task.as_deref() {
|
||||
Some("install-toolkit") => {
|
||||
ensure_compiler(&Some(PROGRAM_TARGET), true)?
|
||||
}
|
||||
Some("renode-image") => {
|
||||
let mut args = env::args();
|
||||
args.nth(1);
|
||||
|
|
@ -602,6 +605,7 @@ Various debug configurations:
|
|||
pddb-ci PDDB config for CI testing (eg: TRNG->deterministic for reproducible errors)
|
||||
ffi-test builds an image for testing C-FFI bindings and integration
|
||||
tts builds an image with text to speech support via externally linked C executable
|
||||
install-toolkit installs Xous toolkit with no prompt, useful in CI
|
||||
"
|
||||
)
|
||||
}
|
||||
|
|
@ -1015,7 +1019,7 @@ static DONE_COMPILER_CHECK: std::sync::atomic::AtomicBool =
|
|||
/// Ensure we have a compatible compiler toolchain. We use a new Target,
|
||||
/// and we want to give the user a friendly way of installing the latest
|
||||
/// Rust toolchain.
|
||||
fn ensure_compiler(target: &Option<&str>) -> Result<(), String> {
|
||||
fn ensure_compiler(target: &Option<&str>, force_install: bool) -> Result<(), String> {
|
||||
use std::process::Stdio;
|
||||
if DONE_COMPILER_CHECK.load(std::sync::atomic::Ordering::SeqCst) {
|
||||
return Ok(());
|
||||
|
|
@ -1108,6 +1112,10 @@ fn ensure_compiler(target: &Option<&str>) -> Result<(), String> {
|
|||
target
|
||||
);
|
||||
loop {
|
||||
if force_install {
|
||||
break;
|
||||
}
|
||||
|
||||
print!("Would you like this program to attempt to download and install it? [Y/n] ");
|
||||
stdout.flush().unwrap();
|
||||
buffer.clear();
|
||||
|
|
@ -1251,7 +1259,7 @@ fn build(
|
|||
extra_args: Option<&[&str]>,
|
||||
features: Option<&[&str]>,
|
||||
) -> Result<PathBuf, DynError> {
|
||||
ensure_compiler(&target)?;
|
||||
ensure_compiler(&target, false)?;
|
||||
let stream = if debug { "debug" } else { "release" };
|
||||
let mut args = vec!["build"];
|
||||
print!("Building");
|
||||
|
|
|
|||
Loading…
Reference in a new issue