From e553eff7ce7d768dfa1918a0a209891092e0d164 Mon Sep 17 00:00:00 2001 From: Alex Stokes Date: Tue, 17 Jan 2023 09:28:13 -0700 Subject: [PATCH 1/3] whitespace --- rustfmt.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rustfmt.toml b/rustfmt.toml index 8971d8ab..e70aee8c 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -6,4 +6,4 @@ wrap_comments = true binop_separator = "Back" trailing_comma = "Vertical" trailing_semicolon = false -use_field_init_shorthand = true \ No newline at end of file +use_field_init_shorthand = true From 412de7ff2558123712d29214661a759f2ae38b86 Mon Sep 17 00:00:00 2001 From: Alex Stokes Date: Tue, 17 Jan 2023 09:48:44 -0700 Subject: [PATCH 2/3] add toolchain file to pin version --- rust-toolchain.toml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 rust-toolchain.toml diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 00000000..99c6e11a --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,2 @@ +[toolchain] +channel = "1.66" From 68e7d92d3d819889ab8ef9091c5b74a9a7669aa5 Mon Sep 17 00:00:00 2001 From: Alex Stokes Date: Tue, 17 Jan 2023 09:39:59 -0700 Subject: [PATCH 3/3] standardize Github Actions --- .github/workflows/ci.yml | 62 ++++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 14 ++++---- .github/workflows/rust.yml | 63 ----------------------------------- justfile | 2 +- 4 files changed, 70 insertions(+), 71 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/rust.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..cfa603da --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,62 @@ +name: CI suite + +on: + push: + branches: [ main ] + pull_request: + 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 --verbose + + - name: Run tests + run: cargo test --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 --verbose -- -D warnings diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fe0c94fc..a7d328e2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: Release Suite +name: Release suite on: push: @@ -99,17 +99,17 @@ jobs: run: | body=$(cat <<- "ENDBODY" ${{ env.VERSION }} - + ## Changelog - + ${{ steps.changelog.outputs.CHANGELOG }} - + ## Binaries - + | System | Architecture | Binary | |:---:|:---:|:---:| - | | x86_64 | [mev-rs-${{ env.VERSION }}-x86_64-apple-darwin.tar.gz](https://github.com/${{ env.REPO_NAME }}/releases/download/${{ env.VERSION }}/mev-rs-${{ env.VERSION }}-x86_64-apple-darwin.tar.gz) | - | | x86_64 | [mev-rs-${{ env.VERSION }}-x86_64-unknown-linux-gnu.tar.gz](https://github.com/${{ env.REPO_NAME }}/releases/download/${{ env.VERSION }}/mev-rs-${{ env.VERSION }}-x86_64-unknown-linux-gnu.tar.gz) | + | | x86_64 | [mev-rs-${{ env.VERSION }}-x86_64-apple-darwin.tar.gz](https://github.com/${{ env.REPO_NAME }}/releases/download/${{ env.VERSION }}/mev-rs-${{ env.VERSION }}-x86_64-apple-darwin.tar.gz) | + | | x86_64 | [mev-rs-${{ env.VERSION }}-x86_64-unknown-linux-gnu.tar.gz](https://github.com/${{ env.REPO_NAME }}/releases/download/${{ env.VERSION }}/mev-rs-${{ env.VERSION }}-x86_64-unknown-linux-gnu.tar.gz) | ENDBODY ) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml deleted file mode 100644 index ae383fcd..00000000 --- a/.github/workflows/rust.yml +++ /dev/null @@ -1,63 +0,0 @@ -name: rust-ci - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -env: - CARGO_TERM_COLOR: always - -jobs: - build-and-test: - strategy: - matrix: - platform: [ ubuntu-latest ] - - runs-on: ${{ matrix.platform }} - - steps: - - uses: actions/checkout@v2 - - name: Install - run: rustup update stable - - name: Rust Cache - uses: Swatinem/rust-cache@v1 - with: - cache-on-failure: true - - name: Build - run: cargo build --all-targets --all-features --verbose - - name: Run tests - run: cargo test --verbose - - name: Validate config - run: cargo run config example.config.toml - - lint: - runs-on: ubuntu-latest - steps: - - name: Checkout sources - uses: actions/checkout@v2 - - - name: Install toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: nightly - profile: minimal - components: rustfmt, clippy - override: true - - - uses: Swatinem/rust-cache@v1 - with: - cache-on-failure: true - - - name: cargo fmt - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --all --check - - - name: cargo clippy - uses: actions-rs/clippy-check@v1 - with: - args: --all-targets --all-features -- -D warnings - token: ${{ secrets.GITHUB_TOKEN }} diff --git a/justfile b/justfile index ee8fa8cf..20874f65 100644 --- a/justfile +++ b/justfile @@ -15,7 +15,7 @@ test: fmt: cargo +nightly fmt --all lint: fmt validate-example-config - cargo clippy --all-targets --all-features + cargo +nightly clippy --all-targets --all-features build: cargo build --all-targets --all-features run-ci: lint build test