diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..d207d88 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,35 @@ +name: CI + +on: + push: + branches: [ master ] + workflow_dispatch: + pull_request: + branches: [ master ] + +jobs: + build-test: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + # Use the toolchain from rust-toolchain.toml + - name: Install Rust + uses: actions-rust-lang/setup-rust-toolchain@v1 + + - name: Verify installed toolchain and targets + run: | + rustc --version + rustup show + rustup target list --installed + + - name: Check formatting + run: cargo fmt --all -- --check + + - name: Run clippy + run: cargo clippy -- -D warnings + + - name: Run unit tests for libkernel + run: cargo test -p libkernel --target x86_64-unknown-linux-gnu --all-features diff --git a/rust-toolchain.toml b/rust-toolchain.toml index b169f84..138f971 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,4 +1,4 @@ [toolchain] channel = "nightly" -components = [ "rust-src", "llvm-tools-preview" ] +components = [ "rust-src", "llvm-tools-preview", "rustfmt", "clippy" ] targets = [ "aarch64-unknown-none-softfloat" ] diff --git a/src/fs/syscalls/chdir.rs b/src/fs/syscalls/chdir.rs index fdcc2be..df4e83b 100644 --- a/src/fs/syscalls/chdir.rs +++ b/src/fs/syscalls/chdir.rs @@ -1,7 +1,15 @@ -use crate::{fs::VFS, memory::uaccess::{copy_to_user_slice, cstr::UserCStr}, sched::current_task}; -use core::{ffi::c_char, str::FromStr}; +use crate::{ + fs::VFS, + memory::uaccess::{copy_to_user_slice, cstr::UserCStr}, + sched::current_task, +}; use alloc::{ffi::CString, string::ToString}; -use libkernel::{error::{KernelError, Result}, fs::path::Path, memory::address::{TUA, UA}}; +use core::{ffi::c_char, str::FromStr}; +use libkernel::{ + error::{KernelError, Result}, + fs::path::Path, + memory::address::{TUA, UA}, +}; pub async fn sys_getcwd(buf: UA, len: usize) -> Result { let task = current_task(); diff --git a/src/process/mod.rs b/src/process/mod.rs index 0f83892..fefdc18 100644 --- a/src/process/mod.rs +++ b/src/process/mod.rs @@ -10,11 +10,14 @@ use alloc::{ use creds::Credentials; use ctx::{Context, UserCtx}; use fd_table::FileDescriptorTable; -use libkernel::{fs::pathbuf::PathBuf, memory::{ - address::VA, - proc_vm::{ProcessVM, vmarea::VMArea}, -}}; use libkernel::{VirtualMemory, fs::Inode}; +use libkernel::{ + fs::pathbuf::PathBuf, + memory::{ + address::VA, + proc_vm::{ProcessVM, vmarea::VMArea}, + }, +}; use thread_group::{ Tgid, ThreadGroup, builder::ThreadGroupBuilder,