From f84005d7c61d3ddc060fec28964ee8a32c7c9c93 Mon Sep 17 00:00:00 2001 From: ko1N Date: Fri, 20 Nov 2020 23:39:53 +0100 Subject: [PATCH] Updated readme and added github ci --- .github/workflows/build.yml | 116 ++++++++++++++++++++++++++++++++++++ README.md | 13 ++-- memflow-pcileech/Cargo.toml | 3 - 3 files changed, 125 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..2d0f0c4 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,116 @@ +name: Build and test + +on: [push, pull_request] + +env: + CARGO_TERM_COLOR: always + +jobs: + + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [macos-latest, ubuntu-latest, windows-latest] + steps: + - uses: actions/checkout@v2 + + - name: Build + run: cargo build --workspace --verbose + if: runner.os != 'Windows' + + - name: Build examples + run: cargo build --workspace --examples --verbose + if: runner.os != 'Windows' + + - name: Set up Rust nightly + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly + override: true + if: runner.os == 'Windows' + + - name: Build (nightly) + run: cargo +nightly build --workspace --all-features --verbose + if: runner.os == 'Windows' + + - name: Build examples (nightly) + run: cargo +nightly build --workspace --all-features --examples --verbose + if: runner.os == 'Windows' + + build-arm: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + target: aarch64-unknown-linux-gnu + override: true + - uses: actions-rs/cargo@v1 + with: + use-cross: true + command: build + args: --target aarch64-unknown-linux-gnu --workspace --verbose + + test: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [macos-latest, ubuntu-latest, windows-latest] + steps: + - uses: actions/checkout@v2 + + - name: Run all tests + run: cargo test --workspace --verbose + if: runner.os == 'Linux' + + - name: Run all tests + run: cargo test --workspace --exclude memflow-derive --verbose + if: runner.os == 'macOS' + + - name: Set up Rust nightly + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly + override: true + if: runner.os == 'Windows' + + - name: Run all tests (nightly) + run: cargo +nightly test --workspace --exclude memflow-derive --all-features --verbose + if: runner.os == 'Windows' + + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: rustup component add clippy + - name: Check formatting + run: cargo fmt -- --check + - uses: actions-rs/clippy-check@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + args: --all-targets + + build-coverage: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Rust nightly + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly + override: true + - run: cargo install grcov + - name: Run tests with coverage + run: | + export CARGO_INCREMENTAL=0 + export RUSTFLAGS="-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort" + export RUSTDOCFLAGS="-Cpanic=abort" + cargo build --workspace --exclude memflow-derive + cargo test --workspace --exclude memflow-derive + grcov ./target/debug/ -s . -t lcov --llvm --branch --ignore-not-existing -o ./target/debug/coverage + bash <(curl -s https://codecov.io/bash) -f ./target/debug/coverage -t ${{ secrets.CODECOV_TOKEN }}; diff --git a/README.md b/README.md index c5fde82..086e64c 100644 --- a/README.md +++ b/README.md @@ -45,13 +45,18 @@ Make sure to not enable the `plugin` feature when importing multiple connectors in a rust project without using the memflow plugin inventory. This might cause duplicated exports being generated in your project. -### Building the stand-alone plugin +### Building the stand-alone connector for dynamic loading -The stand-alone plugin of this library is feature-gated behind the `plugin` feature. -To compile a dynamic library as a plugin use the following command: +The stand-alone connector of this library is feature-gated behind the `inventory` feature. +To compile a dynamic library for use with the connector inventory use the following command: ```cargo build --release --all-features``` +### Installing the library + +Alternatively to manually placing the library in the `PATH` the connector can be installed with the `install.sh` script. +It will place it inside `~/.local/lib/memflow` directory. Add `~/.local/lib` directory to `PATH` to use the connector in other memflow projects. + ## Arguments The following arguments can be used when loading the connector: @@ -76,7 +81,7 @@ The `real_base` parameter is optional. If it is not set there will be no re-mapp ## License -Licensed under MIT License, see [LICENSE](LICENSE). +Licensed under GPL-3.0 License, see [LICENSE](LICENSE). ### Contribution diff --git a/memflow-pcileech/Cargo.toml b/memflow-pcileech/Cargo.toml index 85b76e9..487ccc3 100644 --- a/memflow-pcileech/Cargo.toml +++ b/memflow-pcileech/Cargo.toml @@ -21,9 +21,6 @@ memflow-derive = { version = "0.1" } log = { version = "0.4", default-features = false } leechcore-sys = { path = "../leechcore-sys" } -# test -libc = "0.2" - [dev-dependencies] simple_logger = "1.0"