Skip to content

Commit

Permalink
fix ci (#100)
Browse files Browse the repository at this point in the history
* Use default test-runner

* Cleanup github workflow files

* Fix CI-linting
  • Loading branch information
richardpringle authored Dec 5, 2023
1 parent abfad24 commit 3789682
Show file tree
Hide file tree
Showing 10 changed files with 54 additions and 27 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/byzantine.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -43,4 +42,4 @@ jobs:
go-version: '1.19'

- name: Run e2e tests
run: scripts/tests.avalanchego-byzantine.sh
run: scripts/tests.avalanchego-byzantine.sh
5 changes: 2 additions & 3 deletions .github/workflows/conformance.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -43,4 +42,4 @@ jobs:
go-version: '1.19'

- name: Run e2e tests
run: scripts/tests.avalanchego-conformance.sh
run: scripts/tests.avalanchego-conformance.sh
7 changes: 2 additions & 5 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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: |
Expand All @@ -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:
Expand All @@ -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
4 changes: 1 addition & 3 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -42,6 +41,5 @@ jobs:
with:
go-version: '1.19'

# always downloads the latest
- name: Run e2e tests
run: scripts/tests.avalanchego-e2e.sh
36 changes: 29 additions & 7 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -13,8 +12,7 @@ permissions:
contents: write

jobs:
unit:
name: lint
fmt:
runs-on: ubuntu-latest
steps:
- name: Remove unnecessary files
Expand All @@ -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:
Expand All @@ -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
6 changes: 1 addition & 5 deletions .github/workflows/unit.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -30,16 +29,13 @@ 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:
version: "3.x"
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
10 changes: 10 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
3 changes: 3 additions & 0 deletions crates/avalanche-consensus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 3 additions & 0 deletions crates/avalanche-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion scripts/tests.unit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3789682

Please sign in to comment.