From 5c90ccc31c2acce44aced79f766bd29b529e800d Mon Sep 17 00:00:00 2001 From: Joseph Livesey Date: Sun, 25 Aug 2024 09:44:13 -0400 Subject: [PATCH 1/2] ci: set up Rust CI checks --- .github/workflows/tests.yaml | 66 ++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 .github/workflows/tests.yaml diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml new file mode 100644 index 0000000..a987965 --- /dev/null +++ b/.github/workflows/tests.yaml @@ -0,0 +1,66 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + workflow_dispatch: + +jobs: + fmt: + name: cargo fmt + runs-on: ubuntu-latest + container: + image: rust:1.80-bookworm + steps: + - uses: actions/checkout@v3 + - run: | + rustup toolchain install nightly + rustup component add rustfmt --toolchain nightly + cargo +nightly fmt --all -- --check + clippy: + name: cargo clippy + runs-on: ubuntu-latest + container: + image: rust:1.80-bookworm + steps: + - uses: actions/checkout@v3 + - uses: actions/cache@v3 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-clippy-${{ hashFiles('**/Cargo.lock') }} + - name: Install Protoc + uses: arduino/setup-protoc@v3 + - run: | + rustup component add clippy + cargo clippy --all-targets -- -D warnings + + test: + name: cargo test + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + actions: read + container: + image: rust:1.80-bookworm + steps: + - uses: actions/checkout@v3 + - uses: actions/cache@v3 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock') }} + - name: Install Protoc + uses: arduino/setup-protoc@v3 + - name: Run tests + run: cargo test --release --all-features -- --nocapture From 53f9c96d57a20313317c2355bf4e4106ff27790d Mon Sep 17 00:00:00 2001 From: Joseph Livesey Date: Sun, 25 Aug 2024 09:58:12 -0400 Subject: [PATCH 2/2] ci: disable doc tests TRU-278 --- Cargo.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index b7a7899..2d58e9c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,6 +3,9 @@ name = "sf-protos" version = "0.1.0" edition = "2021" +[lib] +doctest = false + [dependencies] alloy-primitives = "=0.7.7" ethportal-api = { git = "https://github.com/ethereum/trin.git", version = "0.2.2", tag = "v0.1.0-alpha.35" }