Update CI
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
This commit is contained in:
parent
141ba3bac8
commit
0ffdbc5a48
|
|
@ -9,15 +9,15 @@ jobs:
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-18.04]
|
os: [ubuntu-latest, macos-latest]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
with:
|
|
||||||
submodules: true
|
|
||||||
- run: |
|
- run: |
|
||||||
sudo apt-get update -y
|
sudo apt-get update -y
|
||||||
|
# Journal example
|
||||||
sudo apt-get install -y libsystemd-dev
|
sudo apt-get install -y libsystemd-dev
|
||||||
|
if: runner.os == 'Linux'
|
||||||
- run: cargo check --examples --tests --all-targets
|
- run: cargo check --examples --tests --all-targets
|
||||||
- run: cargo fmt --all -- --check --files-with-diff
|
- run: cargo fmt --all -- --check --files-with-diff
|
||||||
- run: cargo clippy --all-targets --all-features -- -D warnings
|
- run: cargo clippy --all-targets --all-features -- -D warnings
|
||||||
|
|
|
||||||
|
|
@ -8,5 +8,5 @@ license = "Apache-2.0"
|
||||||
repository = "https://github.com/mxpv/containerd-rust-extensions"
|
repository = "https://github.com/mxpv/containerd-rust-extensions"
|
||||||
keywords = ["containerd", "shim", "containers"]
|
keywords = ["containerd", "shim", "containers"]
|
||||||
|
|
||||||
[dev-dependencies]
|
[target.'cfg(target_os = "linux")'.dev-dependencies]
|
||||||
systemd = { version = "0.9.0", default-features = false, features = ["journal"] }
|
systemd = { version = "0.9.0", default-features = false, features = ["journal"] }
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,15 @@
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::io::{self, BufRead};
|
|
||||||
use std::thread;
|
use std::thread;
|
||||||
|
|
||||||
use containerd_shim_logging as logging;
|
use containerd_shim_logging as logging;
|
||||||
|
|
||||||
use logging::{Config, Driver};
|
use logging::{Config, Driver};
|
||||||
use systemd::journal;
|
|
||||||
|
|
||||||
|
#[cfg(target_os = "linux")]
|
||||||
fn pump(reader: fs::File) {
|
fn pump(reader: fs::File) {
|
||||||
|
use std::io::{self, BufRead};
|
||||||
|
use systemd::journal;
|
||||||
|
|
||||||
io::BufReader::new(reader)
|
io::BufReader::new(reader)
|
||||||
.lines()
|
.lines()
|
||||||
.filter_map(|line| line.ok())
|
.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 {
|
struct Journal {
|
||||||
stdout_handle: thread::JoinHandle<()>,
|
stdout_handle: thread::JoinHandle<()>,
|
||||||
stderr_handle: thread::JoinHandle<()>,
|
stderr_handle: thread::JoinHandle<()>,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue