diff --git a/.github/workflows/byzantine.yml b/.github/workflows/byzantine.yml index 1615c6a..8fab3cc 100644 --- a/.github/workflows/byzantine.yml +++ b/.github/workflows/byzantine.yml @@ -1,6 +1,5 @@ -name: ci +name: ci-byzantine-tests -# ref. https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions on: push: branches: @@ -43,4 +42,4 @@ jobs: go-version: '1.19' - name: Run e2e tests - run: scripts/tests.avalanchego-byzantine.sh \ No newline at end of file + run: scripts/tests.avalanchego-byzantine.sh diff --git a/.github/workflows/conformance.yml b/.github/workflows/conformance.yml index b6e7961..bc92df9 100644 --- a/.github/workflows/conformance.yml +++ b/.github/workflows/conformance.yml @@ -1,6 +1,5 @@ -name: ci +name: ci-conformance-tests -# ref. https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions on: push: branches: @@ -43,4 +42,4 @@ jobs: go-version: '1.19' - name: Run e2e tests - run: scripts/tests.avalanchego-conformance.sh \ No newline at end of file + run: scripts/tests.avalanchego-conformance.sh diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 8b10f36..1be5791 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -1,6 +1,5 @@ -name: ci +name: ci-doc-tests -# ref. https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions on: push: branches: @@ -16,7 +15,6 @@ jobs: docs: name: docs runs-on: ubuntu-latest - # Fails the CI build if there are documentation warnings. steps: - name: Remove unnecessary files run: | @@ -31,8 +29,6 @@ jobs: uses: dtolnay/rust-toolchain@stable - name: Check Rust version run: rustc --version - # or use "abelfodil/protoc-action@v1" - # ref. https://github.com/hyperium/tonic/issues/1047#issuecomment-1222508191 - name: Install protoc uses: arduino/setup-protoc@v1 with: @@ -43,6 +39,7 @@ jobs: - name: Set env var shell: bash run: export 'RUSTFLAGS=-D warnings' + # Fails the CI build if there are documentation warnings. - name: Run doc tests shell: bash run: cargo doc --no-deps --all-features -p avalanche-consensus -p avalanche-types diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index fb46f46..50a385c 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -1,6 +1,5 @@ -name: ci +name: ci-e2e-tests -# ref. https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions on: push: branches: @@ -42,6 +41,5 @@ jobs: with: go-version: '1.19' - # always downloads the latest - name: Run e2e tests run: scripts/tests.avalanchego-e2e.sh diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index fb4f365..bbe3772 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,6 +1,5 @@ -name: ci +name: ci-clippy -# ref. https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions on: push: branches: @@ -13,8 +12,7 @@ permissions: contents: write jobs: - unit: - name: lint + fmt: runs-on: ubuntu-latest steps: - name: Remove unnecessary files @@ -30,8 +28,6 @@ jobs: uses: dtolnay/rust-toolchain@stable - name: Check Rust version run: rustc --version - # or use "abelfodil/protoc-action@v1" - # ref. https://github.com/hyperium/tonic/issues/1047#issuecomment-1222508191 - name: Install protoc uses: arduino/setup-protoc@v1 with: @@ -41,4 +37,30 @@ jobs: uses: actions/checkout@v3 - name: Run static analysis tests shell: bash - run: scripts/tests.lint.sh + run: cargo fmt --all --check + clippy: + runs-on: ubuntu-latest + steps: + - name: Remove unnecessary files + run: | + sudo rm -rf /usr/share/dotnet + sudo rm -rf "$AGENT_TOOLSDIRECTORY" + - name: Install linker + run: | + sudo apt-get update + sudo apt-get install -y --no-install-recommends \ + gcc-multilib + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + - name: Check Rust version + run: rustc --version + - name: Install protoc + uses: arduino/setup-protoc@v1 + with: + version: "3.x" + repo-token: ${{ secrets.GITHUB_TOKEN }} + - name: Checkout + uses: actions/checkout@v3 + - name: Run static analysis tests + shell: bash + run: cargo clippy --all --all-features --tests --benches --examples diff --git a/.github/workflows/unit.yml b/.github/workflows/unit.yml index c51783c..e832614 100644 --- a/.github/workflows/unit.yml +++ b/.github/workflows/unit.yml @@ -1,6 +1,5 @@ -name: ci +name: ci-unit-tests -# ref. https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions on: push: branches: @@ -30,8 +29,6 @@ jobs: uses: dtolnay/rust-toolchain@stable - name: Check Rust version run: rustc --version - # or use "abelfodil/protoc-action@v1" - # ref. https://github.com/hyperium/tonic/issues/1047#issuecomment-1222508191 - name: Install protoc uses: arduino/setup-protoc@v1 with: @@ -39,7 +36,6 @@ jobs: repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Checkout uses: actions/checkout@v3 - - uses: taiki-e/install-action@nextest - name: Run unit tests shell: bash run: scripts/tests.unit.sh diff --git a/Cargo.toml b/Cargo.toml index db91ef2..1038420 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,6 +13,16 @@ members = [ default-members = ["crates/avalanche-types", "crates/avalanche-consensus"] resolver = "2" +[workspace.lints.clippy] +# suspicious = "deny" +# style = "deny" +# complexity = "deny" +# perf = "deny" +# pedantic = "deny" +# restriction = "deny" +# nursery = "deny" +# cargo = "deny" + [workspace.package] version = "0.1.1" authors = ["gyuho", "hexfusion", "exdx", "richardpringle"] diff --git a/crates/avalanche-consensus/Cargo.toml b/crates/avalanche-consensus/Cargo.toml index ae26de5..e43c43c 100644 --- a/crates/avalanche-consensus/Cargo.toml +++ b/crates/avalanche-consensus/Cargo.toml @@ -10,6 +10,9 @@ license-file = "LICENSE" homepage = "https://avax.network" repository = "https://github.com/ava-labs/avalanche-rs/tree/main/crates/avalanche-consensus" +[lints] +workspace = true + [dependencies] avalanche-types = { version = "0.1.1", path = "../../crates/avalanche-types", features = [] } # https://crates.io/crates/avalanche-types bytes = "1.4.0" diff --git a/crates/avalanche-types/Cargo.toml b/crates/avalanche-types/Cargo.toml index ab78de2..0e15177 100644 --- a/crates/avalanche-types/Cargo.toml +++ b/crates/avalanche-types/Cargo.toml @@ -10,6 +10,9 @@ homepage = "https://avax.network" repository = "https://github.com/ava-labs/avalanche-rs/tree/main/crates/avalanche-types" readme = "README.md" +[lints] +workspace = true + [dependencies] async-trait = "0.1.73" # for "key::secp256k1" sign trait, https://github.com/dtolnay/async-trait bech32 = "0.9.1" diff --git a/scripts/tests.unit.sh b/scripts/tests.unit.sh index 96e019c..8a74a61 100755 --- a/scripts/tests.unit.sh +++ b/scripts/tests.unit.sh @@ -10,7 +10,7 @@ fi # https://github.com/nextest-rs/nextest/tree/main # local use: cargo install nextest -RUST_LOG=debug cargo nextest run \ +RUST_LOG=debug cargo test \ --all-features \ -p avalanche-types \ -p avalanche-consensus