From e3277a1e3cfb8873cd9b8fb5a13751bddb5b85f2 Mon Sep 17 00:00:00 2001 From: Ian Chamberlain Date: Sun, 8 Jan 2023 20:16:08 -0500 Subject: [PATCH] Minor CI fixups - Add a helper for local testing with https://github.com/nektos/act - Don't deny clippy warnings, they can change too easily and break CI - Add minimum rust version just for completeness' sake --- .github/workflows/ci.yml | 14 +++++++++++--- ctru-rs/Cargo.toml | 1 + ctru-rs/src/test_runner.rs | 26 +++++--------------------- ctru-sys/build.rs | 2 +- 4 files changed, 18 insertions(+), 25 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5293618..8ccd74a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,6 +27,13 @@ jobs: runs-on: ubuntu-latest container: devkitpro/devkitarm steps: + # https://github.com/nektos/act/issues/917#issuecomment-1074421318 + - if: ${{ env.ACT }} + name: Hack container for local development + run: | + curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash - + sudo apt-get install -y nodejs + - name: Checkout branch uses: actions/checkout@v2 @@ -56,9 +63,10 @@ jobs: - name: Cargo check run: cargo 3ds clippy --color=always --workspace --verbose --all-targets - env: - RUSTFLAGS: - --deny=warnings + # --deny=warnings would be nice, but can easily break CI for new clippy + # lints getting added. I'd also like to use Github's "inline warnings" + # feature, but https://github.com/actions/runner/issues/2341 means we + # can't have both that *and* colored output. # TODO: it would be nice to actually build 3dsx for examples/tests, etc. # and run it somehow, but exactly how remains to be seen. diff --git a/ctru-rs/Cargo.toml b/ctru-rs/Cargo.toml index e1372e0..f824d6d 100644 --- a/ctru-rs/Cargo.toml +++ b/ctru-rs/Cargo.toml @@ -5,6 +5,7 @@ license = "https://en.wikipedia.org/wiki/Zlib_License" name = "ctru-rs" version = "0.7.1" edition = "2021" +rust-version = "1.64" [lib] crate-type = ["rlib"] diff --git a/ctru-rs/src/test_runner.rs b/ctru-rs/src/test_runner.rs index ab4c60f..ebec899 100644 --- a/ctru-rs/src/test_runner.rs +++ b/ctru-rs/src/test_runner.rs @@ -4,7 +4,7 @@ extern crate test; use std::io; -use test::{ColorConfig, Options, OutputFormat, RunIgnored, TestDescAndFn, TestFn, TestOpts}; +use test::{ColorConfig, OutputFormat, TestDescAndFn, TestFn, TestOpts}; use crate::console::Console; use crate::gfx::Gfx; @@ -25,34 +25,18 @@ pub(crate) fn run(tests: &[&TestDescAndFn]) { top_screen.set_wide_mode(true); let _console = Console::init(top_screen); - // TODO: it would be nice to have a way of specifying argv to make these - // configurable at runtime, but I can't figure out how to do it easily, - // so for now, just hardcode everything. let opts = TestOpts { - list: false, - filters: Vec::new(), - filter_exact: false, - // Forking is not supported force_run_in_process: true, - exclude_should_panic: false, - run_ignored: RunIgnored::No, run_tests: true, - // Don't run benchmarks. We may want to create a separate runner for them in the future - bench_benchmarks: false, - logfile: None, - nocapture: false, // TODO: color doesn't work because of TERM/TERMINFO. // With RomFS we might be able to fake this out nicely... color: ColorConfig::AutoColor, format: OutputFormat::Pretty, - shuffle: false, - shuffle_seed: None, - test_threads: None, - skip: Vec::new(), - time_options: None, - options: Options::new(), + // Hopefully this interface is more stable vs specifying individual options, + // and parsing the empty list of args should always work, I think. + // TODO Ideally we could pass actual std::env::args() here too + ..test::test::parse_opts(&[]).unwrap().unwrap() }; - // Use the default test implementation with our hardcoded options let _success = run_static_tests(&opts, tests).unwrap(); diff --git a/ctru-sys/build.rs b/ctru-sys/build.rs index c31c56b..90d97e6 100644 --- a/ctru-sys/build.rs +++ b/ctru-sys/build.rs @@ -6,7 +6,7 @@ fn main() { println!("cargo:rerun-if-changed=build.rs"); println!("cargo:rerun-if-env-changed=DEVKITPRO"); - println!("cargo:rustc-link-search=native={}/libctru/lib", dkp_path); + println!("cargo:rustc-link-search=native={dkp_path}/libctru/lib"); println!( "cargo:rustc-link-lib=static={}", match profile.as_str() {