Skip to content

Add CLAUDE.md and update README.md #595

Add CLAUDE.md and update README.md

Add CLAUDE.md and update README.md #595

Workflow file for this run

name: Test workflow
on:
push:
branches:
- main
pull_request:
branches:
- main
types: [opened, synchronize]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
POLKADOT_VERSION: polkadot-stable2506-2
jobs:
machete:
name: Check for Unneeded Dependencies
runs-on: ubuntu-24.04
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
steps:
- name: Checkout This Repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Run Sccache
uses: mozilla-actions/[email protected]
- name: Install the Rust Toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install the Cargo Make Binary
uses: davidB/rust-cargo-make@v1
- name: Run Cargo Machete
run: cargo make machete
check-fmt:
name: Check Formatting
runs-on: ubuntu-24.04
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
steps:
- name: Checkout This Repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Run Sccache
uses: mozilla-actions/[email protected]
- name: Install the Rust Toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install the Cargo Make Binary
uses: davidB/rust-cargo-make@v1
- name: Run Cargo Formatter
run: cargo make fmt-check
check-clippy:
name: Check Clippy Lints
runs-on: ubuntu-24.04
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
steps:
- name: Checkout This Repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Run Sccache
uses: mozilla-actions/[email protected]
- name: Install the Rust Toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install the Cargo Make Binary
uses: davidB/rust-cargo-make@v1
- name: Run Cargo Clippy
run: cargo make clippy
test:
name: Unit Tests
runs-on: ${{ matrix.os }}
needs: cache-polkadot
strategy:
matrix:
os: [ubuntu-24.04, macos-14]
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
POLKADOT_SDK_COMMIT_HASH: "30cda2aad8612a10ff729d494acd9d5353294d63"
steps:
- name: Checkout This Repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Run Sccache
uses: mozilla-actions/[email protected]
- name: Install the Rust Toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: "wasm32-unknown-unknown"
components: "rust-src,rust-std"
- name: Install the Cargo Make Binary
uses: davidB/rust-cargo-make@v1
- name: Caching Step
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/eth-rpc
~/.cargo/bin/revive-dev-node
key: polkadot-binaries-${{ env.POLKADOT_SDK_COMMIT_HASH }}-${{ matrix.os }}
- name: Install Geth on Ubuntu
if: matrix.os == 'ubuntu-24.04'
run: |
sudo add-apt-repository -y ppa:ethereum/ethereum
sudo apt-get update
sudo apt-get install -y protobuf-compiler
sudo apt-get install -y solc
# We were facing some issues in CI with the 1.16.* versions of geth, and specifically on
# Ubuntu. Eventually, we found out that the last version of geth that worked in our CI was
# version 1.15.11. Thus, this is the version that we want to use in CI. The PPA sadly does
# not have historic versions of Geth and therefore we need to resort to downloading pre
# built binaries for Geth and the surrounding tools which is what the following parts of
# the script do.
sudo apt-get install -y wget ca-certificates tar
ARCH=$(uname -m)
if [ "$ARCH" = "x86_64" ]; then
URL="https://gethstore.blob.core.windows.net/builds/geth-alltools-linux-amd64-1.15.11-36b2371c.tar.gz"
elif [ "$ARCH" = "aarch64" ]; then
URL="https://gethstore.blob.core.windows.net/builds/geth-alltools-linux-arm64-1.15.11-36b2371c.tar.gz"
else
echo "Unsupported architecture: $ARCH"
exit 1
fi
wget -qO- "$URL" | sudo tar xz -C /usr/local/bin --strip-components=1
geth --version
curl -sL https://github.com/paritytech/revive/releases/download/v0.3.0/resolc-x86_64-unknown-linux-musl -o resolc
chmod +x resolc
sudo mv resolc /usr/local/bin
- name: Install Geth on macOS
if: matrix.os == 'macos-14'
run: |
brew tap ethereum/ethereum
brew install ethereum protobuf
brew install solidity
curl -sL https://github.com/paritytech/revive/releases/download/v0.3.0/resolc-universal-apple-darwin -o resolc
chmod +x resolc
sudo mv resolc /usr/local/bin
- name: Install Kurtosis on macOS
if: matrix.os == 'macos-14'
run: brew install kurtosis-tech/tap/kurtosis-cli
- name: Install Kurtosis on Ubuntu
if: matrix.os == 'ubuntu-24.04'
run: |
echo "deb [trusted=yes] https://apt.fury.io/kurtosis-tech/ /" | sudo tee /etc/apt/sources.list.d/kurtosis.list
sudo apt update
sudo apt install kurtosis-cli
- name: Run Tests
run: cargo make test
cache-polkadot:
name: Build and Cache Polkadot Binaries on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-24.04, macos-14]
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
RUSTFLAGS: "-Awarnings"
POLKADOT_SDK_COMMIT_HASH: "30cda2aad8612a10ff729d494acd9d5353294d63"
steps:
- name: Caching Step
id: cache-step
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/eth-rpc
~/.cargo/bin/revive-dev-node
key: polkadot-binaries-${{ env.POLKADOT_SDK_COMMIT_HASH }}-${{ matrix.os }}
- name: Checkout the Polkadot SDK Repository
uses: actions/checkout@v4
if: steps.cache-step.outputs.cache-hit != 'true'
with:
repository: paritytech/polkadot-sdk
ref: ${{ env.POLKADOT_SDK_COMMIT_HASH }}
submodules: recursive
- name: Run Sccache
uses: mozilla-actions/[email protected]
if: steps.cache-step.outputs.cache-hit != 'true'
- name: Install the Rust Toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
if: steps.cache-step.outputs.cache-hit != 'true'
with:
target: "wasm32-unknown-unknown"
components: "rust-src"
toolchain: "1.90.0"
- name: Install dependencies (Linux)
if: matrix.os == 'ubuntu-24.04' && steps.cache-step.outputs.cache-hit != 'true'
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler clang libclang-dev
- name: Install dependencies (macOS)
if: matrix.os == 'macos-14' && steps.cache-step.outputs.cache-hit != 'true'
run: |
brew install protobuf llvm
LLVM_PREFIX="$(brew --prefix llvm)"
echo "LDFLAGS=-L${LLVM_PREFIX}/lib" >> "$GITHUB_ENV"
echo "CPPFLAGS=-I${LLVM_PREFIX}/include" >> "$GITHUB_ENV"
echo "CMAKE_PREFIX_PATH=${LLVM_PREFIX}" >> "$GITHUB_ENV"
echo "LIBCLANG_PATH=${LLVM_PREFIX}/lib" >> "$GITHUB_ENV"
echo "DYLD_FALLBACK_LIBRARY_PATH=${LLVM_PREFIX}/lib" >> "$GITHUB_ENV"
echo "${LLVM_PREFIX}/bin" >> "$GITHUB_PATH"
- name: Build Polkadot Dependencies
if: steps.cache-step.outputs.cache-hit != 'true'
run: |
cargo build \
--locked \
--profile production \
--package revive-dev-node \
--package pallet-revive-eth-rpc;
mv ./target/production/revive-dev-node ~/.cargo/bin
mv ./target/production/eth-rpc ~/.cargo/bin
chmod +x ~/.cargo/bin/*