From 77ced6e61850deb882f47aeb7b433e85eff1310b Mon Sep 17 00:00:00 2001 From: devworlds Date: Fri, 20 Dec 2024 01:03:09 -0300 Subject: [PATCH 01/24] 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. --- .github/workflows/clippy-lint.yaml | 40 ---- .github/workflows/fmt.yaml | 40 ---- .github/workflows/general-check.yaml | 315 +++++++++++++++++++++++++++ .github/workflows/lockfiles.yaml | 28 --- .github/workflows/rust-msrv.yaml | 35 --- .github/workflows/semver-check.yaml | 129 ----------- .github/workflows/test.yaml | 95 -------- 7 files changed, 315 insertions(+), 367 deletions(-) delete mode 100644 .github/workflows/clippy-lint.yaml delete mode 100644 .github/workflows/fmt.yaml create mode 100644 .github/workflows/general-check.yaml delete mode 100644 .github/workflows/lockfiles.yaml delete mode 100644 .github/workflows/rust-msrv.yaml delete mode 100644 .github/workflows/semver-check.yaml delete mode 100644 .github/workflows/test.yaml diff --git a/.github/workflows/clippy-lint.yaml b/.github/workflows/clippy-lint.yaml deleted file mode 100644 index b8d4cba361..0000000000 --- a/.github/workflows/clippy-lint.yaml +++ /dev/null @@ -1,40 +0,0 @@ -on: - push: - branches: - - main - pull_request: - branches: - - main - -name: Clippy Lint - -jobs: - clippy-check: - 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 - with: - profile: minimal - toolchain: 1.75.0 - override: true - components: clippy - - name: Run Clippy on different workspaces and crates - run: | - cargo clippy --manifest-path=benches/Cargo.toml -- -D warnings -A dead-code - cargo clippy --manifest-path=common/Cargo.toml -- -D warnings -A dead-code - cargo clippy --manifest-path=protocols/Cargo.toml -- -D warnings -A dead-code - cargo clippy --manifest-path=roles/Cargo.toml -- -D warnings -A dead-code - cargo clippy --manifest-path=utils/Cargo.toml -- -D warnings -A dead-code - cargo clippy --manifest-path=utils/message-generator/Cargo.toml -- -D warnings -A dead-code diff --git a/.github/workflows/fmt.yaml b/.github/workflows/fmt.yaml deleted file mode 100644 index 181fc6088f..0000000000 --- a/.github/workflows/fmt.yaml +++ /dev/null @@ -1,40 +0,0 @@ -on: - push: - branches: - - main - pull_request: - branches: - - main - -name: Rustfmt - -jobs: - fmt: - 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 - with: - profile: minimal - toolchain: nightly - override: true - components: rustfmt - - name: Run fmt in different workspaces and crates - run: | - cargo fmt --all --manifest-path=benches/Cargo.toml -- --check - cargo fmt --all --manifest-path=common/Cargo.toml -- --check - cargo fmt --all --manifest-path=protocols/Cargo.toml -- --check - cargo fmt --all --manifest-path=roles/Cargo.toml -- --check - cargo fmt --all --manifest-path=utils/Cargo.toml -- --check - cargo fmt --all --manifest-path=utils/message-generator/Cargo.toml -- --check diff --git a/.github/workflows/general-check.yaml b/.github/workflows/general-check.yaml new file mode 100644 index 0000000000..8069a5f010 --- /dev/null +++ b/.github/workflows/general-check.yaml @@ -0,0 +1,315 @@ +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + + MSRV-1.75-Check: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + rust: + - 1.75.0 # MSRV + + steps: + - uses: actions/checkout@v2 + - uses: Swatinem/rust-cache@v1.2.0 + - uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.rust }} + override: true + - name: Build Benches + run: cargo build --manifest-path=benches/Cargo.toml + - name: Build Protocols + run: cargo build --manifest-path=protocols/Cargo.toml + - name: Build Roles + run: cargo build --manifest-path=roles/Cargo.toml + - name: Build Utils + run: cargo build --manifest-path=utils/Cargo.toml + + semver-check: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Install Rust stable + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + + - name: Cache Cargo registry + uses: actions/cache@v2 + with: + path: ~/.cargo/registry + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-registry- + + - name: Cache Cargo index + uses: actions/cache@v2 + with: + path: ~/.cargo/git + key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-index- + + - name: Install dependencies + run: sudo apt-get update && sudo apt-get install -y cmake + + - name: Install cargo-semver-checks + run: cargo install cargo-semver-checks --version 0.37.0 --locked + + - name: Run semver checks for common + working-directory: common + run: cargo semver-checks + + - name: Run semver checks for utils/buffer + working-directory: utils/buffer + run: cargo semver-checks + + - name: Run semver checks for protocols/v2/binary-sv2/no-serde-sv2/codec + working-directory: protocols/v2/binary-sv2/no-serde-sv2/codec + run: cargo semver-checks + + - name: Run semver checks for protocols/v2/binary-sv2/serde-sv2 + working-directory: protocols/v2/binary-sv2/serde-sv2 + run: cargo semver-checks + + - name: Run semver checks for protocols/v2/binary-sv2/binary-sv2 + working-directory: protocols/v2/binary-sv2/binary-sv2 + run: cargo semver-checks + + - name: Run semver checks for protocols/v2/const-sv2 + working-directory: protocols/v2/const-sv2 + run: cargo semver-checks + + - name: Run semver checks for protocols/v2/framing-sv2 + working-directory: protocols/v2/framing-sv2 + run: cargo semver-checks + + - name: Run semver checks for protocols/v2/noise-sv2 + working-directory: protocols/v2/noise-sv2 + run: cargo semver-checks + + - name: Run semver checks for protocols/v2/codec-sv2 + working-directory: protocols/v2/codec-sv2 + run: cargo semver-checks + + - name: Run semver checks for protocols/v2/subprotocols/common-messages + working-directory: protocols/v2/subprotocols/common-messages + run: cargo semver-checks + + - name: Run semver checks for protocols/v2/subprotocols/job-declaration + working-directory: protocols/v2/subprotocols/job-declaration + run: cargo semver-checks + + - name: Run semver checks for protocols/v2/subprotocols/mining + working-directory: protocols/v2/subprotocols/mining + run: cargo semver-checks + + - name: Run semver checks for protocols/v2/subprotocols/template-distribution + working-directory: protocols/v2/subprotocols/template-distribution + run: cargo semver-checks + + - name: Run semver checks for protocols/v2/sv2-ffi + working-directory: protocols/v2/sv2-ffi + run: cargo semver-checks + + - name: Run semver checks for protocols/v2/roles-logic-sv2 + working-directory: protocols/v2/roles-logic-sv2 + run: cargo semver-checks --default-features + + - name: Run semver checks for protocols/v1 + working-directory: protocols/v1 + run: cargo semver-checks + + - name: Run semver checks for utils/bip32-key-derivation + working-directory: utils/bip32-key-derivation + run: cargo semver-checks + + - name: Run semver checks for utils/error-handling + working-directory: utils/error-handling + run: cargo semver-checks + + - name: Run semver checks for utils/key-utils + working-directory: utils/key-utils + run: cargo semver-checks + + - name: Run semver checks for roles/roles-utils/network-helpers + working-directory: roles/roles-utils/network-helpers + run: cargo semver-checks + + - name: Run semver checks for roles/roles-utils/rpc + working-directory: roles/roles-utils/rpc + run: cargo semver-checks + + Lockfiles: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + + - name: Build with locked dependencies + run: | + cargo build --manifest-path=roles/Cargo.toml --locked + cargo build --manifest-path=utils/Cargo.toml --locked + + Rust-fmt: + 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 + with: + profile: minimal + toolchain: nightly + override: true + components: rustfmt + - name: Run fmt in different workspaces and crates + run: | + cargo fmt --all --manifest-path=benches/Cargo.toml -- --check + cargo fmt --all --manifest-path=common/Cargo.toml -- --check + cargo fmt --all --manifest-path=protocols/Cargo.toml -- --check + cargo fmt --all --manifest-path=roles/Cargo.toml -- --check + cargo fmt --all --manifest-path=utils/Cargo.toml -- --check + cargo fmt --all --manifest-path=utils/message-generator/Cargo.toml -- --check + + clippy-check-lint: + 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 + with: + profile: minimal + toolchain: 1.75.0 + override: true + components: clippy + - name: Run Clippy on different workspaces and crates + run: | + cargo clippy --manifest-path=benches/Cargo.toml -- -D warnings -A dead-code + cargo clippy --manifest-path=common/Cargo.toml -- -D warnings -A dead-code + cargo clippy --manifest-path=protocols/Cargo.toml -- -D warnings -A dead-code + cargo clippy --manifest-path=roles/Cargo.toml -- -D warnings -A dead-code + cargo clippy --manifest-path=utils/Cargo.toml -- -D warnings -A dead-code + cargo clippy --manifest-path=utils/message-generator/Cargo.toml -- -D warnings -A dead-code + + Tests-ci: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - macos-13 + - ubuntu-latest + include: + - os: macos-13 + target: x86_64-apple-darwin + - os: ubuntu-latest + target: x86_64-unknown-linux-musl + + steps: + - name: Install stable toolchain & components + uses: actions/checkout@v4 + with: + profile: minimal + toolchain: nightly + override: true + + - name: Build + run: | + cargo build --manifest-path=benches/Cargo.toml + cargo build --manifest-path=common/Cargo.toml + cargo build --manifest-path=protocols/Cargo.toml + cargo build --manifest-path=roles/Cargo.toml + cargo build --manifest-path=utils/Cargo.toml + + - name: Roles Integration Tests + run: | + cargo test --manifest-path=roles/Cargo.toml --verbose --test '*' -- --nocapture + + - name: Run sv1-client-and-server example + run: | + cargo run --manifest-path=examples/sv1-client-and-server/Cargo.toml --bin client_and_server -- 60 + + - name: interop-test + run: | + if [ ${{ matrix.os }} == "ubuntu-latest" ]; then + ./run.sh 30 + else + echo "Skipping interop-test on ${{ matrix.os }} - not supported" + fi + working-directory: examples/interop-cpp/ + + # TODO this is only usefull if we want to build c bindings with guix + #- name: interop-no-cargo-test + # run: | + # if [ ${{ matrix.os }} == "ubuntu-latest" ]; then + # ./run.sh 30 + # else + # echo "Skipping interop-test on ${{ matrix.os }} - not supported" + # fi + # working-directory: examples/interop-cpp-no-cargo/ + + - name: fuzz tests + run: | + if [ ${{ matrix.os }} == "ubuntu-latest" ]; then + ./run.sh 30 + else + echo "Skipping fuzz test on ${{ matrix.os }} - not supported" + fi + working-directory: utils/buffer/fuzz + + - name: Test + run: | + cargo test --manifest-path=benches/Cargo.toml + cargo test --manifest-path=common/Cargo.toml + cargo test --manifest-path=protocols/Cargo.toml + cargo test --manifest-path=roles/Cargo.toml + cargo test --manifest-path=utils/Cargo.toml + + - name: Property based testing + run: | + cargo test --manifest-path=protocols/Cargo.toml --features prop_test + + - name: Run ping-pong-with-noise example + run: | + cargo run --manifest-path=examples/ping-pong-with-noise/Cargo.toml --bin ping_pong_with_noise -- 10 + + - name: Run ping-pong-without-noise example + run: | + cargo run --manifest-path=examples/ping-pong-without-noise/Cargo.toml --bin ping_pong_without_noise -- 10 + \ No newline at end of file diff --git a/.github/workflows/lockfiles.yaml b/.github/workflows/lockfiles.yaml deleted file mode 100644 index 91131bfb98..0000000000 --- a/.github/workflows/lockfiles.yaml +++ /dev/null @@ -1,28 +0,0 @@ -name: Lockfiles - -# Trigger the workflow on push or pull request events for the main branch -on: - push: - branches: - - main - pull_request: - branches: - - main - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true - - - name: Build with locked dependencies - run: | - cargo build --manifest-path=roles/Cargo.toml --locked - cargo build --manifest-path=utils/Cargo.toml --locked \ No newline at end of file diff --git a/.github/workflows/rust-msrv.yaml b/.github/workflows/rust-msrv.yaml deleted file mode 100644 index 62ba418b15..0000000000 --- a/.github/workflows/rust-msrv.yaml +++ /dev/null @@ -1,35 +0,0 @@ -on: - push: - branches: - - main - pull_request: - branches: - - main - -name: MSRV 1.75 Check - -jobs: - - build: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - rust: - - 1.75.0 # MSRV - - steps: - - uses: actions/checkout@v2 - - uses: Swatinem/rust-cache@v1.2.0 - - uses: actions-rs/toolchain@v1 - with: - toolchain: ${{ matrix.rust }} - override: true - - name: Build Benches - run: cargo build --manifest-path=benches/Cargo.toml - - name: Build Protocols - run: cargo build --manifest-path=protocols/Cargo.toml - - name: Build Roles - run: cargo build --manifest-path=roles/Cargo.toml - - name: Build Utils - run: cargo build --manifest-path=utils/Cargo.toml diff --git a/.github/workflows/semver-check.yaml b/.github/workflows/semver-check.yaml deleted file mode 100644 index cd7eb72552..0000000000 --- a/.github/workflows/semver-check.yaml +++ /dev/null @@ -1,129 +0,0 @@ -name: Semver Check - -on: - push: - branches: - - "main" - pull_request: - branches: - - "main" - -jobs: - semver-check: - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Install Rust stable - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true - - - name: Cache Cargo registry - uses: actions/cache@v2 - with: - path: ~/.cargo/registry - key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-cargo-registry- - - - name: Cache Cargo index - uses: actions/cache@v2 - with: - path: ~/.cargo/git - key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-cargo-index- - - - name: Install dependencies - run: sudo apt-get update && sudo apt-get install -y cmake - - - name: Install cargo-semver-checks - run: cargo install cargo-semver-checks --version 0.37.0 --locked - - - name: Run semver checks for common - working-directory: common - run: cargo semver-checks - - - name: Run semver checks for utils/buffer - working-directory: utils/buffer - run: cargo semver-checks - - - name: Run semver checks for protocols/v2/binary-sv2/no-serde-sv2/codec - working-directory: protocols/v2/binary-sv2/no-serde-sv2/codec - run: cargo semver-checks - - - name: Run semver checks for protocols/v2/binary-sv2/serde-sv2 - working-directory: protocols/v2/binary-sv2/serde-sv2 - run: cargo semver-checks - - - name: Run semver checks for protocols/v2/binary-sv2/binary-sv2 - working-directory: protocols/v2/binary-sv2/binary-sv2 - run: cargo semver-checks - - - name: Run semver checks for protocols/v2/const-sv2 - working-directory: protocols/v2/const-sv2 - run: cargo semver-checks - - - name: Run semver checks for protocols/v2/framing-sv2 - working-directory: protocols/v2/framing-sv2 - run: cargo semver-checks - - - name: Run semver checks for protocols/v2/noise-sv2 - working-directory: protocols/v2/noise-sv2 - run: cargo semver-checks - - - name: Run semver checks for protocols/v2/codec-sv2 - working-directory: protocols/v2/codec-sv2 - run: cargo semver-checks - - - name: Run semver checks for protocols/v2/subprotocols/common-messages - working-directory: protocols/v2/subprotocols/common-messages - run: cargo semver-checks - - - name: Run semver checks for protocols/v2/subprotocols/job-declaration - working-directory: protocols/v2/subprotocols/job-declaration - run: cargo semver-checks - - - name: Run semver checks for protocols/v2/subprotocols/mining - working-directory: protocols/v2/subprotocols/mining - run: cargo semver-checks - - - name: Run semver checks for protocols/v2/subprotocols/template-distribution - working-directory: protocols/v2/subprotocols/template-distribution - run: cargo semver-checks - - - name: Run semver checks for protocols/v2/sv2-ffi - working-directory: protocols/v2/sv2-ffi - run: cargo semver-checks - - - name: Run semver checks for protocols/v2/roles-logic-sv2 - working-directory: protocols/v2/roles-logic-sv2 - run: cargo semver-checks --default-features - - - name: Run semver checks for protocols/v1 - working-directory: protocols/v1 - run: cargo semver-checks - - - name: Run semver checks for utils/bip32-key-derivation - working-directory: utils/bip32-key-derivation - run: cargo semver-checks - - - name: Run semver checks for utils/error-handling - working-directory: utils/error-handling - run: cargo semver-checks - - - name: Run semver checks for utils/key-utils - working-directory: utils/key-utils - run: cargo semver-checks - - - name: Run semver checks for roles/roles-utils/network-helpers - working-directory: roles/roles-utils/network-helpers - run: cargo semver-checks - - - name: Run semver checks for roles/roles-utils/rpc - working-directory: roles/roles-utils/rpc - run: cargo semver-checks \ No newline at end of file diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml deleted file mode 100644 index 3c817fa440..0000000000 --- a/.github/workflows/test.yaml +++ /dev/null @@ -1,95 +0,0 @@ -on: - push: - branches: - - main - pull_request: - branches: - - main - -name: Test, Prop Tests, Example Tests - -jobs: - ci: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: - - macos-13 - - ubuntu-latest - include: - - os: macos-13 - target: x86_64-apple-darwin - - os: ubuntu-latest - target: x86_64-unknown-linux-musl - - steps: - - name: Install stable toolchain & components - uses: actions/checkout@v4 - with: - profile: minimal - toolchain: nightly - override: true - - - name: Build - run: | - cargo build --manifest-path=benches/Cargo.toml - cargo build --manifest-path=common/Cargo.toml - cargo build --manifest-path=protocols/Cargo.toml - cargo build --manifest-path=roles/Cargo.toml - cargo build --manifest-path=utils/Cargo.toml - - - name: Roles Integration Tests - run: | - cargo test --manifest-path=roles/Cargo.toml --verbose --test '*' -- --nocapture - - - name: Run sv1-client-and-server example - run: | - cargo run --manifest-path=examples/sv1-client-and-server/Cargo.toml --bin client_and_server -- 60 - - - name: interop-test - run: | - if [ ${{ matrix.os }} == "ubuntu-latest" ]; then - ./run.sh 30 - else - echo "Skipping interop-test on ${{ matrix.os }} - not supported" - fi - working-directory: examples/interop-cpp/ - - # TODO this is only usefull if we want to build c bindings with guix - #- name: interop-no-cargo-test - # run: | - # if [ ${{ matrix.os }} == "ubuntu-latest" ]; then - # ./run.sh 30 - # else - # echo "Skipping interop-test on ${{ matrix.os }} - not supported" - # fi - # working-directory: examples/interop-cpp-no-cargo/ - - - name: fuzz tests - run: | - if [ ${{ matrix.os }} == "ubuntu-latest" ]; then - ./run.sh 30 - else - echo "Skipping fuzz test on ${{ matrix.os }} - not supported" - fi - working-directory: utils/buffer/fuzz - - - name: Test - run: | - cargo test --manifest-path=benches/Cargo.toml - cargo test --manifest-path=common/Cargo.toml - cargo test --manifest-path=protocols/Cargo.toml - cargo test --manifest-path=roles/Cargo.toml - cargo test --manifest-path=utils/Cargo.toml - - - name: Property based testing - run: | - cargo test --manifest-path=protocols/Cargo.toml --features prop_test - - - name: Run ping-pong-with-noise example - run: | - cargo run --manifest-path=examples/ping-pong-with-noise/Cargo.toml --bin ping_pong_with_noise -- 10 - - - name: Run ping-pong-without-noise example - run: | - cargo run --manifest-path=examples/ping-pong-without-noise/Cargo.toml --bin ping_pong_without_noise -- 10 From abe7450942ca91b9032ca3af56ccef464aa1ea1d Mon Sep 17 00:00:00 2001 From: devworlds Date: Fri, 20 Dec 2024 10:20:15 -0300 Subject: [PATCH 02/24] chore: fix MSRV incorrect job syntax --- .github/workflows/general-check.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/general-check.yaml b/.github/workflows/general-check.yaml index 8069a5f010..05a94c52e1 100644 --- a/.github/workflows/general-check.yaml +++ b/.github/workflows/general-check.yaml @@ -8,7 +8,7 @@ on: jobs: - MSRV-1.75-Check: + Msrv-Check: runs-on: ubuntu-latest strategy: fail-fast: false @@ -32,7 +32,7 @@ jobs: - name: Build Utils run: cargo build --manifest-path=utils/Cargo.toml - semver-check: + Semver-check: runs-on: ubuntu-latest steps: From 3f5ae735ac2d065e5fc5defb35a3e1901f0680d0 Mon Sep 17 00:00:00 2001 From: devworlds Date: Mon, 23 Dec 2024 17:49:29 -0300 Subject: [PATCH 03/24] chore: update general-check to be more clean --- .github/workflows/general-check.yaml | 317 ++++++--------------------- 1 file changed, 70 insertions(+), 247 deletions(-) diff --git a/.github/workflows/general-check.yaml b/.github/workflows/general-check.yaml index 05a94c52e1..80c461cbad 100644 --- a/.github/workflows/general-check.yaml +++ b/.github/workflows/general-check.yaml @@ -7,7 +7,6 @@ on: - main jobs: - Msrv-Check: runs-on: ubuntu-latest strategy: @@ -23,164 +22,78 @@ jobs: with: toolchain: ${{ matrix.rust }} override: true - - name: Build Benches - run: cargo build --manifest-path=benches/Cargo.toml - - name: Build Protocols - run: cargo build --manifest-path=protocols/Cargo.toml - - name: Build Roles - run: cargo build --manifest-path=roles/Cargo.toml - - name: Build Utils - run: cargo build --manifest-path=utils/Cargo.toml + - name: Build Projects + 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 steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Install Rust stable - uses: actions-rs/toolchain@v1 + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 with: toolchain: stable override: true - - - name: Cache Cargo registry - uses: actions/cache@v2 + - uses: actions/cache@v2 with: path: ~/.cargo/registry key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} restore-keys: | ${{ runner.os }}-cargo-registry- - - - name: Cache Cargo index - uses: actions/cache@v2 + - uses: actions/cache@v2 with: path: ~/.cargo/git key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} restore-keys: | ${{ runner.os }}-cargo-index- - - - name: Install dependencies - run: sudo apt-get update && sudo apt-get install -y cmake - - - name: Install cargo-semver-checks - run: cargo install cargo-semver-checks --version 0.37.0 --locked - - - name: Run semver checks for common - working-directory: common - run: cargo semver-checks - - - name: Run semver checks for utils/buffer - working-directory: utils/buffer - run: cargo semver-checks - - - name: Run semver checks for protocols/v2/binary-sv2/no-serde-sv2/codec - working-directory: protocols/v2/binary-sv2/no-serde-sv2/codec - run: cargo semver-checks - - - name: Run semver checks for protocols/v2/binary-sv2/serde-sv2 - working-directory: protocols/v2/binary-sv2/serde-sv2 - run: cargo semver-checks - - - name: Run semver checks for protocols/v2/binary-sv2/binary-sv2 - working-directory: protocols/v2/binary-sv2/binary-sv2 - run: cargo semver-checks - - - name: Run semver checks for protocols/v2/const-sv2 - working-directory: protocols/v2/const-sv2 - run: cargo semver-checks - - - name: Run semver checks for protocols/v2/framing-sv2 - working-directory: protocols/v2/framing-sv2 - run: cargo semver-checks - - - name: Run semver checks for protocols/v2/noise-sv2 - working-directory: protocols/v2/noise-sv2 - run: cargo semver-checks - - - name: Run semver checks for protocols/v2/codec-sv2 - working-directory: protocols/v2/codec-sv2 - run: cargo semver-checks - - - name: Run semver checks for protocols/v2/subprotocols/common-messages - working-directory: protocols/v2/subprotocols/common-messages - run: cargo semver-checks - - - name: Run semver checks for protocols/v2/subprotocols/job-declaration - working-directory: protocols/v2/subprotocols/job-declaration - run: cargo semver-checks - - - name: Run semver checks for protocols/v2/subprotocols/mining - working-directory: protocols/v2/subprotocols/mining - run: cargo semver-checks - - - name: Run semver checks for protocols/v2/subprotocols/template-distribution - working-directory: protocols/v2/subprotocols/template-distribution - run: cargo semver-checks - - - name: Run semver checks for protocols/v2/sv2-ffi - working-directory: protocols/v2/sv2-ffi - run: cargo semver-checks - - - name: Run semver checks for protocols/v2/roles-logic-sv2 - working-directory: protocols/v2/roles-logic-sv2 - run: cargo semver-checks --default-features - - - name: Run semver checks for protocols/v1 - working-directory: protocols/v1 - run: cargo semver-checks - - - name: Run semver checks for utils/bip32-key-derivation - working-directory: utils/bip32-key-derivation - run: cargo semver-checks - - - name: Run semver checks for utils/error-handling - working-directory: utils/error-handling - run: cargo semver-checks - - - name: Run semver checks for utils/key-utils - working-directory: utils/key-utils - run: cargo semver-checks - - - name: Run semver checks for roles/roles-utils/network-helpers - working-directory: roles/roles-utils/network-helpers - run: cargo semver-checks - - - name: Run semver checks for roles/roles-utils/rpc - working-directory: roles/roles-utils/rpc - run: cargo semver-checks - - Lockfiles: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true - - - name: Build with locked dependencies + - 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: | - cargo build --manifest-path=roles/Cargo.toml --locked - cargo build --manifest-path=utils/Cargo.toml --locked + 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 @@ -191,26 +104,19 @@ jobs: components: rustfmt - name: Run fmt in different workspaces and crates run: | - cargo fmt --all --manifest-path=benches/Cargo.toml -- --check - cargo fmt --all --manifest-path=common/Cargo.toml -- --check - cargo fmt --all --manifest-path=protocols/Cargo.toml -- --check - cargo fmt --all --manifest-path=roles/Cargo.toml -- --check - cargo fmt --all --manifest-path=utils/Cargo.toml -- --check - cargo fmt --all --manifest-path=utils/message-generator/Cargo.toml -- --check - + 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 @@ -221,95 +127,12 @@ jobs: components: clippy - name: Run Clippy on different workspaces and crates run: | - cargo clippy --manifest-path=benches/Cargo.toml -- -D warnings -A dead-code - cargo clippy --manifest-path=common/Cargo.toml -- -D warnings -A dead-code - cargo clippy --manifest-path=protocols/Cargo.toml -- -D warnings -A dead-code - cargo clippy --manifest-path=roles/Cargo.toml -- -D warnings -A dead-code - cargo clippy --manifest-path=utils/Cargo.toml -- -D warnings -A dead-code - cargo clippy --manifest-path=utils/message-generator/Cargo.toml -- -D warnings -A dead-code - - Tests-ci: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: - - macos-13 - - ubuntu-latest - include: - - os: macos-13 - target: x86_64-apple-darwin - - os: ubuntu-latest - target: x86_64-unknown-linux-musl - - steps: - - name: Install stable toolchain & components - uses: actions/checkout@v4 - with: - profile: minimal - toolchain: nightly - override: true - - - name: Build - run: | - cargo build --manifest-path=benches/Cargo.toml - cargo build --manifest-path=common/Cargo.toml - cargo build --manifest-path=protocols/Cargo.toml - cargo build --manifest-path=roles/Cargo.toml - cargo build --manifest-path=utils/Cargo.toml - - - name: Roles Integration Tests - run: | - cargo test --manifest-path=roles/Cargo.toml --verbose --test '*' -- --nocapture - - - name: Run sv1-client-and-server example - run: | - cargo run --manifest-path=examples/sv1-client-and-server/Cargo.toml --bin client_and_server -- 60 - - - name: interop-test - run: | - if [ ${{ matrix.os }} == "ubuntu-latest" ]; then - ./run.sh 30 - else - echo "Skipping interop-test on ${{ matrix.os }} - not supported" - fi - working-directory: examples/interop-cpp/ - - # TODO this is only usefull if we want to build c bindings with guix - #- name: interop-no-cargo-test - # run: | - # if [ ${{ matrix.os }} == "ubuntu-latest" ]; then - # ./run.sh 30 - # else - # echo "Skipping interop-test on ${{ matrix.os }} - not supported" - # fi - # working-directory: examples/interop-cpp-no-cargo/ - - - name: fuzz tests - run: | - if [ ${{ matrix.os }} == "ubuntu-latest" ]; then - ./run.sh 30 - else - echo "Skipping fuzz test on ${{ matrix.os }} - not supported" - fi - working-directory: utils/buffer/fuzz - - - name: Test - run: | - cargo test --manifest-path=benches/Cargo.toml - cargo test --manifest-path=common/Cargo.toml - cargo test --manifest-path=protocols/Cargo.toml - cargo test --manifest-path=roles/Cargo.toml - cargo test --manifest-path=utils/Cargo.toml - - - name: Property based testing - run: | - cargo test --manifest-path=protocols/Cargo.toml --features prop_test - - - name: Run ping-pong-with-noise example - run: | - cargo run --manifest-path=examples/ping-pong-with-noise/Cargo.toml --bin ping_pong_with_noise -- 10 - - - name: Run ping-pong-without-noise example - run: | - cargo run --manifest-path=examples/ping-pong-without-noise/Cargo.toml --bin ping_pong_without_noise -- 10 - \ No newline at end of file + 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 From 53a0244e70703d8efb3d093a02abf2c2eb7bb644 Mon Sep 17 00:00:00 2001 From: devworlds Date: Tue, 31 Dec 2024 13:54:42 -0300 Subject: [PATCH 04/24] chore: create shell script to make general-check.yaml more clean. --- .github/workflows/general-check.yaml | 90 ++++++++-------------------- ci/build_projects.sh | 5 ++ ci/run_clippy.sh | 10 ++++ ci/run_fmt.sh | 10 ++++ ci/run_semver_checks.sh | 25 ++++++++ 5 files changed, 76 insertions(+), 64 deletions(-) create mode 100755 ci/build_projects.sh create mode 100755 ci/run_clippy.sh create mode 100755 ci/run_fmt.sh create mode 100755 ci/run_semver_checks.sh diff --git a/.github/workflows/general-check.yaml b/.github/workflows/general-check.yaml index 80c461cbad..fdc976b2f8 100644 --- a/.github/workflows/general-check.yaml +++ b/.github/workflows/general-check.yaml @@ -23,23 +23,7 @@ jobs: toolchain: ${{ matrix.rust }} override: true - name: Build Projects - 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 + run: ./ci/build_projects.sh Semver-check: runs-on: ubuntu-latest @@ -65,35 +49,21 @@ 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: | - 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 + run: ./ci/run_semver_checks.sh 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 @@ -103,20 +73,21 @@ jobs: override: true components: rustfmt - name: Run fmt in different workspaces and crates - 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 + run: ./ci/run_fmt.sh 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 @@ -126,13 +97,4 @@ jobs: override: true components: clippy - name: Run Clippy on different workspaces and crates - 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 + run: ./ci/run_clippy.sh diff --git a/ci/build_projects.sh b/ci/build_projects.sh new file mode 100755 index 0000000000..b95c7d9ab3 --- /dev/null +++ b/ci/build_projects.sh @@ -0,0 +1,5 @@ +#!/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/ci/run_clippy.sh b/ci/run_clippy.sh new file mode 100755 index 0000000000..0238578a75 --- /dev/null +++ b/ci/run_clippy.sh @@ -0,0 +1,10 @@ +#!/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/ci/run_fmt.sh b/ci/run_fmt.sh new file mode 100755 index 0000000000..3513fcd1f9 --- /dev/null +++ b/ci/run_fmt.sh @@ -0,0 +1,10 @@ +#!/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/ci/run_semver_checks.sh b/ci/run_semver_checks.sh new file mode 100755 index 0000000000..d517e1958e --- /dev/null +++ b/ci/run_semver_checks.sh @@ -0,0 +1,25 @@ +#!/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 From efa9b561e1cdaba41051e5e1300fbdf83eee4795 Mon Sep 17 00:00:00 2001 From: devworlds Date: Tue, 31 Dec 2024 14:05:53 -0300 Subject: [PATCH 05/24] chore: move shell scripts to /scripts --- .github/workflows/general-check.yaml | 8 ++++---- ci/build_projects.sh | 5 ----- ci/run_clippy.sh | 10 ---------- ci/run_fmt.sh | 10 ---------- ci/run_semver_checks.sh | 25 ------------------------- 5 files changed, 4 insertions(+), 54 deletions(-) delete mode 100755 ci/build_projects.sh delete mode 100755 ci/run_clippy.sh delete mode 100755 ci/run_fmt.sh delete mode 100755 ci/run_semver_checks.sh diff --git a/.github/workflows/general-check.yaml b/.github/workflows/general-check.yaml index fdc976b2f8..8485814dd2 100644 --- a/.github/workflows/general-check.yaml +++ b/.github/workflows/general-check.yaml @@ -23,7 +23,7 @@ jobs: toolchain: ${{ matrix.rust }} override: true - name: Build Projects - run: ./ci/build_projects.sh + run: ./scripts//build_projects.sh Semver-check: runs-on: ubuntu-latest @@ -49,7 +49,7 @@ 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: ./ci/run_semver_checks.sh + run: ./scripts/run_semver_checks.sh Rust-fmt: runs-on: ${{ matrix.os }} @@ -73,7 +73,7 @@ jobs: override: true components: rustfmt - name: Run fmt in different workspaces and crates - run: ./ci/run_fmt.sh + run: ./scripts//run_fmt.sh clippy-check-lint: runs-on: ${{ matrix.os }} @@ -97,4 +97,4 @@ jobs: override: true components: clippy - name: Run Clippy on different workspaces and crates - run: ./ci/run_clippy.sh + run: ./scripts//run_clippy.sh diff --git a/ci/build_projects.sh b/ci/build_projects.sh deleted file mode 100755 index b95c7d9ab3..0000000000 --- a/ci/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/ci/run_clippy.sh b/ci/run_clippy.sh deleted file mode 100755 index 0238578a75..0000000000 --- a/ci/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/ci/run_fmt.sh b/ci/run_fmt.sh deleted file mode 100755 index 3513fcd1f9..0000000000 --- a/ci/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/ci/run_semver_checks.sh b/ci/run_semver_checks.sh deleted file mode 100755 index d517e1958e..0000000000 --- a/ci/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 From 7eda46a671ba000fdbe1b0c8e685e8ab4a13aa96 Mon Sep 17 00:00:00 2001 From: devworlds Date: Tue, 31 Dec 2024 14:07:48 -0300 Subject: [PATCH 06/24] chore: fix path to script on general-check.yaml --- .github/workflows/general-check.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/general-check.yaml b/.github/workflows/general-check.yaml index 8485814dd2..0c5c235c17 100644 --- a/.github/workflows/general-check.yaml +++ b/.github/workflows/general-check.yaml @@ -23,7 +23,7 @@ jobs: toolchain: ${{ matrix.rust }} override: true - name: Build Projects - run: ./scripts//build_projects.sh + run: ./scripts/build_projects.sh Semver-check: runs-on: ubuntu-latest @@ -73,7 +73,7 @@ jobs: override: true components: rustfmt - name: Run fmt in different workspaces and crates - run: ./scripts//run_fmt.sh + run: ./scripts/run_fmt.sh clippy-check-lint: runs-on: ${{ matrix.os }} @@ -97,4 +97,4 @@ jobs: override: true components: clippy - name: Run Clippy on different workspaces and crates - run: ./scripts//run_clippy.sh + run: ./scripts/run_clippy.sh From 314eb5da07a4a58e5a73aa7c724957d304c989c1 Mon Sep 17 00:00:00 2001 From: devworlds Date: Tue, 31 Dec 2024 14:07:48 -0300 Subject: [PATCH 07/24] chore: fix path to script on general-check.yaml --- scripts/build_projects.sh | 5 +++++ scripts/run_clippy.sh | 10 ++++++++++ scripts/run_fmt.sh | 10 ++++++++++ scripts/run_semver_checks.sh | 25 +++++++++++++++++++++++++ 4 files changed, 50 insertions(+) create mode 100755 scripts/build_projects.sh create mode 100755 scripts/run_clippy.sh create mode 100755 scripts/run_fmt.sh create mode 100755 scripts/run_semver_checks.sh diff --git a/scripts/build_projects.sh b/scripts/build_projects.sh new file mode 100755 index 0000000000..b95c7d9ab3 --- /dev/null +++ b/scripts/build_projects.sh @@ -0,0 +1,5 @@ +#!/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 new file mode 100755 index 0000000000..0238578a75 --- /dev/null +++ b/scripts/run_clippy.sh @@ -0,0 +1,10 @@ +#!/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 new file mode 100755 index 0000000000..3513fcd1f9 --- /dev/null +++ b/scripts/run_fmt.sh @@ -0,0 +1,10 @@ +#!/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 new file mode 100755 index 0000000000..d517e1958e --- /dev/null +++ b/scripts/run_semver_checks.sh @@ -0,0 +1,25 @@ +#!/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 From 7dc11ca55ecef241272eab9f00de6aae94b1e0db Mon Sep 17 00:00:00 2001 From: devworlds Date: Mon, 6 Jan 2025 09:20:32 -0300 Subject: [PATCH 08/24] chore: update names to a pattern, and also organize bash scripts to github inside a workflows directory --- .github/workflows/general-check.yaml | 16 ++++++++-------- .../{build_projects.sh => workflows/build.sh} | 0 .../clippy.sh} | 0 scripts/{run_fmt.sh => workflows/format.sh} | 0 .../semver.sh} | 0 5 files changed, 8 insertions(+), 8 deletions(-) rename scripts/{build_projects.sh => workflows/build.sh} (100%) rename scripts/{clippy-fmt-and-test.sh => workflows/clippy.sh} (100%) rename scripts/{run_fmt.sh => workflows/format.sh} (100%) rename scripts/{run_semver_checks.sh => workflows/semver.sh} (100%) diff --git a/.github/workflows/general-check.yaml b/.github/workflows/general-check.yaml index 0c5c235c17..666704aa26 100644 --- a/.github/workflows/general-check.yaml +++ b/.github/workflows/general-check.yaml @@ -7,7 +7,7 @@ on: - main jobs: - Msrv-Check: + MSRV: runs-on: ubuntu-latest strategy: fail-fast: false @@ -23,9 +23,9 @@ jobs: toolchain: ${{ matrix.rust }} override: true - name: Build Projects - run: ./scripts/build_projects.sh + run: ./scripts/workflows/build.sh - Semver-check: + SemVer: runs-on: ubuntu-latest steps: @@ -49,9 +49,9 @@ 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: ./scripts/workflows/semver.sh - Rust-fmt: + Format: runs-on: ${{ matrix.os }} strategy: matrix: @@ -73,9 +73,9 @@ jobs: override: true components: rustfmt - name: Run fmt in different workspaces and crates - run: ./scripts/run_fmt.sh + run: ./scripts/workflows/format.sh - clippy-check-lint: + Clippy: runs-on: ${{ matrix.os }} strategy: matrix: @@ -97,4 +97,4 @@ jobs: override: true components: clippy - name: Run Clippy on different workspaces and crates - run: ./scripts/run_clippy.sh + run: ./scripts/workflows/clippy.sh diff --git a/scripts/build_projects.sh b/scripts/workflows/build.sh similarity index 100% rename from scripts/build_projects.sh rename to scripts/workflows/build.sh diff --git a/scripts/clippy-fmt-and-test.sh b/scripts/workflows/clippy.sh similarity index 100% rename from scripts/clippy-fmt-and-test.sh rename to scripts/workflows/clippy.sh diff --git a/scripts/run_fmt.sh b/scripts/workflows/format.sh similarity index 100% rename from scripts/run_fmt.sh rename to scripts/workflows/format.sh diff --git a/scripts/run_semver_checks.sh b/scripts/workflows/semver.sh similarity index 100% rename from scripts/run_semver_checks.sh rename to scripts/workflows/semver.sh From 8b3ab7f3914cf988a99c64ecfc4147e3de4635c2 Mon Sep 17 00:00:00 2001 From: devworlds Date: Mon, 6 Jan 2025 09:25:41 -0300 Subject: [PATCH 09/24] chore: adjust wrong clippy.sh file. --- scripts/clippy-fmt-and-test.sh | 28 ++++++++++++++++++++++++++ scripts/run_clippy.sh | 10 ---------- scripts/workflows/clippy.sh | 36 +++++++++------------------------- 3 files changed, 37 insertions(+), 37 deletions(-) create mode 100755 scripts/clippy-fmt-and-test.sh delete mode 100755 scripts/run_clippy.sh diff --git a/scripts/clippy-fmt-and-test.sh b/scripts/clippy-fmt-and-test.sh new file mode 100755 index 0000000000..db1fcbadf6 --- /dev/null +++ b/scripts/clippy-fmt-and-test.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +WORKSPACES="benches common protocols roles utils" + +for workspace in $WORKSPACES; do + echo "Executing clippy on: $workspace" + cargo +1.75.0 clippy --manifest-path="$workspace/Cargo.toml" -- -D warnings -A dead-code + if [ $? -ne 0 ]; then + echo "Clippy found some errors in: $workspace" + exit 1 + fi + + echo "Running tests on: $workspace" + cargo +1.75 test --manifest-path="$workspace/Cargo.toml" + if [ $? -ne 0 ]; then + echo "Tests failed in: $workspace" + exit 1 + fi + + echo "Running fmt on: $workspace" + (cd $workspace && cargo +nightly fmt) + if [ $? -ne 0 ]; then + echo "Fmt failed in: $workspace" + exit 1 + fi +done + +echo "Clippy success, all tests passed!" diff --git a/scripts/run_clippy.sh b/scripts/run_clippy.sh deleted file mode 100755 index 0238578a75..0000000000 --- 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/workflows/clippy.sh b/scripts/workflows/clippy.sh index db1fcbadf6..0238578a75 100755 --- a/scripts/workflows/clippy.sh +++ b/scripts/workflows/clippy.sh @@ -1,28 +1,10 @@ -#!/bin/sh - -WORKSPACES="benches common protocols roles utils" - -for workspace in $WORKSPACES; do - echo "Executing clippy on: $workspace" - cargo +1.75.0 clippy --manifest-path="$workspace/Cargo.toml" -- -D warnings -A dead-code - if [ $? -ne 0 ]; then - echo "Clippy found some errors in: $workspace" - exit 1 - fi - - echo "Running tests on: $workspace" - cargo +1.75 test --manifest-path="$workspace/Cargo.toml" - if [ $? -ne 0 ]; then - echo "Tests failed in: $workspace" - exit 1 - fi - - echo "Running fmt on: $workspace" - (cd $workspace && cargo +nightly fmt) - if [ $? -ne 0 ]; then - echo "Fmt failed in: $workspace" - exit 1 - fi +#!/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 - -echo "Clippy success, all tests passed!" From f322747a6f12874dd505b7237a4d1e6bc5b9675a Mon Sep 17 00:00:00 2001 From: devworlds Date: Mon, 6 Jan 2025 11:18:44 -0300 Subject: [PATCH 10/24] chore: update general-check.yaml to rust-check.yaml, and job names to lower case, and create bash script to ci job. --- .../{general-check.yaml => rust-check.yaml} | 32 +++++++++++-- scripts/workflows/test.sh | 46 +++++++++++++++++++ 2 files changed, 74 insertions(+), 4 deletions(-) rename .github/workflows/{general-check.yaml => rust-check.yaml} (80%) create mode 100644 scripts/workflows/test.sh diff --git a/.github/workflows/general-check.yaml b/.github/workflows/rust-check.yaml similarity index 80% rename from .github/workflows/general-check.yaml rename to .github/workflows/rust-check.yaml index 666704aa26..98e0712220 100644 --- a/.github/workflows/general-check.yaml +++ b/.github/workflows/rust-check.yaml @@ -7,7 +7,7 @@ on: - main jobs: - MSRV: + msrv: runs-on: ubuntu-latest strategy: fail-fast: false @@ -25,7 +25,7 @@ jobs: - name: Build Projects run: ./scripts/workflows/build.sh - SemVer: + semver: runs-on: ubuntu-latest steps: @@ -51,7 +51,7 @@ jobs: - name: Run Semver Checks run: ./scripts/workflows/semver.sh - Format: + fmt: runs-on: ${{ matrix.os }} strategy: matrix: @@ -75,7 +75,7 @@ jobs: - name: Run fmt in different workspaces and crates run: ./scripts/workflows/format.sh - Clippy: + clippy-check: runs-on: ${{ matrix.os }} strategy: matrix: @@ -98,3 +98,27 @@ jobs: components: clippy - name: Run Clippy on different workspaces and crates run: ./scripts/workflows/clippy.sh + + ci: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - macos-13 + - ubuntu-latest + include: + - os: macos-13 + target: x86_64-apple-darwin + - os: ubuntu-latest + target: x86_64-unknown-linux-musl + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set OS environment variable + run: echo "CI_OS=${{ matrix.os }}" >> $GITHUB_ENV + + - name: Run CI script + run: ./scripts/workflows/test.sh + working-directory: . \ No newline at end of file diff --git a/scripts/workflows/test.sh b/scripts/workflows/test.sh new file mode 100644 index 0000000000..18f09c4c98 --- /dev/null +++ b/scripts/workflows/test.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +# Instala toolchain e componentes +cargo build --manifest-path=benches/Cargo.toml +cargo build --manifest-path=common/Cargo.toml +cargo build --manifest-path=protocols/Cargo.toml +cargo build --manifest-path=roles/Cargo.toml +cargo build --manifest-path=utils/Cargo.toml + +# Testes de Integração de Roles +cargo test --manifest-path=roles/Cargo.toml --verbose --test '*' -- --nocapture + +# Executa o exemplo de client_and_server +cargo run --manifest-path=examples/sv1-client-and-server/Cargo.toml --bin client_and_server -- 60 + +# Teste de Interop (somente no Ubuntu) +if [ "$CI_OS" == "ubuntu-latest" ]; then + ./run.sh 30 +else + echo "Skipping interop-test on $CI_OS - not supported" +fi +cd examples/interop-cpp/ || exit + +# Teste de fuzz (somente no Ubuntu) +if [ "$CI_OS" == "ubuntu-latest" ]; then + ./run.sh 30 +else + echo "Skipping fuzz test on $CI_OS - not supported" +fi +cd utils/buffer/fuzz || exit + +# Testes gerais +cargo test --manifest-path=benches/Cargo.toml +cargo test --manifest-path=common/Cargo.toml +cargo test --manifest-path=protocols/Cargo.toml +cargo test --manifest-path=roles/Cargo.toml +cargo test --manifest-path=utils/Cargo.toml + +# Testes baseados em propriedades +cargo test --manifest-path=protocols/Cargo.toml --features prop_test + +# Executa o exemplo de ping-pong-with-noise +cargo run --manifest-path=examples/ping-pong-with-noise/Cargo.toml --bin ping_pong_with_noise -- 10 + +# Executa o exemplo de ping-pong-without-noise +cargo run --manifest-path=examples/ping-pong-without-noise/Cargo.toml --bin ping_pong_without_noise -- 10 From 3179e7bd1332928f3330aed99629a37f95009d0d Mon Sep 17 00:00:00 2001 From: devworlds Date: Mon, 6 Jan 2025 11:31:44 -0300 Subject: [PATCH 11/24] chore: remove comments, and add perm to test.sh --- scripts/workflows/test.sh | 9 --------- 1 file changed, 9 deletions(-) mode change 100644 => 100755 scripts/workflows/test.sh diff --git a/scripts/workflows/test.sh b/scripts/workflows/test.sh old mode 100644 new mode 100755 index 18f09c4c98..3d3afe9511 --- a/scripts/workflows/test.sh +++ b/scripts/workflows/test.sh @@ -1,19 +1,15 @@ #!/bin/bash -# Instala toolchain e componentes cargo build --manifest-path=benches/Cargo.toml cargo build --manifest-path=common/Cargo.toml cargo build --manifest-path=protocols/Cargo.toml cargo build --manifest-path=roles/Cargo.toml cargo build --manifest-path=utils/Cargo.toml -# Testes de Integração de Roles cargo test --manifest-path=roles/Cargo.toml --verbose --test '*' -- --nocapture -# Executa o exemplo de client_and_server cargo run --manifest-path=examples/sv1-client-and-server/Cargo.toml --bin client_and_server -- 60 -# Teste de Interop (somente no Ubuntu) if [ "$CI_OS" == "ubuntu-latest" ]; then ./run.sh 30 else @@ -21,7 +17,6 @@ else fi cd examples/interop-cpp/ || exit -# Teste de fuzz (somente no Ubuntu) if [ "$CI_OS" == "ubuntu-latest" ]; then ./run.sh 30 else @@ -29,18 +24,14 @@ else fi cd utils/buffer/fuzz || exit -# Testes gerais cargo test --manifest-path=benches/Cargo.toml cargo test --manifest-path=common/Cargo.toml cargo test --manifest-path=protocols/Cargo.toml cargo test --manifest-path=roles/Cargo.toml cargo test --manifest-path=utils/Cargo.toml -# Testes baseados em propriedades cargo test --manifest-path=protocols/Cargo.toml --features prop_test -# Executa o exemplo de ping-pong-with-noise cargo run --manifest-path=examples/ping-pong-with-noise/Cargo.toml --bin ping_pong_with_noise -- 10 -# Executa o exemplo de ping-pong-without-noise cargo run --manifest-path=examples/ping-pong-without-noise/Cargo.toml --bin ping_pong_without_noise -- 10 From 6f520a7d95daa19e1f50a6b756f89e0e06990c0e Mon Sep 17 00:00:00 2001 From: devworlds Date: Fri, 20 Dec 2024 01:03:09 -0300 Subject: [PATCH 12/24] 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 | 138 +++++++++++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100644 .github/workflows/general-check.yaml diff --git a/.github/workflows/general-check.yaml b/.github/workflows/general-check.yaml new file mode 100644 index 0000000000..80c461cbad --- /dev/null +++ b/.github/workflows/general-check.yaml @@ -0,0 +1,138 @@ +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + Msrv-Check: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + rust: + - 1.75.0 # MSRV + + steps: + - uses: actions/checkout@v2 + - uses: Swatinem/rust-cache@v1.2.0 + - uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.rust }} + override: true + - name: Build Projects + 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 + + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + - uses: actions/cache@v2 + with: + path: ~/.cargo/registry + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-registry- + - uses: actions/cache@v2 + with: + path: ~/.cargo/git + key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-index- + - 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: | + 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 }} + steps: + - uses: actions/checkout@v4 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly + override: true + components: rustfmt + - name: Run fmt in different workspaces and crates + 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 }} + steps: + - uses: actions/checkout@v4 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: 1.75.0 + override: true + components: clippy + - name: Run Clippy on different workspaces and crates + 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 From 53ea3d6d084e30d2a4266531066ba608dd203581 Mon Sep 17 00:00:00 2001 From: Georges Palauqui Date: Thu, 26 Dec 2024 09:51:48 +0100 Subject: [PATCH 13/24] `common_messages_sv2` `job_declaration_sv2` `mining_sv2` `template_distribution_sv2`: remove the `no_std` feature and make them `#![no_std]` as they never use `std` anywhere. - bump their MAJOR version because of feature removal - bump the dependant crates PATCH version - updates docs chore: create shell script to make general-check.yaml more clean. chore: move shell scripts to /scripts chore: fix path to script on general-check.yaml chore: fix path to script on general-check.yaml --- .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, 76 insertions(+), 64 deletions(-) create mode 100755 scripts/build_projects.sh create mode 100755 scripts/run_clippy.sh create mode 100755 scripts/run_fmt.sh create mode 100755 scripts/run_semver_checks.sh diff --git a/.github/workflows/general-check.yaml b/.github/workflows/general-check.yaml index 80c461cbad..0c5c235c17 100644 --- a/.github/workflows/general-check.yaml +++ b/.github/workflows/general-check.yaml @@ -23,23 +23,7 @@ jobs: toolchain: ${{ matrix.rust }} override: true - name: Build Projects - 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 + run: ./scripts/build_projects.sh Semver-check: runs-on: ubuntu-latest @@ -65,35 +49,21 @@ 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: | - 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 + run: ./scripts/run_semver_checks.sh 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 @@ -103,20 +73,21 @@ jobs: override: true components: rustfmt - name: Run fmt in different workspaces and crates - 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 + run: ./scripts/run_fmt.sh 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 @@ -126,13 +97,4 @@ jobs: override: true components: clippy - name: Run Clippy on different workspaces and crates - 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 + run: ./scripts/run_clippy.sh diff --git a/scripts/build_projects.sh b/scripts/build_projects.sh new file mode 100755 index 0000000000..b95c7d9ab3 --- /dev/null +++ b/scripts/build_projects.sh @@ -0,0 +1,5 @@ +#!/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 new file mode 100755 index 0000000000..0238578a75 --- /dev/null +++ b/scripts/run_clippy.sh @@ -0,0 +1,10 @@ +#!/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 new file mode 100755 index 0000000000..3513fcd1f9 --- /dev/null +++ b/scripts/run_fmt.sh @@ -0,0 +1,10 @@ +#!/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 new file mode 100755 index 0000000000..d517e1958e --- /dev/null +++ b/scripts/run_semver_checks.sh @@ -0,0 +1,25 @@ +#!/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 From ea8dc431cf1ccdeeb3fee423e4d4e9cf6b4abe94 Mon Sep 17 00:00:00 2001 From: Gary Krause Date: Thu, 12 Dec 2024 19:21:30 -0500 Subject: [PATCH 14/24] 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 --- .github/workflows/general-check.yaml | 100 --------------------------- scripts/build_projects.sh | 5 -- scripts/run_clippy.sh | 10 --- scripts/run_fmt.sh | 10 --- scripts/run_semver_checks.sh | 25 ------- 5 files changed, 150 deletions(-) delete mode 100644 .github/workflows/general-check.yaml 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 deleted file mode 100644 index 0c5c235c17..0000000000 --- a/.github/workflows/general-check.yaml +++ /dev/null @@ -1,100 +0,0 @@ -on: - push: - branches: - - main - pull_request: - branches: - - main - -jobs: - Msrv-Check: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - rust: - - 1.75.0 # MSRV - - steps: - - uses: actions/checkout@v2 - - uses: Swatinem/rust-cache@v1.2.0 - - uses: actions-rs/toolchain@v1 - with: - toolchain: ${{ matrix.rust }} - override: true - - name: Build Projects - run: ./scripts/build_projects.sh - - Semver-check: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true - - uses: actions/cache@v2 - with: - path: ~/.cargo/registry - key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-cargo-registry- - - uses: actions/cache@v2 - with: - path: ~/.cargo/git - key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-cargo-index- - - 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 - - Rust-fmt: - 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 - with: - profile: minimal - toolchain: nightly - override: true - components: rustfmt - - name: Run fmt in different workspaces and crates - run: ./scripts/run_fmt.sh - - clippy-check-lint: - 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 - with: - profile: minimal - toolchain: 1.75.0 - override: true - components: clippy - - name: Run Clippy on different workspaces and crates - run: ./scripts/run_clippy.sh diff --git a/scripts/build_projects.sh b/scripts/build_projects.sh deleted file mode 100755 index b95c7d9ab3..0000000000 --- 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 0238578a75..0000000000 --- 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 3513fcd1f9..0000000000 --- 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 d517e1958e..0000000000 --- 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 From af93a3154ac73751ca27c57160b09bffbad190d4 Mon Sep 17 00:00:00 2001 From: devworlds Date: Mon, 6 Jan 2025 12:03:13 -0300 Subject: [PATCH 15/24] chore: add condition to check if directory exist --- scripts/workflows/test.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/workflows/test.sh b/scripts/workflows/test.sh index 3d3afe9511..c6e9bc7fd5 100755 --- a/scripts/workflows/test.sh +++ b/scripts/workflows/test.sh @@ -22,7 +22,12 @@ if [ "$CI_OS" == "ubuntu-latest" ]; then else echo "Skipping fuzz test on $CI_OS - not supported" fi -cd utils/buffer/fuzz || exit + +if [ -d "utils/buffer/fuzz" ]; then + cd utils/buffer/fuzz || exit +else + echo "Directory 'utils/buffer/fuzz' not found. Skipping..." +fi cargo test --manifest-path=benches/Cargo.toml cargo test --manifest-path=common/Cargo.toml From 302ac1ea073dfba2dd4347cdf6ca2e92f0faf6bc Mon Sep 17 00:00:00 2001 From: devworlds Date: Mon, 6 Jan 2025 12:49:02 -0300 Subject: [PATCH 16/24] chore: fix path to test.sh --- scripts/workflows/test.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/scripts/workflows/test.sh b/scripts/workflows/test.sh index c6e9bc7fd5..17ef3c65c8 100755 --- a/scripts/workflows/test.sh +++ b/scripts/workflows/test.sh @@ -1,11 +1,13 @@ #!/bin/bash +cd ../.. cargo build --manifest-path=benches/Cargo.toml cargo build --manifest-path=common/Cargo.toml cargo build --manifest-path=protocols/Cargo.toml cargo build --manifest-path=roles/Cargo.toml cargo build --manifest-path=utils/Cargo.toml + cargo test --manifest-path=roles/Cargo.toml --verbose --test '*' -- --nocapture cargo run --manifest-path=examples/sv1-client-and-server/Cargo.toml --bin client_and_server -- 60 @@ -15,7 +17,8 @@ if [ "$CI_OS" == "ubuntu-latest" ]; then else echo "Skipping interop-test on $CI_OS - not supported" fi -cd examples/interop-cpp/ || exit + +cd ./examples/interop-cpp/ || exit if [ "$CI_OS" == "ubuntu-latest" ]; then ./run.sh 30 @@ -23,12 +26,10 @@ else echo "Skipping fuzz test on $CI_OS - not supported" fi -if [ -d "utils/buffer/fuzz" ]; then - cd utils/buffer/fuzz || exit -else - echo "Directory 'utils/buffer/fuzz' not found. Skipping..." -fi +cd ../.. +cd ./utils/buffer/fuzz || exit +cd ../../.. cargo test --manifest-path=benches/Cargo.toml cargo test --manifest-path=common/Cargo.toml cargo test --manifest-path=protocols/Cargo.toml From 4ab5025d661e0e9a1b59dc335da2f7f8c9058f00 Mon Sep 17 00:00:00 2001 From: devworlds Date: Mon, 6 Jan 2025 13:14:41 -0300 Subject: [PATCH 17/24] chore: try to fix path to test.sh --- scripts/workflows/test.sh | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/scripts/workflows/test.sh b/scripts/workflows/test.sh index 17ef3c65c8..15bb00fed8 100755 --- a/scripts/workflows/test.sh +++ b/scripts/workflows/test.sh @@ -1,13 +1,10 @@ #!/bin/bash - -cd ../.. cargo build --manifest-path=benches/Cargo.toml cargo build --manifest-path=common/Cargo.toml cargo build --manifest-path=protocols/Cargo.toml cargo build --manifest-path=roles/Cargo.toml cargo build --manifest-path=utils/Cargo.toml - cargo test --manifest-path=roles/Cargo.toml --verbose --test '*' -- --nocapture cargo run --manifest-path=examples/sv1-client-and-server/Cargo.toml --bin client_and_server -- 60 @@ -18,7 +15,7 @@ else echo "Skipping interop-test on $CI_OS - not supported" fi -cd ./examples/interop-cpp/ || exit +cd examples/interop-cpp/ || exit if [ "$CI_OS" == "ubuntu-latest" ]; then ./run.sh 30 @@ -27,7 +24,7 @@ else fi cd ../.. -cd ./utils/buffer/fuzz || exit +cd utils/buffer/fuzz/ || exit cd ../../.. cargo test --manifest-path=benches/Cargo.toml From 6e1c351747ecf950cb20dfd371608b5464552e1f Mon Sep 17 00:00:00 2001 From: devworlds Date: Mon, 6 Jan 2025 13:51:42 -0300 Subject: [PATCH 18/24] chore: remove cargo build on test.sh and add validation to toolchain nightly --- scripts/workflows/format.sh | 8 ++++++++ scripts/workflows/test.sh | 6 ------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/scripts/workflows/format.sh b/scripts/workflows/format.sh index 3513fcd1f9..bc3ce569b6 100755 --- a/scripts/workflows/format.sh +++ b/scripts/workflows/format.sh @@ -1,4 +1,12 @@ #!/bin/bash + +# Check if the active toolchain is nightly +if ! rustup show active-toolchain | grep -q "nightly"; then + echo "The Rust nightly toolchain is not active. Activate it with:" + echo " rustup default nightly" + exit 1 +fi + for manifest in \ benches/Cargo.toml \ common/Cargo.toml \ diff --git a/scripts/workflows/test.sh b/scripts/workflows/test.sh index 15bb00fed8..21a0c7c5c1 100755 --- a/scripts/workflows/test.sh +++ b/scripts/workflows/test.sh @@ -1,10 +1,4 @@ #!/bin/bash -cargo build --manifest-path=benches/Cargo.toml -cargo build --manifest-path=common/Cargo.toml -cargo build --manifest-path=protocols/Cargo.toml -cargo build --manifest-path=roles/Cargo.toml -cargo build --manifest-path=utils/Cargo.toml - cargo test --manifest-path=roles/Cargo.toml --verbose --test '*' -- --nocapture cargo run --manifest-path=examples/sv1-client-and-server/Cargo.toml --bin client_and_server -- 60 From 06a78b7df5eda1fbbcbd6a5dcb6d40d30aaf62b3 Mon Sep 17 00:00:00 2001 From: devworlds Date: Mon, 6 Jan 2025 14:40:08 -0300 Subject: [PATCH 19/24] chore: add loop to build.sh, keep only tests with loop on test.sh, and create a new script with examples with new job ci-example. --- .github/workflows/rust-check.yaml | 32 +++++++++++++++++++++++++- scripts/workflows/build.sh | 11 +++++---- scripts/workflows/example.sh | 7 ++++++ scripts/workflows/test.sh | 38 +++++++------------------------ 4 files changed, 53 insertions(+), 35 deletions(-) create mode 100755 scripts/workflows/example.sh diff --git a/.github/workflows/rust-check.yaml b/.github/workflows/rust-check.yaml index 98e0712220..0cb57be371 100644 --- a/.github/workflows/rust-check.yaml +++ b/.github/workflows/rust-check.yaml @@ -121,4 +121,34 @@ jobs: - name: Run CI script run: ./scripts/workflows/test.sh - working-directory: . \ No newline at end of file + working-directory: . + +ci-example: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - macos-13 + - ubuntu-latest + include: + - os: macos-13 + target: x86_64-apple-darwin + - os: ubuntu-latest + target: x86_64-unknown-linux-musl + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set OS environment variable + run: echo "CI_OS=${{ matrix.os }}" >> $GITHUB_ENV + + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + + - name: Run examples script + run: ./scripts/workflows/example.sh + working-directory: . diff --git a/scripts/workflows/build.sh b/scripts/workflows/build.sh index b95c7d9ab3..1cbf755f23 100755 --- a/scripts/workflows/build.sh +++ b/scripts/workflows/build.sh @@ -1,5 +1,8 @@ #!/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 +for manifest in \ + benches/Cargo.toml \ + protocols/Cargo.toml \ + roles/Cargo.toml \ + utils/Cargo.toml; do + cargo build --manifest-path="$manifest" +done diff --git a/scripts/workflows/example.sh b/scripts/workflows/example.sh new file mode 100755 index 0000000000..a3db62bba7 --- /dev/null +++ b/scripts/workflows/example.sh @@ -0,0 +1,7 @@ +#!/bin/bash +for example in \ + "examples/ping-pong-with-noise/Cargo.toml --bin ping_pong_with_noise -- 10" \ + "examples/ping-pong-without-noise/Cargo.toml --bin ping_pong_without_noise -- 10"; do + # shellcheck disable=SC2046 + cargo run --manifest-path=$(echo "$example" | awk '{print $1}') $(echo "$example" | cut -d' ' -f2-) +done \ No newline at end of file diff --git a/scripts/workflows/test.sh b/scripts/workflows/test.sh index 21a0c7c5c1..6a278516af 100755 --- a/scripts/workflows/test.sh +++ b/scripts/workflows/test.sh @@ -1,34 +1,12 @@ #!/bin/bash -cargo test --manifest-path=roles/Cargo.toml --verbose --test '*' -- --nocapture -cargo run --manifest-path=examples/sv1-client-and-server/Cargo.toml --bin client_and_server -- 60 - -if [ "$CI_OS" == "ubuntu-latest" ]; then - ./run.sh 30 -else - echo "Skipping interop-test on $CI_OS - not supported" -fi - -cd examples/interop-cpp/ || exit - -if [ "$CI_OS" == "ubuntu-latest" ]; then - ./run.sh 30 -else - echo "Skipping fuzz test on $CI_OS - not supported" -fi - -cd ../.. -cd utils/buffer/fuzz/ || exit - -cd ../../.. -cargo test --manifest-path=benches/Cargo.toml -cargo test --manifest-path=common/Cargo.toml -cargo test --manifest-path=protocols/Cargo.toml -cargo test --manifest-path=roles/Cargo.toml -cargo test --manifest-path=utils/Cargo.toml +for manifest in \ + benches/Cargo.toml \ + common/Cargo.toml \ + protocols/Cargo.toml \ + roles/Cargo.toml \ + utils/Cargo.toml; do + cargo test --manifest-path="$manifest" +done cargo test --manifest-path=protocols/Cargo.toml --features prop_test - -cargo run --manifest-path=examples/ping-pong-with-noise/Cargo.toml --bin ping_pong_with_noise -- 10 - -cargo run --manifest-path=examples/ping-pong-without-noise/Cargo.toml --bin ping_pong_without_noise -- 10 From 07bd8a0dbc9944eec71bd2bfb86b3a8ab838cc28 Mon Sep 17 00:00:00 2001 From: devworlds Date: Mon, 6 Jan 2025 14:49:58 -0300 Subject: [PATCH 20/24] chore: fic rust-check.yaml format --- .github/workflows/rust-check.yaml | 58 +++++++++++++++---------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/.github/workflows/rust-check.yaml b/.github/workflows/rust-check.yaml index 0cb57be371..7305ad69e8 100644 --- a/.github/workflows/rust-check.yaml +++ b/.github/workflows/rust-check.yaml @@ -123,32 +123,32 @@ jobs: run: ./scripts/workflows/test.sh working-directory: . -ci-example: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: - - macos-13 - - ubuntu-latest - include: - - os: macos-13 - target: x86_64-apple-darwin - - os: ubuntu-latest - target: x86_64-unknown-linux-musl - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Set OS environment variable - run: echo "CI_OS=${{ matrix.os }}" >> $GITHUB_ENV - - - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true - - - name: Run examples script - run: ./scripts/workflows/example.sh - working-directory: . + ci-example: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - macos-13 + - ubuntu-latest + include: + - os: macos-13 + target: x86_64-apple-darwin + - os: ubuntu-latest + target: x86_64-unknown-linux-musl + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set OS environment variable + run: echo "CI_OS=${{ matrix.os }}" >> $GITHUB_ENV + + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + + - name: Run examples script + run: ./scripts/workflows/example.sh + working-directory: . From dacb358b0510cbb6be6a41091b4cde174473ea67 Mon Sep 17 00:00:00 2001 From: devworlds Date: Fri, 20 Dec 2024 01:03:09 -0300 Subject: [PATCH 21/24] 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 | 138 +++++++++++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100644 .github/workflows/general-check.yaml diff --git a/.github/workflows/general-check.yaml b/.github/workflows/general-check.yaml new file mode 100644 index 0000000000..80c461cbad --- /dev/null +++ b/.github/workflows/general-check.yaml @@ -0,0 +1,138 @@ +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + Msrv-Check: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + rust: + - 1.75.0 # MSRV + + steps: + - uses: actions/checkout@v2 + - uses: Swatinem/rust-cache@v1.2.0 + - uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.rust }} + override: true + - name: Build Projects + 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 + + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + - uses: actions/cache@v2 + with: + path: ~/.cargo/registry + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-registry- + - uses: actions/cache@v2 + with: + path: ~/.cargo/git + key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-index- + - 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: | + 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 }} + steps: + - uses: actions/checkout@v4 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly + override: true + components: rustfmt + - name: Run fmt in different workspaces and crates + 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 }} + steps: + - uses: actions/checkout@v4 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: 1.75.0 + override: true + components: clippy + - name: Run Clippy on different workspaces and crates + 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 From faa936ee53b89c38b9e1b9b4299a128b146bbef4 Mon Sep 17 00:00:00 2001 From: Georges Palauqui Date: Thu, 26 Dec 2024 09:51:48 +0100 Subject: [PATCH 22/24] `common_messages_sv2` `job_declaration_sv2` `mining_sv2` `template_distribution_sv2`: remove the `no_std` feature and make them `#![no_std]` as they never use `std` anywhere. - bump their MAJOR version because of feature removal - bump the dependant crates PATCH version - updates docs chore: create shell script to make general-check.yaml more clean. chore: move shell scripts to /scripts chore: fix path to script on general-check.yaml chore: fix path to script on general-check.yaml --- .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, 76 insertions(+), 64 deletions(-) create mode 100755 scripts/build_projects.sh create mode 100755 scripts/run_clippy.sh create mode 100755 scripts/run_fmt.sh create mode 100755 scripts/run_semver_checks.sh diff --git a/.github/workflows/general-check.yaml b/.github/workflows/general-check.yaml index 80c461cbad..0c5c235c17 100644 --- a/.github/workflows/general-check.yaml +++ b/.github/workflows/general-check.yaml @@ -23,23 +23,7 @@ jobs: toolchain: ${{ matrix.rust }} override: true - name: Build Projects - 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 + run: ./scripts/build_projects.sh Semver-check: runs-on: ubuntu-latest @@ -65,35 +49,21 @@ 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: | - 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 + run: ./scripts/run_semver_checks.sh 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 @@ -103,20 +73,21 @@ jobs: override: true components: rustfmt - name: Run fmt in different workspaces and crates - 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 + run: ./scripts/run_fmt.sh 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 @@ -126,13 +97,4 @@ jobs: override: true components: clippy - name: Run Clippy on different workspaces and crates - 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 + run: ./scripts/run_clippy.sh diff --git a/scripts/build_projects.sh b/scripts/build_projects.sh new file mode 100755 index 0000000000..b95c7d9ab3 --- /dev/null +++ b/scripts/build_projects.sh @@ -0,0 +1,5 @@ +#!/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 new file mode 100755 index 0000000000..0238578a75 --- /dev/null +++ b/scripts/run_clippy.sh @@ -0,0 +1,10 @@ +#!/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 new file mode 100755 index 0000000000..3513fcd1f9 --- /dev/null +++ b/scripts/run_fmt.sh @@ -0,0 +1,10 @@ +#!/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 new file mode 100755 index 0000000000..d517e1958e --- /dev/null +++ b/scripts/run_semver_checks.sh @@ -0,0 +1,25 @@ +#!/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 From 76c9aa176831783f267a16baf0f2faf7df700cda Mon Sep 17 00:00:00 2001 From: Gary Krause Date: Thu, 12 Dec 2024 19:21:30 -0500 Subject: [PATCH 23/24] 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 0c5c235c17..80c461cbad 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 b95c7d9ab3..0000000000 --- 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 0238578a75..0000000000 --- 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 3513fcd1f9..0000000000 --- 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 d517e1958e..0000000000 --- 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 From 75e867a6e36531645ba032100a5ef9db3ea63a86 Mon Sep 17 00:00:00 2001 From: Gary Krause Date: Thu, 12 Dec 2024 19:21:30 -0500 Subject: [PATCH 24/24] 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: add condition to check if directory exist chore: fix path to test.sh chore: try to fix path to test.sh --- .github/workflows/general-check.yaml | 138 --------------------------- 1 file changed, 138 deletions(-) delete mode 100644 .github/workflows/general-check.yaml diff --git a/.github/workflows/general-check.yaml b/.github/workflows/general-check.yaml deleted file mode 100644 index 80c461cbad..0000000000 --- a/.github/workflows/general-check.yaml +++ /dev/null @@ -1,138 +0,0 @@ -on: - push: - branches: - - main - pull_request: - branches: - - main - -jobs: - Msrv-Check: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - rust: - - 1.75.0 # MSRV - - steps: - - uses: actions/checkout@v2 - - uses: Swatinem/rust-cache@v1.2.0 - - uses: actions-rs/toolchain@v1 - with: - toolchain: ${{ matrix.rust }} - override: true - - name: Build Projects - 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 - - steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true - - uses: actions/cache@v2 - with: - path: ~/.cargo/registry - key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-cargo-registry- - - uses: actions/cache@v2 - with: - path: ~/.cargo/git - key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-cargo-index- - - 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: | - 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 }} - steps: - - uses: actions/checkout@v4 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: nightly - override: true - components: rustfmt - - name: Run fmt in different workspaces and crates - 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 }} - steps: - - uses: actions/checkout@v4 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: 1.75.0 - override: true - components: clippy - - name: Run Clippy on different workspaces and crates - 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