Browse Source

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
pull/84/head
Ian Chamberlain 2 years ago
parent
commit
e3277a1e3c
No known key found for this signature in database
GPG Key ID: AE5484D09405AA60
  1. 14
      .github/workflows/ci.yml
  2. 1
      ctru-rs/Cargo.toml
  3. 26
      ctru-rs/src/test_runner.rs
  4. 2
      ctru-sys/build.rs

14
.github/workflows/ci.yml

@ -27,6 +27,13 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: devkitpro/devkitarm container: devkitpro/devkitarm
steps: 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 - name: Checkout branch
uses: actions/checkout@v2 uses: actions/checkout@v2
@ -56,9 +63,10 @@ jobs:
- name: Cargo check - name: Cargo check
run: cargo 3ds clippy --color=always --workspace --verbose --all-targets run: cargo 3ds clippy --color=always --workspace --verbose --all-targets
env: # --deny=warnings would be nice, but can easily break CI for new clippy
RUSTFLAGS: # lints getting added. I'd also like to use Github's "inline warnings"
--deny=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. # TODO: it would be nice to actually build 3dsx for examples/tests, etc.
# and run it somehow, but exactly how remains to be seen. # and run it somehow, but exactly how remains to be seen.

1
ctru-rs/Cargo.toml

@ -5,6 +5,7 @@ license = "https://en.wikipedia.org/wiki/Zlib_License"
name = "ctru-rs" name = "ctru-rs"
version = "0.7.1" version = "0.7.1"
edition = "2021" edition = "2021"
rust-version = "1.64"
[lib] [lib]
crate-type = ["rlib"] crate-type = ["rlib"]

26
ctru-rs/src/test_runner.rs

@ -4,7 +4,7 @@ extern crate test;
use std::io; 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::console::Console;
use crate::gfx::Gfx; use crate::gfx::Gfx;
@ -25,34 +25,18 @@ pub(crate) fn run(tests: &[&TestDescAndFn]) {
top_screen.set_wide_mode(true); top_screen.set_wide_mode(true);
let _console = Console::init(top_screen); 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 { let opts = TestOpts {
list: false,
filters: Vec::new(),
filter_exact: false,
// Forking is not supported
force_run_in_process: true, force_run_in_process: true,
exclude_should_panic: false,
run_ignored: RunIgnored::No,
run_tests: true, 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. // TODO: color doesn't work because of TERM/TERMINFO.
// With RomFS we might be able to fake this out nicely... // With RomFS we might be able to fake this out nicely...
color: ColorConfig::AutoColor, color: ColorConfig::AutoColor,
format: OutputFormat::Pretty, format: OutputFormat::Pretty,
shuffle: false, // Hopefully this interface is more stable vs specifying individual options,
shuffle_seed: None, // and parsing the empty list of args should always work, I think.
test_threads: None, // TODO Ideally we could pass actual std::env::args() here too
skip: Vec::new(), ..test::test::parse_opts(&[]).unwrap().unwrap()
time_options: None,
options: Options::new(),
}; };
// Use the default test implementation with our hardcoded options // Use the default test implementation with our hardcoded options
let _success = run_static_tests(&opts, tests).unwrap(); let _success = run_static_tests(&opts, tests).unwrap();

2
ctru-sys/build.rs

@ -6,7 +6,7 @@ fn main() {
println!("cargo:rerun-if-changed=build.rs"); println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rerun-if-env-changed=DEVKITPRO"); 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!( println!(
"cargo:rustc-link-lib=static={}", "cargo:rustc-link-lib=static={}",
match profile.as_str() { match profile.as_str() {

Loading…
Cancel
Save