Browse Source

Merge branch 'master' into camera

pull/65/head
SteveCookTU 2 years ago committed by GitHub
parent
commit
3ea0ba75b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 64
      .github/workflows/ci.yml
  2. 24
      ctru-rs/Cargo.toml
  3. 8
      ctru-rs/examples/system-configuration.rs
  4. 2
      ctru-sys/src/bin/docstring-to-rustdoc.rs

64
.github/workflows/ci.yml

@ -0,0 +1,64 @@ @@ -0,0 +1,64 @@
name: CI
on:
push:
branches:
- master
pull_request:
branches:
- master
workflow_dispatch:
env:
# https://blog.rust-lang.org/2022/06/22/sparse-registry-testing.html
CARGO_UNSTABLE_SPARSE_REGISTRY: "true"
jobs:
lint:
strategy:
matrix:
toolchain:
# Run against a "known good" nightly
- nightly-2022-07-18
# Check for breakage on latest nightly
- nightly
# But if latest nightly fails, allow the workflow to continue
continue-on-error: ${{ matrix.toolchain == 'nightly' }}
runs-on: ubuntu-latest
container: devkitpro/devkitarm
steps:
- name: Checkout branch
uses: actions/checkout@v2
- name: Setup default Rust toolchain
uses: actions-rs/toolchain@v1
with:
components: clippy, rustfmt, rust-src
profile: minimal
toolchain: ${{ matrix.toolchain }}
default: true
- name: Install build tools for host
run: sudo apt-get install -y build-essential
- name: Install cargo-3ds
uses: actions-rs/cargo@v1
with:
command: install
# TODO: this should probably just be a released version from crates.io
# once cargo-3ds gets published somewhere...
args: >-
--git https://github.com/rust3ds/cargo-3ds
--rev 7b70b6b26c4740b9a10ab85b832ee73c41142bbb
- name: Check formatting
run: cargo fmt --all --verbose -- --check
- name: Cargo check
run: cargo 3ds clippy --color=always --workspace --verbose --all-targets
env:
RUSTFLAGS:
--deny=warnings
# TODO: it would be nice to actually build 3dsx for examples/tests, etc.
# and run it somehow, but exactly how remains to be seen.

24
ctru-rs/Cargo.toml

@ -36,5 +36,29 @@ default = ["romfs", "big-stack"] @@ -36,5 +36,29 @@ default = ["romfs", "big-stack"]
romfs = []
big-stack = []
# Temporary feature to disable some examples by default,
# until thread support is upstreamed
std-threads = []
[package.metadata.cargo-3ds]
romfs_dir = "examples/romfs"
[[example]]
name = "thread-basic"
required-features = ["std-threads"]
[[example]]
name = "thread-info"
required-features = ["std-threads"]
[[example]]
name = "thread-locals"
required-features = ["std-threads"]
[[example]]
name = "futures-basic"
required-features = ["std-threads"]
[[example]]
name = "futures-tokio"
required-features = ["std-threads"]

8
ctru-rs/examples/system-configuration.rs

@ -1,8 +1,8 @@ @@ -1,8 +1,8 @@
use ctru::console::Console;
use ctru::gfx::Gfx;
use ctru::services::apt::Apt;
use ctru::services::hid::{Hid, KeyPad};
use ctru::services::cfgu::Cfgu;
use ctru::services::hid::{Hid, KeyPad};
fn main() {
ctru::init();
@ -12,9 +12,9 @@ fn main() { @@ -12,9 +12,9 @@ fn main() {
let cfgu = Cfgu::init().expect("Couldn't obtain CFGU controller");
let _console = Console::init(gfx.top_screen.borrow_mut());
println!("\x1b[0;0H{}", format!("Region: {:?}", cfgu.get_region().unwrap()));
println!("\x1b[10;0H{}", format!("Language: {:?}", cfgu.get_language().unwrap()));
println!("\x1b[20;0H{}", format!("Model: {:?}", cfgu.get_model().unwrap()));
println!("\x1b[0;0HRegion: {:?}", cfgu.get_region().unwrap());
println!("\x1b[10;0HLanguage: {:?}", cfgu.get_language().unwrap());
println!("\x1b[20;0HModel: {:?}", cfgu.get_model().unwrap());
// Main loop
while apt.main_loop() {

2
ctru-sys/src/bin/docstring-to-rustdoc.rs

@ -32,7 +32,7 @@ fn main() -> io::Result<()> { @@ -32,7 +32,7 @@ fn main() -> io::Result<()> {
.lines()
.map(|v| {
// Only modify lines with the following structure: `` #[doc ... ] ``
if v.trim_start().starts_with("#[doc") && v.trim_end().ends_with("]") {
if v.trim_start().starts_with("#[doc") && v.trim_end().ends_with(']') {
v.replace("@brief", "")
// Example: ``@param offset Offset of the RomFS...`` -> ``- offset Offset of the RomFS...``
// Will improve in the future

Loading…
Cancel
Save