Skip to content

Commit

Permalink
Trying macos
Browse files Browse the repository at this point in the history
  • Loading branch information
sauliusgrigaitis committed Dec 27, 2024
1 parent f36572c commit fadd230
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
os: [ubuntu-latest, macos-latest, windows-latest]

runs-on: ${{ matrix.os }}

Expand All @@ -31,7 +31,12 @@ jobs:
- name: Run Clippy (Linux)
if: runner.os == 'Linux'
run: scripts/ci/clippy.bash --deny warnings
# It's a known issue that a couple of networking tests doesn't pass
- name: Run tests
if: runner.os == 'Macos'
run: cargo test --release --no-fail-fast -- --skip behaviour::tests::test_scoring_p1 --skip behaviour::tests::test_scoring_p7_grafts_before_backoff
- name: Run tests
if: runner.os != 'Macos'
run: cargo test --release --no-fail-fast
- name: Check consensus-spec-tests coverage (Linux)
if: runner.os == 'Linux'
Expand Down
6 changes: 3 additions & 3 deletions metrics/src/metric_sys.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use anyhow::Result;
#[cfg(target_os = "linux")]
#[cfg(not(target_os = "windows"))]
use {
anyhow::bail,
psutil::{cpu, process::Process},
Expand All @@ -15,7 +15,7 @@ pub struct ProcessCpuMetric {
pub memory_process_bytes: u64,
}

#[cfg(target_os = "linux")]
#[cfg(not(target_os = "windows"))]
pub fn get_process_cpu_metric() -> Result<ProcessCpuMetric> {
#[expect(unused_assignments)]
let mut cpu_process_seconds_total = 0;
Expand Down Expand Up @@ -78,7 +78,7 @@ pub struct CpuMetric {
}

// TODO maybe work for MacOS or wider Unix?
#[cfg(target_os = "linux")]
#[cfg(not(target_os = "windows"))]
pub fn get_cpu_metric() -> Result<CpuMetric> {
let cpu = cpu::cpu_times()?;
let system_seconds = cpu.total().as_secs();
Expand Down

0 comments on commit fadd230

Please sign in to comment.