diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index e307cef..1449814 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -34,7 +34,9 @@ // VS Code don't watch files under ./target "files.watcherExclude": { "**/target/**": true - } + }, + "git.autofetch": true, + "git.branchProtection": ["main"] }, // Add the IDs of extensions you want installed when the container is created. diff --git a/.github/codecov.yml b/.github/codecov.yml new file mode 100644 index 0000000..bfdc987 --- /dev/null +++ b/.github/codecov.yml @@ -0,0 +1,8 @@ +coverage: + status: + project: + default: + informational: true + patch: + default: + informational: true diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 280c044..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: CI - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -env: - CARGO_TERM_COLOR: always - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Install dependencies - run: | - sudo apt-get update - sudo apt-get install build-essential dpkg-dev - sudo apt-get build-dep . - - name: CI - run: ci/test.sh diff --git a/.github/workflows/clippy.yml b/.github/workflows/clippy.yml deleted file mode 100644 index 80cd364..0000000 --- a/.github/workflows/clippy.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Clippy - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -env: - CARGO_TERM_COLOR: always - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - run: rustup component add clippy - - name: rust-clippy-check - uses: actions-rs/clippy-check@v1.0.7 - with: - token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml deleted file mode 100644 index 123d899..0000000 --- a/.github/workflows/rust.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: Rust - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -env: - CARGO_TERM_COLOR: always - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Build - run: cargo build --verbose - - name: Run tests - run: cargo test --verbose \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..265625b --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,73 @@ +name: Test + +on: + push: + branches: [main] + pull_request: + branches: [main] + +env: + CARGO_TERM_COLOR: always + +jobs: + build-test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Build + run: cargo build --verbose + - name: Run tests + run: cargo test --verbose + + coverage: + runs-on: ubuntu-latest + container: + image: xd009642/tarpaulin:develop + options: --security-opt seccomp=unconfined + + steps: + - uses: actions/checkout@v3 + - name: Generate code coverage + run: cargo tarpaulin --all-features --workspace --timeout 120 --out Xml + - uses: codecov/codecov-action@v3 + with: + fail_ci_if_error: true + + build-debian-10: + runs-on: ubuntu-latest + container: debian:10 + + steps: + - uses: actions/checkout@v2 + - name: Install dependencies + run: | + apt-get update + apt-get -y install build-essential dpkg-dev ca-certificates + apt-get -y build-dep . + - name: Build + run: cargo build --verbose + + clippy: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - run: rustup component add clippy + - name: rust-clippy-check + uses: actions-rs/clippy-check@v1.0.7 + with: + token: ${{ secrets.GITHUB_TOKEN }} + + run-ci: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install build-essential dpkg-dev + sudo apt-get build-dep . + - name: CI + run: ci/test.sh diff --git a/.gitignore b/.gitignore index 8756a89..0b864bd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,2 @@ /target -/.vscode -Vagrantfile +cobertura.xml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 33d72e9..0000000 --- a/.travis.yml +++ /dev/null @@ -1,13 +0,0 @@ -dist: bionic - -install: - - echo deb http://archive.ubuntu.com/ubuntu bionic-backports main universe| sudo tee /etc/apt/sources.list.d/backports.list - - sudo apt-get update - - sudo apt-get install build-essential dpkg-dev - - sudo apt-get -t bionic-backports build-dep . - -script: - - ci/test.sh - -notifications: - email: false diff --git a/Cargo.lock b/Cargo.lock index 7b0b8ca..c2a1bf4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,15 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + [[package]] name = "anyhow" version = "1.0.65" @@ -76,6 +85,18 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "chrono" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfd4d1b31faaa3a89d7934dbded3111da0d2ef28e3ebccdb4f0179f5929d1ef1" +dependencies = [ + "iana-time-zone", + "num-integer", + "num-traits", + "winapi", +] + [[package]] name = "clap" version = "2.34.0" @@ -87,6 +108,22 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "codespan-reporting" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" +dependencies = [ + "termcolor", + "unicode-width", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" + [[package]] name = "criterion" version = "0.3.6" @@ -188,6 +225,50 @@ dependencies = [ "memchr", ] +[[package]] +name = "cxx" +version = "1.0.78" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19f39818dcfc97d45b03953c1292efc4e80954e1583c4aa770bac1383e2310a4" +dependencies = [ + "cc", + "cxxbridge-flags", + "cxxbridge-macro", + "link-cplusplus", +] + +[[package]] +name = "cxx-build" +version = "1.0.78" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e580d70777c116df50c390d1211993f62d40302881e54d4b79727acb83d0199" +dependencies = [ + "cc", + "codespan-reporting", + "once_cell", + "proc-macro2", + "quote", + "scratch", + "syn", +] + +[[package]] +name = "cxxbridge-flags" +version = "1.0.78" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56a46460b88d1cec95112c8c363f0e2c39afdb237f60583b0b36343bf627ea9c" + +[[package]] +name = "cxxbridge-macro" +version = "1.0.78" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "747b608fecf06b0d72d440f27acc99288207324b793be2c17991839f3d4995ea" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "dirs-next" version = "2.0.0" @@ -241,6 +322,30 @@ dependencies = [ "libc", ] +[[package]] +name = "iana-time-zone" +version = "0.1.51" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5a6ef98976b22b3b7f2f3a806f858cb862044cfa66805aa3ad84cb3d3b785ed" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "winapi", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fde6edd6cef363e9359ed3c98ba64590ba9eecba2293eb5a723ab32aee8926aa" +dependencies = [ + "cxx", + "cxx-build", +] + [[package]] name = "itertools" version = "0.10.5" @@ -283,6 +388,15 @@ version = "0.2.134" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "329c933548736bc49fd575ee68c89e8be4d260064184389a5b77517cddd99ffb" +[[package]] +name = "link-cplusplus" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9272ab7b96c9046fbc5bc56c06c117cb639fe2d509df0c421cad82d2915cf369" +dependencies = [ + "cc", +] + [[package]] name = "log" version = "0.4.17" @@ -331,6 +445,7 @@ dependencies = [ "nix", "num-derive", "num-traits", + "once_cell", "sd-notify", "slog", "slog-async", @@ -348,6 +463,16 @@ dependencies = [ "syn", ] +[[package]] +name = "num-integer" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +dependencies = [ + "autocfg", + "num-traits", +] + [[package]] name = "num-traits" version = "0.2.15" @@ -367,20 +492,11 @@ dependencies = [ "libc", ] -[[package]] -name = "num_threads" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2819ce041d2ee131036f4fc9d6ae7ae125a3a40e97ba64d04fe799ad9dabbb44" -dependencies = [ - "libc", -] - [[package]] name = "once_cell" -version = "1.15.0" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e82dad04139b71a90c080c8463fe0dc7902db5192d939bd0950f074d014339e1" +checksum = "2f7254b99e31cad77da24b08ebf628882739a608578bb1bcdfc1f9c21260d7c0" [[package]] name = "oorandom" @@ -526,6 +642,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +[[package]] +name = "scratch" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8132065adcfd6e02db789d9285a0deb2f3fcb04002865ab67d5fb103533898" + [[package]] name = "sd-notify" version = "0.4.1" @@ -590,15 +712,15 @@ dependencies = [ [[package]] name = "slog-term" -version = "2.9.0" +version = "2.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87d29185c55b7b258b4f120eab00f48557d4d9bc814f41713f449d35b0f8977c" +checksum = "f3668dd2252f4381d64de0c79e6c8dc6bd509d1cab3535b35a3fc9bafd1241d5" dependencies = [ "atty", + "chrono", "slog", "term", "thread_local", - "time", ] [[package]] @@ -629,6 +751,15 @@ dependencies = [ "winapi", ] +[[package]] +name = "termcolor" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" +dependencies = [ + "winapi-util", +] + [[package]] name = "textwrap" version = "0.11.0" @@ -667,24 +798,6 @@ dependencies = [ "once_cell", ] -[[package]] -name = "time" -version = "0.3.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d634a985c4d4238ec39cacaed2e7ae552fbd3c476b552c1deac3021b7d7eaf0c" -dependencies = [ - "itoa 1.0.4", - "libc", - "num_threads", - "time-macros", -] - -[[package]] -name = "time-macros" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42657b1a6f4d817cda8e7a0ace261fe0cc946cf3a80314390b22cc61ae080792" - [[package]] name = "tinytemplate" version = "1.2.1" diff --git a/Cargo.toml b/Cargo.toml index 0eda54c..554ba20 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,13 +17,16 @@ anyhow = "^1.0" atoi = "^0.4" slog = "^2.7" slog-async = "^2.7" -slog-term = "^2.8" +# Hold at 2.8.1: 2.9 upgrades to time 0.3 whose MSRV is too new +slog-term = "~2.8" crossbeam-channel = "^0.5" -# Hold at 0.21 - 0.22 MSRV is greater than Debian stretch +# Hold at 0.21: 0.22 MSRV is too new nix = "^0.21.2" num-derive = "^0.3" num-traits = "^0.2" sd-notify = "0.4.1" +# Indirect dependency, constrained for MSRV +once_cell = "~1.14" [dev-dependencies] criterion = "^0.3"