From 76c9aa176831783f267a16baf0f2faf7df700cda Mon Sep 17 00:00:00 2001 From: Gary Krause Date: Thu, 12 Dec 2024 19:21:30 -0500 Subject: [PATCH] fix: clarify logging chore: update names to a pattern, and also organize bash scripts to github inside a workflows directory chore: adjust wrong clippy.sh file. chore: update general-check.yaml to rust-check.yaml, and job names to lower case, and create bash script to ci job. chore: remove comments, and add perm to test.sh chore: remove test.yaml, rust-msrv.yaml, semver-check.yaml, lockfiles.yaml, fmt.yaml, clippy-lint.yaml, and add general-check.yaml to combine all in one file. chore: fix MSRV incorrect job syntax chore: update general-check to be more clean --- .github/workflows/general-check.yaml | 90 ++++++++++++++++++++-------- scripts/build_projects.sh | 5 -- scripts/run_clippy.sh | 10 ---- scripts/run_fmt.sh | 10 ---- scripts/run_semver_checks.sh | 25 -------- 5 files changed, 64 insertions(+), 76 deletions(-) delete mode 100755 scripts/build_projects.sh delete mode 100755 scripts/run_clippy.sh delete mode 100755 scripts/run_fmt.sh delete mode 100755 scripts/run_semver_checks.sh diff --git a/.github/workflows/general-check.yaml b/.github/workflows/general-check.yaml index 0c5c235c1..80c461cba 100644 --- a/.github/workflows/general-check.yaml +++ b/.github/workflows/general-check.yaml @@ -23,7 +23,23 @@ jobs: toolchain: ${{ matrix.rust }} override: true - name: Build Projects - run: ./scripts/build_projects.sh + run: | + cargo build --manifest-path=benches/Cargo.toml + cargo build --manifest-path=protocols/Cargo.toml + cargo build --manifest-path=roles/Cargo.toml + cargo build --manifest-path=utils/Cargo.toml + + shared-strategy: &shared-strategy + strategy: + matrix: + os: + - macos-latest + - ubuntu-latest + include: + - os: macos-latest + target: x86_64-apple-darwin + - os: ubuntu-latest + target: x86_64-unknown-linux-musl Semver-check: runs-on: ubuntu-latest @@ -49,21 +65,35 @@ jobs: - run: sudo apt-get update && sudo apt-get install -y cmake - run: cargo install cargo-semver-checks --version 0.37.0 --locked - name: Run Semver Checks - run: ./scripts/run_semver_checks.sh + run: | + for dir in \ + common \ + utils/buffer \ + protocols/v2/binary-sv2/no-serde-sv2/codec \ + protocols/v2/binary-sv2/serde-sv2 \ + protocols/v2/binary-sv2/binary-sv2 \ + protocols/v2/const-sv2 \ + protocols/v2/framing-sv2 \ + protocols/v2/noise-sv2 \ + protocols/v2/codec-sv2 \ + protocols/v2/subprotocols/common-messages \ + protocols/v2/subprotocols/job-declaration \ + protocols/v2/subprotocols/mining \ + protocols/v2/subprotocols/template-distribution \ + protocols/v2/sv2-ffi \ + protocols/v2/roles-logic-sv2 \ + protocols/v1 \ + utils/bip32-key-derivation \ + utils/error-handling \ + utils/key-utils \ + roles/roles-utils/network-helpers \ + roles/roles-utils/rpc; do + cargo semver-checks --manifest-path="$dir/Cargo.toml" + done Rust-fmt: + <<: *shared-strategy runs-on: ${{ matrix.os }} - strategy: - matrix: - os: - - macos-latest - - ubuntu-latest - include: - - os: macos-latest - target: x86_64-apple-darwin - - os: ubuntu-latest - target: x86_64-unknown-linux-musl - steps: - uses: actions/checkout@v4 - uses: actions-rs/toolchain@v1 @@ -73,21 +103,20 @@ jobs: override: true components: rustfmt - name: Run fmt in different workspaces and crates - run: ./scripts/run_fmt.sh + run: | + for manifest in \ + benches/Cargo.toml \ + common/Cargo.toml \ + protocols/Cargo.toml \ + roles/Cargo.toml \ + utils/Cargo.toml \ + utils/message-generator/Cargo.toml; do + cargo fmt --all --manifest-path=$manifest -- --check + done clippy-check-lint: + <<: *shared-strategy runs-on: ${{ matrix.os }} - strategy: - matrix: - os: - - macos-latest - - ubuntu-latest - include: - - os: macos-latest - target: x86_64-apple-darwin - - os: ubuntu-latest - target: x86_64-unknown-linux-musl - steps: - uses: actions/checkout@v4 - uses: actions-rs/toolchain@v1 @@ -97,4 +126,13 @@ jobs: override: true components: clippy - name: Run Clippy on different workspaces and crates - run: ./scripts/run_clippy.sh + run: | + for manifest in \ + benches/Cargo.toml \ + common/Cargo.toml \ + protocols/Cargo.toml \ + roles/Cargo.toml \ + utils/Cargo.toml \ + utils/message-generator/Cargo.toml; do + cargo clippy --manifest-path=$manifest -- -D warnings -A dead-code + done diff --git a/scripts/build_projects.sh b/scripts/build_projects.sh deleted file mode 100755 index b95c7d9ab..000000000 --- a/scripts/build_projects.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -cargo build --manifest-path=benches/Cargo.toml -cargo build --manifest-path=protocols/Cargo.toml -cargo build --manifest-path=roles/Cargo.toml -cargo build --manifest-path=utils/Cargo.toml diff --git a/scripts/run_clippy.sh b/scripts/run_clippy.sh deleted file mode 100755 index 0238578a7..000000000 --- a/scripts/run_clippy.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -for manifest in \ - benches/Cargo.toml \ - common/Cargo.toml \ - protocols/Cargo.toml \ - roles/Cargo.toml \ - utils/Cargo.toml \ - utils/message-generator/Cargo.toml; do - cargo clippy --manifest-path=$manifest -- -D warnings -A dead-code -done diff --git a/scripts/run_fmt.sh b/scripts/run_fmt.sh deleted file mode 100755 index 3513fcd1f..000000000 --- a/scripts/run_fmt.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -for manifest in \ - benches/Cargo.toml \ - common/Cargo.toml \ - protocols/Cargo.toml \ - roles/Cargo.toml \ - utils/Cargo.toml \ - utils/message-generator/Cargo.toml; do - cargo fmt --all --manifest-path=$manifest -- --check -done diff --git a/scripts/run_semver_checks.sh b/scripts/run_semver_checks.sh deleted file mode 100755 index d517e1958..000000000 --- a/scripts/run_semver_checks.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -for dir in \ - common \ - utils/buffer \ - protocols/v2/binary-sv2/no-serde-sv2/codec \ - protocols/v2/binary-sv2/serde-sv2 \ - protocols/v2/binary-sv2/binary-sv2 \ - protocols/v2/const-sv2 \ - protocols/v2/framing-sv2 \ - protocols/v2/noise-sv2 \ - protocols/v2/codec-sv2 \ - protocols/v2/subprotocols/common-messages \ - protocols/v2/subprotocols/job-declaration \ - protocols/v2/subprotocols/mining \ - protocols/v2/subprotocols/template-distribution \ - protocols/v2/sv2-ffi \ - protocols/v2/roles-logic-sv2 \ - protocols/v1 \ - utils/bip32-key-derivation \ - utils/error-handling \ - utils/key-utils \ - roles/roles-utils/network-helpers \ - roles/roles-utils/rpc; do - cargo semver-checks --manifest-path="$dir/Cargo.toml" -done