diff --git a/.github/workflows/binary-build.yml b/.github/workflows/binary-build.yml deleted file mode 100644 index 075f757..0000000 --- a/.github/workflows/binary-build.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: Binary build - -on: - push: - branch: - - 'main' - - 'stable' - -env: - CARGO_TERM_COLOR: always - -jobs: - - cross-build: - name: Publish binary builds - runs-on: ubuntu-latest - strategy: - matrix: - target: ["x86_64-unknown-linux-gnu", "i686-unknown-linux-gnu", "aarch64-unknown-linux-gnu", "armv7-unknown-linux-gnueabihf", "x86_64-pc-windows-gnu"] - steps: - - uses: actions/checkout@v2 - - name: Install rust 1.70.0 - uses: actions-rs/toolchain@v1 - with: - toolchain: 1.70.0 - override: true - - name: Download renamer - run: curl -sSf https://raw.githubusercontent.com/memflow/memflowup/master/target_rename.sh > target_rename.sh - - name: Build artifacts - uses: actions-rs/cargo@v1 - with: - use-cross: true - command: build - args: --release --all-features --workspace --verbose --target ${{ matrix.target }} - - name: Rename and collect artifacts - id: artifacts - run: echo "::set-output name=artifact::$(sh ./target_rename.sh "${{ matrix.target }}" | head -n 1)" - - name: Upload build artifacts - uses: softprops/action-gh-release@v1 - with: - tag_name: bin-${{ github.ref_name }} - files: | - ${{ steps.artifacts.outputs.artifact }} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 826c495..8951a26 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,79 +1,62 @@ -name: Build and test - -on: [push, pull_request] - -env: - CARGO_TERM_COLOR: always - -jobs: - - build_x86-64: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest, windows-latest] - flags: [--all-features, --no-default-features] - steps: - - uses: actions/checkout@v2 - - name: Install rust 1.70.0 - uses: actions-rs/toolchain@v1 - with: - toolchain: 1.70.0 - override: true - - - name: Build - run: cargo build --workspace ${{ matrix.flags }} --verbose - - test: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest, windows-latest] - steps: - - uses: actions/checkout@v2 - - name: Install rust 1.70.0 - uses: actions-rs/toolchain@v1 - with: - toolchain: 1.70.0 - override: true - - - name: Run all tests - run: cargo test --workspace --all-features --verbose - - lint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - toolchain: 1.70.0 - override: true - components: rustfmt, clippy - - 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 --all-features --workspace -- -D clippy::all - - 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 }}; +name: Build and test + +on: + push: + branches: + - "**" + pull_request: + +env: + RUST_BACKTRACE: 1 + CARGO_TERM_COLOR: always + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [macos-latest, ubuntu-latest, windows-latest] + flags: [--all-features, --no-default-features] + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + - run: cargo build ${{ matrix.flags }} --release + - run: cargo build ${{ matrix.flags }} --release --examples + + test: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [macos-latest, ubuntu-latest, windows-latest] + flags: [--all-features, --no-default-features] + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + - run: cargo test ${{ matrix.flags }} --all + + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt, clippy + - run: cargo fmt -- --check + - run: cargo clippy --all-targets --all-features + + build-coverage: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + with: + toolchain: nightly + - run: cargo install grcov + - 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/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..c8719a3 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,74 @@ +name: Deploy to memflow registry + +on: + push: + branches: + - "**" + +env: + RUST_BACKTRACE: 1 + CARGO_TERM_COLOR: always + PLUGIN_NAME: qemu + +jobs: + deploy: + name: ${{ matrix.platform.os_name }} with rust ${{ matrix.toolchain }} + runs-on: ${{ matrix.platform.os }} + strategy: + fail-fast: false + matrix: + platform: + - os_name: linux-x86_64 + os: ubuntu-latest + target: x86_64-unknown-linux-gnu + - os_name: linux-aarch64 + os: ubuntu-latest + target: aarch64-unknown-linux-gnu + - os_name: linux-arm + os: ubuntu-latest + target: arm-unknown-linux-gnueabi + - os_name: linux-i686 + os: ubuntu-latest + target: i686-unknown-linux-gnu + - os_name: windows-aarch64 + os: windows-latest + target: aarch64-pc-windows-msvc + - os_name: windows-i686 + os: windows-latest + target: i686-pc-windows-msvc + - os_name: windows-x86_64 + os: windows-latest + target: x86_64-pc-windows-msvc + - os_name: macOS-x86_64 + os: macOS-latest + target: x86_64-apple-darwin + - os_name: macOS-aarch64 + os: macOS-latest + target: aarch64-apple-darwin + toolchain: + - stable + steps: + - uses: actions/checkout@v4 + - name: Cache cargo & target directories + uses: Swatinem/rust-cache@v2 + - name: Build binary + uses: houseabsolute/actions-rust-cross@v0 + with: + command: "build" + target: ${{ matrix.platform.target }} + toolchain: ${{ matrix.toolchain }} + args: "--locked --release --all-features" + strip: true + + - name: Install memflowup + run: cargo install --git https://github.com/memflow/memflowup + - run: echo "${{ secrets.MEMFLOW_REGISTRY_SIGNING_KEY}}" > ec-secp256k1-priv-key.pem + - name: Upload plugin (linux) + run: memflowup --skip-version-check push --token ${{ secrets.MEMFLOW_REGISTRY_TOKEN }} --priv-key ec-secp256k1-priv-key.pem --file target/${{ matrix.platform.target }}/release/libmemflow_${{ env.PLUGIN_NAME }}.so + if: matrix.platform.os == 'ubuntu-latest' + - name: Upload plugin (windows) + run: memflowup --skip-version-check push --token ${{ secrets.MEMFLOW_REGISTRY_TOKEN }} --priv-key ec-secp256k1-priv-key.pem --file target/${{ matrix.platform.target }}/release/memflow_${{ env.PLUGIN_NAME }}.dll + if: matrix.platform.os == 'windows-latest' + - name: Upload plugin (mac) + run: memflowup --skip-version-check push --token ${{ secrets.MEMFLOW_REGISTRY_TOKEN }} --priv-key ec-secp256k1-priv-key.pem --file target/${{ matrix.platform.target }}/release/libmemflow${{ env.PLUGIN_NAME }}.dylib + if: matrix.platform.os == 'macOS-latest' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 59c346b..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Release binaries - -on: - release: - types: [created] - -env: - CARGO_TERM_COLOR: always - -jobs: - - generate_ubuntu_x86-64: - name: Publish artifacts for ubuntu-latest (x86-64) - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Install rust 1.70.0 - uses: actions-rs/toolchain@v1 - with: - toolchain: 1.70.0 - override: true - - name: Build artifacts - run: cargo build --release --workspace --all-features --verbose - - name: Upload build artifacts - uses: skx/github-action-publish-binaries@master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - args: 'target/release/*.so'