diff --git a/.github/workflows/checks.yaml b/.github/workflows/checks.yaml index 93353bb..5cd6f30 100644 --- a/.github/workflows/checks.yaml +++ b/.github/workflows/checks.yaml @@ -18,13 +18,11 @@ jobs: matrix: toolchain: - stable - #- beta - #- nightly + steps: - name: Checkout sources uses: actions/checkout@v4 - # https://github.com/dtolnay/rust-toolchain - name: Setup rust toolchain uses: dtolnay/rust-toolchain@stable with: @@ -32,14 +30,12 @@ jobs: - name: Install Protoc uses: arduino/setup-protoc@v3 - - # https://github.com/WarpBuilds/rust-cache + - name: Run WarpBuilds/rust-cache uses: WarpBuilds/rust-cache@v2 with: cache-on-failure: true - # https://github.com/Mozilla-Actions/sccache-action - name: Run sccache-action uses: mozilla-actions/sccache-action@v0.0.5 @@ -49,10 +45,7 @@ jobs: echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV - name: Install native dependencies - run: sudo apt-get install -y libsqlite3-dev - - ####################################################### + run: sudo apt-get update && sudo apt-get install -y libsqlite3-dev - # lint and test - run: make lint - run: make test diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index e42501b..a356a36 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -18,10 +18,6 @@ on: default: false jobs: - # - # extract-version extracts the version from the tag or the branch name, - # for reuse in later jobs - # extract-version: name: Extract version runs-on: warp-ubuntu-latest-x64-16x @@ -50,9 +46,6 @@ jobs: echo "| \`GITHUB_SHA\` | \`${GITHUB_SHA}\` |" >> $GITHUB_STEP_SUMMARY echo "| \`VERSION\` | \`${VERSION}\` |" >> $GITHUB_STEP_SUMMARY - # - # build-binary builds a release binary for a variety of platforms - # build-binary: name: Build binary needs: extract-version @@ -66,64 +59,40 @@ jobs: strategy: matrix: configs: - - target: x86_64-unknown-linux-gnu + - target: x86_64-unknown-linux-musl runner: warp-ubuntu-latest-x64-16x - - target: aarch64-apple-darwin - runner: warp-macos-14-arm64-6x steps: - name: Checkout sources uses: actions/checkout@v4 - # https://github.com/dtolnay/rust-toolchain - - name: Setup rust toolchain - uses: dtolnay/rust-toolchain@stable - with: - target: ${{ matrix.configs.target }} - - - name: Install Protoc - uses: arduino/setup-protoc@v3 - - # https://github.com/WarpBuilds/rust-cache - name: Run WarpBuilds/rust-cache uses: WarpBuilds/rust-cache@v2 with: cache-on-failure: true - # https://github.com/Mozilla-Actions/sccache-action - - name: Setup sccache-action - uses: mozilla-actions/sccache-action@v0.0.5 - - - name: Set env vars - run: | - echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV - echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV - - name: Prepare output filename run: | OUTPUT_FILENAME="rbuilder-${VERSION}-${{ matrix.configs.target }}.tar.gz" echo "OUTPUT_FILENAME=$OUTPUT_FILENAME" >> $GITHUB_ENV echo "Filename: ${OUTPUT_FILENAME}" - - name: Build rbuilder binary - run: cargo build --release + - uses: taiki-e/install-action@cross + + - name: Build binary + run: cross build --release --target ${{ matrix.configs.target }} - name: Prepare artifacts run: | mkdir -p artifacts - tar -czf "artifacts/${OUTPUT_FILENAME}" -C target/release rbuilder + tar -czf "artifacts/${OUTPUT_FILENAME}" -C target/${{ matrix.configs.target }}/release rbuilder - # https://github.com/actions/upload-artifact - name: Upload artifacts uses: actions/upload-artifact@v4.3.1 with: name: ${{ env.OUTPUT_FILENAME }} path: artifacts/${{ env.OUTPUT_FILENAME }} - # - # draft-release runs after building for various targets, collects artifacts and prepares a draft release - # (only when running against a tag!) - # draft-release: name: Draft release if: ${{ github.event.inputs.draft-release == 'true' || github.event_name == 'push'}} # when manually triggered or version tagged @@ -137,7 +106,6 @@ jobs: - name: Checkout uses: actions/checkout@v4 - # https://github.com/actions/download-artifact - name: Download artifacts uses: actions/download-artifact@v4 with: @@ -151,7 +119,6 @@ jobs: for file in *; do sha256sum "$file" >> sha256sums.txt; done; cat sha256sums.txt - # https://github.com/softprops/action-gh-release - name: Create release draft uses: softprops/action-gh-release@v2.0.5 id: create-release-draft diff --git a/Cargo.lock b/Cargo.lock index 0c00f11..f9e41af 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5859,6 +5859,15 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" +[[package]] +name = "openssl-src" +version = "300.4.0+3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a709e02f2b4aca747929cca5ed248880847c650233cf8b8cdc48f40aaf4898a6" +dependencies = [ + "cc", +] + [[package]] name = "openssl-sys" version = "0.9.103" @@ -5867,6 +5876,7 @@ checksum = "7f9e8deee91df40a943c71b917e5874b951d32a802526c85721ce3b776c929d6" dependencies = [ "cc", "libc", + "openssl-src", "pkg-config", "vcpkg", ] @@ -7211,6 +7221,7 @@ dependencies = [ "lazy_static", "metrics_macros", "mockall", + "openssl", "prometheus", "prost", "rand 0.8.5", diff --git a/Cargo.toml b/Cargo.toml index 82c714e..c8e9b4f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,6 +4,7 @@ version = "0.1.0" edition = "2021" [dependencies] +openssl = { version = "0.10", features = ["vendored"], optional = false } clap = { version = "4.4.3", features = ["derive", "env"] } tokio = "1.32.0" tokio-util = "0.7.10" @@ -46,7 +47,6 @@ tower = "0.4" metrics_macros = { git = "https://github.com/flashbots/rbuilder.git", rev = "d96e7215483bac0ab145459f4ddaa811d99459d6"} -#rbuilder = {path="./../rbuilder/crates/rbuilder"} rbuilder = { git = "https://github.com/flashbots/rbuilder.git", rev = "d96e7215483bac0ab145459f4ddaa811d99459d6"} [build-dependencies] diff --git a/Cross.toml b/Cross.toml new file mode 100644 index 0000000..5a58b58 --- /dev/null +++ b/Cross.toml @@ -0,0 +1,7 @@ +[target.x86_64-unknown-linux-musl] +pre-build = [ + "apt-get update && apt-get install -y pkg-config libssl-dev curl unzip", + "curl -sSL https://github.com/protocolbuffers/protobuf/releases/download/v24.3/protoc-24.3-linux-x86_64.zip -o protoc.zip", + "unzip protoc.zip -d /usr/local", + "chmod +x /usr/local/bin/protoc" +] diff --git a/Makefile b/Makefile index 7a78754..69847aa 100644 --- a/Makefile +++ b/Makefile @@ -22,8 +22,8 @@ clean: ## Clean up cargo clean .PHONY: build -build: ## Build (debug version) - cargo build +build: ## Build static binary for x86_64 + cross build --release --target x86_64-unknown-linux-musl .PHONY: docker-image docker-image: ## Build a rbuilder Docker image