diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f61d621..41020a6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,14 +1,17 @@ name: Build and test -on: [push, pull_request] +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] @@ -19,20 +22,6 @@ jobs: - run: cargo build ${{ matrix.flags }} --release - run: cargo build ${{ matrix.flags }} --release --examples - build-cross: - runs-on: ubuntu-latest - strategy: - matrix: - flags: [--all-features, --no-default-features] - steps: - - uses: actions/checkout@v4 - - uses: houseabsolute/actions-rust-cross@v0 - with: - command: build - target: aarch64-unknown-linux-gnu - args: "--locked ${{ matrix.flags }} --release" - strip: true - test: runs-on: ${{ matrix.os }} strategy: diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index c29493b..7b9ed33 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,32 +1,91 @@ name: Deploy to memflow registry -on: [push] +on: + push: + branches: + - "**" env: + RUST_BACKTRACE: 1 CARGO_TERM_COLOR: always jobs: - - build_linux_x86_64: - name: Build artifacts for ubuntu-latest (x86-64) - runs-on: ubuntu-latest + 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-20.04 + target: x86_64-unknown-linux-musl + extension: *.so + - os_name: Linux-aarch64 + os: ubuntu-20.04 + target: aarch64-unknown-linux-musl + extension: *.so + - os_name: Linux-arm + os: ubuntu-20.04 + target: arm-unknown-linux-musleabi + extension: *.so + - os_name: Linux-i686 + os: ubuntu-20.04 + target: i686-unknown-linux-musl + extension: *.so + skip_tests: true + - os_name: Windows-aarch64 + os: windows-latest + target: aarch64-pc-windows-msvc + extension: *.dll + skip_tests: true + - os_name: Windows-i686 + os: windows-latest + target: i686-pc-windows-msvc + extension: *.dll + skip_tests: true + - os_name: Windows-x86_64 + os: windows-latest + target: x86_64-pc-windows-msvc + extension: *.dll + - os_name: macOS-x86_64 + os: macOS-latest + target: x86_64-apple-darwin + extension: *.dylib + - os_name: macOS-aarch64 + os: macOS-latest + target: aarch64-apple-darwin + extension: *.dylib + toolchain: + - stable steps: - uses: actions/checkout@v4 - - run: cargo build --release --all-features - - uses: actions/upload-artifact@v4 + - name: Cache cargo & target directories + uses: Swatinem/rust-cache@v2 + - name: Install musl-tools on Linux + run: sudo apt-get update --yes && sudo apt-get install --yes musl-tools + if: contains(matrix.platform.name, 'musl') + - name: Build binary + uses: houseabsolute/actions-rust-cross@v0 + with: + command: "build" + target: ${{ matrix.platform.target }} + toolchain: ${{ matrix.toolchain }} + args: "--locked --release" + strip: true + - name: Run tests + uses: houseabsolute/actions-rust-cross@v0 with: - name: library-ubuntu-x86-64 - path: target/release/*.so + command: "test" + target: ${{ matrix.platform.target }} + toolchain: ${{ matrix.toolchain }} + args: "--locked --release" + if: ${{ !matrix.platform.skip_tests }} - deploy_plugins: - name: Deploy plugins - runs-on: ubuntu-latest - needs: [build_linux_x86_64] - steps: - - run: cargo install --git https://github.com/memflow/memflowup + - name: Install memflowup + run: cargo install --git https://github.com/memflow/memflowup - run: echo "${{ secrets.MEMFLOW_REGISTRY_SIGNING_KEY}}" > ec-secp256k1-priv-key.pem - - - uses: actions/download-artifact@v4 - with: - name: library-ubuntu-x86-64 - - run: memflowup --skip-version-check push --token ${{ secrets.MEMFLOW_REGISTRY_TOKEN }} --priv-key ec-secp256k1-priv-key.pem *.so + - name: Upload plugin + run: | + cd target/${{ matrix.platform.target }}/release + memflowup --skip-version-check push --token ${{ secrets.MEMFLOW_REGISTRY_TOKEN }} --priv-key ec-secp256k1-priv-key.pem ${{ matrix.extension }}