From 2212d175c62e04b2bc66195142b5391908f1c3d5 Mon Sep 17 00:00:00 2001 From: Alex Stokes Date: Tue, 14 May 2024 09:37:32 +0300 Subject: [PATCH 1/3] fix path in dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 78c0ee25..f7f4f476 100644 --- a/Dockerfile +++ b/Dockerfile @@ -30,6 +30,6 @@ WORKDIR /app EXPOSE 18550 EXPOSE 28545 -COPY --from=builder mev /usr/local/bin +COPY --from=builder /app/mev /usr/local/bin ENTRYPOINT [ "/usr/local/bin/mev" ] From 6ba71326737f9656fc0c43cd4963a833c8399203 Mon Sep 17 00:00:00 2001 From: Alex Stokes Date: Tue, 14 May 2024 09:38:41 +0300 Subject: [PATCH 2/3] fmt yaml --- .github/workflows/book.yml | 15 ------- .github/workflows/ci.yml | 17 +------- .github/workflows/docker.yml | 81 ++++++++++++++++------------------- .github/workflows/release.yml | 36 ++++------------ 4 files changed, 49 insertions(+), 100 deletions(-) diff --git a/.github/workflows/book.yml b/.github/workflows/book.yml index adf0dabd..4e677740 100644 --- a/.github/workflows/book.yml +++ b/.github/workflows/book.yml @@ -1,12 +1,10 @@ # cribbed from: https://github.com/paradigmxyz/reth/blob/21db2936e617d1018c0bfa5690d8f035dee2843f/.github/workflows/book.yml name: book - on: push: branches: [main] pull_request: branches: [main] - jobs: # test: # runs-on: ubuntu-latest @@ -47,39 +45,31 @@ jobs: # - name: Run linkcheck # run: mdbook-linkcheck --standalone - build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 with: fetch-depth: 0 - - name: Install toolchain uses: dtolnay/rust-toolchain@master with: toolchain: nightly - - uses: Swatinem/rust-cache@v2 with: cache-on-failure: true - - name: Install mdbook run: | mkdir mdbook curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.14/mdbook-v0.4.14-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook echo `pwd`/mdbook >> $GITHUB_PATH - - name: Build book run: mdbook build - - name: Build docs run: RUSTDOCFLAGS="--enable-index-page -Zunstable-options" cargo +nightly doc --all --no-deps - - name: Move docs to book folder run: | mv target/doc target/book/docs - - name: Archive artifact shell: sh run: | @@ -94,7 +84,6 @@ jobs: --exclude=.git \ --exclude=.github \ . - - name: Upload artifact uses: actions/upload-artifact@v3 with: @@ -102,22 +91,18 @@ jobs: path: ${{ runner.temp }}/artifact.tar retention-days: 1 if-no-files-found: error - deploy: # Only deploy if a push to main if: github.ref_name == 'main' && github.event_name == 'push' runs-on: ubuntu-latest needs: [build] - # Grant GITHUB_TOKEN the permissions required to make a Pages deployment permissions: pages: write id-token: write - environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} - steps: - name: Deploy to GitHub Pages id: deployment diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6f28ebb7..4a97db38 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,62 +1,49 @@ name: CI suite - on: push: - branches: [ main ] + branches: [main] pull_request: - branches: [ main ] - + branches: [main] jobs: build: runs-on: ubuntu-latest steps: - name: Checkout sources uses: actions/checkout@v3 - - name: Read toolchain file id: rust-toolchain run: | RUST_TOOLCHAIN=$(grep 'channel' rust-toolchain.toml | awk '{split($0,a," = "); print a[2]}' | tr -d '"') echo "RUST_TOOLCHAIN=$RUST_TOOLCHAIN" >> $GITHUB_OUTPUT shell: bash - - name: Install toolchain uses: dtolnay/rust-toolchain@master with: toolchain: ${{ steps.rust-toolchain.outputs.RUST_TOOLCHAIN }} - - name: Rust cache uses: Swatinem/rust-cache@v2 with: cache-on-failure: true - - name: Build run: cargo build --all-targets --all-features --all --verbose - - name: Run tests run: cargo test --all --verbose - - name: Validate config run: cargo run config example.config.toml - lint: runs-on: ubuntu-latest steps: - name: Checkout sources uses: actions/checkout@v3 - - name: Install toolchain uses: dtolnay/rust-toolchain@nightly with: components: rustfmt, clippy - - name: Rust cache uses: Swatinem/rust-cache@v2 with: cache-on-failure: true - - name: Check format run: cargo +nightly fmt --all --check - - name: Check clippy run: cargo +nightly clippy --all-targets --all-features --all --verbose -- -D warnings diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 5b6cacb9..522f1df2 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,56 +1,51 @@ name: docker - on: push: - branches: - - main + branches: + - main tags: - v* - concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true - env: IMAGE_NAME: ${{ github.repository_owner}}/mev-rs - jobs: extract-version: - runs-on: ubuntu-22.04 - steps: - - name: Extract version (if main) - if: github.event.ref == 'refs/heads/main' - run: | - echo "VERSION=latest" >> $GITHUB_ENV - - name: Extract version (if tagged release) - if: startsWith(github.event.ref, 'refs/tags') - run: | - echo "VERSION=$(echo ${GITHUB_REF#refs/tags/})" >> $GITHUB_ENV - outputs: - VERSION: ${{ env.VERSION }} + runs-on: ubuntu-22.04 + steps: + - name: Extract version (if main) + if: github.event.ref == 'refs/heads/main' + run: | + echo "VERSION=latest" >> $GITHUB_ENV + - name: Extract version (if tagged release) + if: startsWith(github.event.ref, 'refs/tags') + run: | + echo "VERSION=$(echo ${GITHUB_REF#refs/tags/})" >> $GITHUB_ENV + outputs: + VERSION: ${{ env.VERSION }} build-docker: - name: build-docker-${{ matrix.binary }} - runs-on: ubuntu-22.04 - strategy: - matrix: - binary: [x86_64] - include: - - profile: maxperf - - needs: [extract-version] - env: - VERSION: ${{ needs.extract-version.outputs.VERSION }} - steps: - - uses: actions/checkout@v4 - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME}} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Build and push - uses: docker/build-push-action@v5 - with: - push: true - tags: ${{ env.IMAGE_NAME }}:${{ env.VERSION }} + name: build-docker-${{ matrix.binary }} + runs-on: ubuntu-22.04 + strategy: + matrix: + binary: [x86_64] + include: + - profile: maxperf + needs: [extract-version] + env: + VERSION: ${{ needs.extract-version.outputs.VERSION }} + steps: + - uses: actions/checkout@v4 + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME}} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Build and push + uses: docker/build-push-action@v5 + with: + push: true + tags: ${{ env.IMAGE_NAME }}:${{ env.VERSION }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 854ee632..9d34b91d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,14 +1,11 @@ name: Release suite - on: push: tags: - v* - concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true - jobs: extract-version: runs-on: ubuntu-latest @@ -22,60 +19,51 @@ jobs: name: Build Release strategy: matrix: - arch: [x86_64-unknown-linux-gnu, - x86_64-apple-darwin] + arch: [x86_64-unknown-linux-gnu, x86_64-apple-darwin] include: - - arch: x86_64-unknown-linux-gnu - platform: ubuntu-latest - - arch: x86_64-apple-darwin - platform: macos-latest - + - arch: x86_64-unknown-linux-gnu + platform: ubuntu-latest + - arch: x86_64-apple-darwin + platform: macos-latest runs-on: ${{ matrix.platform }} needs: extract-version steps: - name: Checkout sources uses: actions/checkout@v4 - - name: Read toolchain file id: rust-toolchain run: | RUST_TOOLCHAIN=$(grep 'channel' rust-toolchain.toml | awk '{split($0,a," = "); print a[2]}' | tr -d '"') echo "RUST_TOOLCHAIN=$RUST_TOOLCHAIN" >> $GITHUB_OUTPUT shell: bash - - name: Install toolchain uses: dtolnay/rust-toolchain@master with: toolchain: ${{ steps.rust-toolchain.outputs.RUST_TOOLCHAIN }} - # ============================== # Build # ============================== - - name: Build mev-rs - run: | + run: | cargo install --profile maxperf --path bin/mev --locked mkdir artifacts mv ~/.cargo/bin/mev ./artifacts cd artifacts tar -czf mev-rs-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.arch }}.tar.gz mev mv *tar.gz* .. - # ======================================================================= # Upload artifacts # This is required to share artifacts between different jobs # ======================================================================= - - - name: Upload artifact - uses: actions/upload-artifact@v4 + - name: Upload artifact + uses: actions/upload-artifact@v4 with: name: mev-rs-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.arch }}.tar.gz path: mev-rs-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.arch }}.tar.gz compression-level: 0 - draft-release: name: Draft Release - needs: [build, extract-version] + needs: [build, extract-version] runs-on: ubuntu-latest env: VERSION: ${{ needs.extract-version.outputs.VERSION }} @@ -85,30 +73,24 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 - # ============================== # Download artifacts # ============================== - - name: Download artifacts uses: actions/download-artifact@v4 - # ============================== # Create release draft # ============================== - - name: Generate Full Changelog id: changelog run: | echo "CHANGELOG<> $GITHUB_OUTPUT echo "$(git log --pretty=format:"- %s" $(git describe --tags --abbrev=0 ${{ env.VERSION }}^)..${{ env.VERSION }})" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT - - name: Create Release Draft env: GITHUB_USER: ${{ github.repository_owner }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # The formatting here is adapted from OpenEthereum: https://github.com/openethereum/openethereum/blob/main/.github/workflows/build.yml run: | body=$(cat <<- "ENDBODY" From 22778ae1354800c6a5e458136eac2f569450d95c Mon Sep 17 00:00:00 2001 From: Alex Stokes Date: Tue, 14 May 2024 09:40:56 +0300 Subject: [PATCH 3/3] fix formatting in docker action --- .github/workflows/docker.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 522f1df2..b792fd68 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -3,8 +3,8 @@ on: push: branches: - main - tags: - - v* + tags: + - v* concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true