diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5668aa8..0b68a54 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,15 +9,15 @@ jobs: strategy: matrix: - os: [ubuntu-18.04] + os: [ubuntu-latest, macos-latest] steps: - uses: actions/checkout@v2 - with: - submodules: true - run: | sudo apt-get update -y + # Journal example sudo apt-get install -y libsystemd-dev + if: runner.os == 'Linux' - run: cargo check --examples --tests --all-targets - run: cargo fmt --all -- --check --files-with-diff - run: cargo clippy --all-targets --all-features -- -D warnings diff --git a/crates/logging/Cargo.toml b/crates/logging/Cargo.toml index b930092..352969e 100644 --- a/crates/logging/Cargo.toml +++ b/crates/logging/Cargo.toml @@ -8,5 +8,5 @@ license = "Apache-2.0" repository = "https://github.com/mxpv/containerd-rust-extensions" keywords = ["containerd", "shim", "containers"] -[dev-dependencies] +[target.'cfg(target_os = "linux")'.dev-dependencies] systemd = { version = "0.9.0", default-features = false, features = ["journal"] } diff --git a/crates/logging/examples/journal.rs b/crates/logging/examples/journal.rs index 3dc058d..04da9b6 100644 --- a/crates/logging/examples/journal.rs +++ b/crates/logging/examples/journal.rs @@ -1,13 +1,15 @@ use std::fs; -use std::io::{self, BufRead}; use std::thread; use containerd_shim_logging as logging; use logging::{Config, Driver}; -use systemd::journal; +#[cfg(target_os = "linux")] fn pump(reader: fs::File) { + use std::io::{self, BufRead}; + use systemd::journal; + io::BufReader::new(reader) .lines() .filter_map(|line| line.ok()) @@ -16,6 +18,9 @@ fn pump(reader: fs::File) { }); } +#[cfg(not(target_os = "linux"))] +fn pump(_reader: fs::File) {} + struct Journal { stdout_handle: thread::JoinHandle<()>, stderr_handle: thread::JoinHandle<()>,