Skip to content

Commit

Permalink
Fix ci
Browse files Browse the repository at this point in the history
  • Loading branch information
Ciubix8513 committed Jul 8, 2024
1 parent 7922cd2 commit f715414
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
16 changes: 12 additions & 4 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,28 @@ env:

jobs:
build:
runs-on: self-hosted
runs-on: ubuntu-latest
steps:
- name: (linux) install vulkan sdk
run: |
sudo apt update -y
sudo apt install -y mesa-vulkan-drivers
- uses: actions/checkout@v3
- name: Build
run: cargo build
- name: Run doc tests
run: cargo test --doc
run: cargo test --doc -- --nocapture
- name: Run lib tests
run: cargo test --lib
run: cargo test --lib -- --nocapture
- name: Linting
run: cargo clippy -- -D warnings -D clippy::pedantic -D clippy::nursery
build-wasm:
runs-on: self-hosted
runs-on: ubuntu-latest
steps:
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: wasm32-unknown-unknown
- uses: actions/checkout@v3
- name: Build
run: cargo build --target=wasm32-unknown-unknown --features webgl
Expand Down
8 changes: 5 additions & 3 deletions src/logging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ fn parse_log_level(v: &str) -> log::LevelFilter {
}

#[allow(unused_mut)]
pub fn initialize_logging() {
pub fn initialize_logging() -> Result<(), lunar_logger::LoggerError> {
let mut log_level = log::LevelFilter::Info;
let mut engine_log_level = log::LevelFilter::Info;
let mut wgpu_log_level = log::LevelFilter::Warn;
let mut wgpu_hal_log_level = log::LevelFilter::Warn;

let mut log_to_file = false;

Expand All @@ -31,18 +32,19 @@ pub fn initialize_logging() {
"ENGINE_LOG_LEVEL" => engine_log_level = parse_log_level(&value),
"GENERATE_LOGS" => log_to_file = true,
"WGPU_LOG_LEVEL" => wgpu_log_level = parse_log_level(&value),
"WGPU_HAL_LOG_LEVEL" => wgpu_hal_log_level = parse_log_level(&value),
_ => {}
}
}
}

let mut b = lunar_logger::Builder::new()
.add_crate_filter("wgpu", wgpu_log_level)
.add_crate_filter("wgpu_hal", wgpu_log_level)
.add_crate_filter("wgpu_hal", wgpu_hal_log_level)
.add_crate_filter("lunar_engine", engine_log_level)
.default_filter(log_level);
if log_to_file {
b = b.log_to_file();
}
b.init().unwrap();
b.init()
}
2 changes: 2 additions & 0 deletions src/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ async fn gen_gpu_async(instance: &wgpu::Instance) -> (wgpu::Device, wgpu::Queue)

///Generates all the necessary gpu data for tests
pub(crate) fn generate_gpu() {
_ = crate::logging::initialize_logging();

let instance = wgpu::Instance::default();
let (device, queue) = block_on(gen_gpu_async(&instance));
#[cfg(not(target_arch = "wasm32"))]
Expand Down

0 comments on commit f715414

Please sign in to comment.