diff --git a/.github/workflows/docker_build.yml b/.github/workflows/docker_build.yml index ae5c990ce..c29720d1e 100644 --- a/.github/workflows/docker_build.yml +++ b/.github/workflows/docker_build.yml @@ -35,7 +35,7 @@ jobs: default: true components: cargo - name: Run cargo test - run: cargo test --workspace + run: cargo test -j1 kanidm_build: needs: test @@ -70,6 +70,7 @@ jobs: build-args: | "KANIDM_BUILD_PROFILE=developer" "KANIDM_FEATURES=" + "KANIDM_BUILD_OPTIONS=-j1" file: kanidmd/Dockerfile radius_build: needs: test diff --git a/.github/workflows/windows_build.yml b/.github/workflows/windows_build.yml new file mode 100644 index 000000000..ae2597cce --- /dev/null +++ b/.github/workflows/windows_build.yml @@ -0,0 +1,50 @@ +--- +name: Windows Build and Test + +# at the moment this only builds the kanidm client +# because @yaleman got tired but it's enough to prove +# it builds and be able to administer Kanidm from +# Windows-land + +"on": + push: + +jobs: + windows_build_kanidm: + runs-on: windows-latest + steps: + - uses: actions/checkout@v3 + - name: ensure openssl and vcpkg is good + run: | + vcpkg integrate install + vcpkg install openssl:x64-windows-static-md + - name: Install latest stable + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + default: true + components: cargo + - name: build + uses: actions-rs/cargo@v1 + with: + command: build + args: --release -p kanidm_client -p kanidm_tools -p orca + windows_test_kanidm: + runs-on: windows-latest + steps: + - uses: actions/checkout@v3 + - name: ensure openssl and vcpkg is good + run: | + vcpkg integrate install + vcpkg install openssl:x64-windows-static-md + - name: Install latest stable + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + default: true + components: cargo + - name: Run cargo test + uses: actions-rs/cargo@v1 + with: + command: test + args: -p kanidm_client -p kanidm_tools -p orca diff --git a/kanidm_book/src/installing_client_tools.md b/kanidm_book/src/installing_client_tools.md index 46ad38467..cbc70b26d 100644 --- a/kanidm_book/src/installing_client_tools.md +++ b/kanidm_book/src/installing_client_tools.md @@ -14,6 +14,8 @@ Kanidm currently supports the following Linux distributions: * Fedora 34/35 * CentOS Stream 9 +The `kanidm` client has been built and tested from Windows, but is not (yet) packaged routinely. + ### OpenSUSE Tumbleweed Kanidm has been part of OpenSUSE Tumbleweed since October 2020. You can install diff --git a/kanidm_client/src/lib.rs b/kanidm_client/src/lib.rs index d22c92843..75f9e8e56 100644 --- a/kanidm_client/src/lib.rs +++ b/kanidm_client/src/lib.rs @@ -18,11 +18,13 @@ use serde::de::DeserializeOwned; use serde::Deserialize; use serde::Serialize; use serde_json::error::Error as SerdeJsonError; -use std::fs::{metadata, File, Metadata}; +use std::fs::File; +#[cfg(target_family = "unix")] // not needed for windows builds +use std::fs::{metadata, Metadata}; use std::io::ErrorKind; use std::io::Read; -#[cfg(target_family = "unix")] +#[cfg(target_family = "unix")] // not needed for windows builds use std::os::unix::fs::MetadataExt; use std::collections::BTreeMap; @@ -89,6 +91,7 @@ pub struct KanidmClient { pub(crate) auth_session_id: RwLock>, } +#[cfg(target_family = "unix")] fn read_file_metadata>(path: &P) -> Result { metadata(path).map_err(|e| { error!( diff --git a/kanidmd/Dockerfile b/kanidmd/Dockerfile index f938f8b9e..247dc1efb 100644 --- a/kanidmd/Dockerfile +++ b/kanidmd/Dockerfile @@ -25,6 +25,7 @@ WORKDIR /usr/src/kanidm/kanidmd/daemon ARG SCCACHE_REDIS="" ARG KANIDM_FEATURES ARG KANIDM_BUILD_PROFILE +ARG KANIDM_BUILD_OPTIONS="" RUN mkdir /scratch RUN echo $KANIDM_BUILD_PROFILE @@ -36,12 +37,13 @@ ENV CARGO_HOME=/scratch/.cargo RUN if [ "${SCCACHE_REDIS}" != "" ]; \ then \ export CC="/usr/bin/sccache /usr/bin/clang" && \ + export CARGO_INCREMENTAL=false && \ export RUSTC_WRAPPER=sccache && \ sccache --start-server; \ else \ export CC="/usr/bin/clang"; \ fi && \ - cargo build \ + cargo build ${KANIDM_BUILD_OPTIONS} \ --features=${KANIDM_FEATURES} \ --target-dir=/usr/src/kanidm/target/ \ --release && \ diff --git a/kanidmd/daemon/Cargo.toml b/kanidmd/daemon/Cargo.toml index 36a27ef96..a83147405 100644 --- a/kanidmd/daemon/Cargo.toml +++ b/kanidmd/daemon/Cargo.toml @@ -22,10 +22,12 @@ score = { path = "../score" } structopt = { version = "^0.3.26", default-features = false } users = "^0.11.0" serde = { version = "^1.0.137", features = ["derive"] } -tikv-jemallocator = "0.5.0" tokio = { version = "^1.18.0", features = ["rt-multi-thread", "macros", "signal"] } toml = "0.5.9" +[target.'cfg(not(target_family = "windows"))'.dependencies] +tikv-jemallocator = "0.5" + [build-dependencies] serde = { version = "1", features = ["derive"] } structopt = { version = "0.3", default-features = false } diff --git a/kanidmd/daemon/src/main.rs b/kanidmd/daemon/src/main.rs index 209d7c7fd..2807b6f2c 100644 --- a/kanidmd/daemon/src/main.rs +++ b/kanidmd/daemon/src/main.rs @@ -10,6 +10,7 @@ #![deny(clippy::needless_pass_by_value)] #![deny(clippy::trivially_copy_pass_by_ref)] +#[cfg(not(target_family = "windows"))] #[global_allocator] static ALLOC: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc; diff --git a/kanidmd/idm/src/lib.rs b/kanidmd/idm/src/lib.rs index 2a4abc794..98ed72cae 100644 --- a/kanidmd/idm/src/lib.rs +++ b/kanidmd/idm/src/lib.rs @@ -14,7 +14,7 @@ #![deny(clippy::needless_pass_by_value)] #![deny(clippy::trivially_copy_pass_by_ref)] -#[cfg(all(jemallocator, test))] +#[cfg(all(jemallocator, test, not(target_family = "windows")))] #[global_allocator] static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc; diff --git a/kanidmd/score/src/https/mod.rs b/kanidmd/score/src/https/mod.rs index fcdbd95c3..1fb65622e 100644 --- a/kanidmd/score/src/https/mod.rs +++ b/kanidmd/score/src/https/mod.rs @@ -11,8 +11,8 @@ use kanidm::prelude::*; use kanidm::status::StatusActor; use serde::Serialize; -use std::path::PathBuf; use std::fs::canonicalize; +use std::path::PathBuf; use std::str::FromStr; use uuid::Uuid; @@ -366,7 +366,6 @@ pub fn create_https_server( qe_w_ref: &'static QueryServerWriteV1, qe_r_ref: &'static QueryServerReadV1, ) -> Result<(), ()> { - let jws_validator = jws_signer.get_validator().map_err(|e| { error!(?e, "Failed to get jws validator"); })?; @@ -401,7 +400,6 @@ pub fn create_https_server( // If we are no-ui, we remove this. if !matches!(role, ServerRole::WriteReplicaNoUI) { - let pkg_path = PathBuf::from(env!("KANIDM_WEB_UI_PKG_PATH")); if !pkg_path.exists() { eprintln!( diff --git a/orca/Cargo.toml b/orca/Cargo.toml index 645a00b44..0ad2910a6 100644 --- a/orca/Cargo.toml +++ b/orca/Cargo.toml @@ -15,7 +15,7 @@ name = "orca" path = "src/main.rs" [dependencies] -tikv-jemallocator = "0.5.0" + tracing = "^0.1.34" tracing-subscriber = "^0.3.11" @@ -46,5 +46,9 @@ mathru = "^0.12.0" dialoguer = "0.10.1" +[target.'cfg(not(target_family = "windows"))'.dependencies] +tikv-jemallocator = "0.5" + + [build-dependencies] profiles = { path = "../profiles" } diff --git a/orca/src/main.rs b/orca/src/main.rs index f37f83fd5..6e8723b88 100644 --- a/orca/src/main.rs +++ b/orca/src/main.rs @@ -8,6 +8,7 @@ #![deny(clippy::needless_pass_by_value)] #![deny(clippy::trivially_copy_pass_by_ref)] +#[cfg(not(target_family = "windows"))] #[global_allocator] static ALLOC: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;