diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..b8e4db3 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,64 @@ +name: CI + +on: + push: + branches: + - master + pull_request: + branches: + - master + +env: + # https://blog.rust-lang.org/2022/06/22/sparse-registry-testing.html + CARGO_UNSTABLE_SPARSE_REGISTRY: "true" + +jobs: + lint: + runs-on: ubuntu-latest + container: devkitpro/devkitarm + steps: + - if: ${{ env.ACT }} + name: Hack container for local development + run: | + curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - + sudo apt-get install -y nodejs + + - 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: nightly + 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 913645665391ea715bc96910bda35f98a4536a6e + + - name: Check formatting + run: cargo fmt --all --verbose -- --check + + # For some reason, `cargo clippy` doesn't seem to work properly with + # -Zbuild-std (and thus with `cargo 3ds`). Maybe would be helped by + # https://github.com/rust3ds/cargo-3ds/pull/21 ? + - name: Cargo check + run: cargo 3ds check --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. Also, we probably + # need the std::thread PR to land before a lot of the examples are runnable. diff --git a/ctru-rs/examples/network-sockets.rs b/ctru-rs/examples/network-sockets.rs index ac8953d..6526d41 100644 --- a/ctru-rs/examples/network-sockets.rs +++ b/ctru-rs/examples/network-sockets.rs @@ -43,7 +43,7 @@ fn main() { } else { println!("Unable to read stream: {}", e) } - }, + } } let response = b"HTTP/1.1 200 OK\r\nContent-Type: text/html; charset=UTF-8\r\n\r\n
Hello world\r\n"; diff --git a/ctru-rs/src/services/reference.rs b/ctru-rs/src/services/reference.rs index 7fac227..41319a7 100644 --- a/ctru-rs/src/services/reference.rs +++ b/ctru-rs/src/services/reference.rs @@ -16,7 +16,9 @@ impl ServiceReference { S: FnOnce() -> crate::Result<()>, E: Fn() + Send + Sync + 'static, { - let mut value = counter.lock().expect("Mutex Counter for ServiceReference is poisoned"); // todo: handle poisoning + let mut value = counter + .lock() + .expect("Mutex Counter for ServiceReference is poisoned"); // todo: handle poisoning if *value == 0 { start()?; @@ -35,7 +37,10 @@ impl ServiceReference { impl Drop for ServiceReference { fn drop(&mut self) { - let mut value = self.counter.lock().expect("Mutex Counter for ServiceReference is poisoned"); // todo: handle poisoning + let mut value = self + .counter + .lock() + .expect("Mutex Counter for ServiceReference is poisoned"); // todo: handle poisoning *value -= 1; if *value == 0 { (self.close)(); diff --git a/ctru-sys/src/bin/docstring-to-rustdoc.rs b/ctru-sys/src/bin/docstring-to-rustdoc.rs index b7c7cb9..a843a1b 100644 --- a/ctru-sys/src/bin/docstring-to-rustdoc.rs +++ b/ctru-sys/src/bin/docstring-to-rustdoc.rs @@ -19,8 +19,8 @@ //! The followings are _partially_ transformed to Rustdoc format: //! * `@param` -use std::{env, fs, io}; use std::path::Path; +use std::{env, fs, io}; fn main() -> io::Result<()> { let args: Vec