diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..89319318b --- /dev/null +++ b/.github/workflows/build.yml @@ -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 }} diff --git a/xtask/src/main.rs b/xtask/src/main.rs index 3f619dac2..631716074 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -165,6 +165,9 @@ fn main() -> Result<(), Box> { 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 { - ensure_compiler(&target)?; + ensure_compiler(&target, false)?; let stream = if debug { "debug" } else { "release" }; let mut args = vec!["build"]; print!("Building");