Marko/sdk refactor #2305
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Lint and Features check | |
on: | |
push: | |
branches: | |
- main | |
- develop | |
pull_request: | |
branches: | |
- main | |
- develop | |
workflow_dispatch: | |
env: | |
CARGO_SCCACHE_COMMIT: bed5571c | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Rust toolchain | |
run: | | |
curl https://sh.rustup.rs -sSf | sh -s -- -y | |
source "$HOME/.cargo/env" | |
rustup show | |
- name: Check code formatting | |
run: cargo fmt --check | |
- name: Check E2E code formatting | |
run: cargo fmt --manifest-path e2e/Cargo.toml --check | |
- name: Check Avail-SubXt code formatting | |
run: cargo fmt --manifest-path avail-subxt/Cargo.toml --check | |
- name: Install zepter | |
run: cargo install zepter --locked --version 0.11.0 -q -f --no-default-features && zepter --version | |
- name: Check toml formatting | |
run: zepter format features | |
- name: Check e2e toml formatting | |
run: zepter format features --manifest-path e2e/Cargo.toml | |
- name: Check Avail-SubXt toml formatting | |
run: zepter format features --manifest-path avail-subxt/Cargo.toml | |
build: | |
runs-on: ubuntu-latest | |
needs: [lint] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/ | |
~/.cargo/bin/sccache* | |
key: ${{ runner.OS }}-sccache-bin-${{ env.CARGO_SCCACHE_COMMIT }}-v1 | |
- name: Install system dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y build-essential pkg-config libssl-dev valgrind git clang curl libssl-dev protobuf-compiler unzip python3-pip | |
- name: Setup Rust toolchain | |
run: | | |
curl https://sh.rustup.rs -sSf | sh -s -- -y | |
source "$HOME/.cargo/env" | |
rustup show | |
- name: Set PATH for cargo | |
run: | | |
echo "$HOME/.cargo/bin" >> $GITHUB_PATH | |
echo "SCCACHE_DIR=${HOME}/.cache/sccache" >> $GITHUB_ENV | |
- name: SCCache | |
run: | | |
# We altered the path to avoid old actions to overwrite it | |
if [ ! -f ~/.cargo/bin/sccache ]; then | |
cargo install sccache \ | |
--git https://github.com/purestake/sccache.git \ | |
--rev $CARGO_SCCACHE_COMMIT \ | |
--force --no-default-features --features=dist-client | |
fi | |
if [[ -z `pgrep sccache` ]]; then | |
chmod +x ~/.cargo/bin/sccache | |
sccache --start-server | |
fi | |
sccache -s | |
echo "RUSTC_WRAPPER=${HOME}/.cargo/bin/sccache" >> $GITHUB_ENV | |
- name: Build node | |
run: cargo build --release -p avail-node | |
- name: Upload avail-node binary | |
uses: actions/upload-artifact@v4 | |
with: | |
name: avail-node | |
path: target/release/avail-node | |
- name: Display SCCache Stats | |
run: sccache --show-stats | |
check_features: | |
runs-on: ubuntu-latest | |
needs: [build] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/cache/restore@v3 | |
with: | |
path: | | |
~/.cache/ | |
~/.cargo/bin/sccache* | |
key: ${{ runner.OS }}-cache-bin-${{ env.CARGO_SCCACHE_COMMIT }}-v1 | |
- name: Install system dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y build-essential pkg-config libssl-dev valgrind git clang curl libssl-dev protobuf-compiler unzip python3-pip | |
- name: Setup Rust toolchain | |
run: | | |
curl https://sh.rustup.rs -sSf | sh -s -- -y | |
source "$HOME/.cargo/env" | |
rustup show | |
- name: Set PATH for cargo | |
run: | | |
echo "$HOME/.cargo/bin" >> $GITHUB_PATH | |
echo "SCCACHE_DIR=${HOME}/.cache/sccache" >> $GITHUB_ENV | |
- name: SCCache | |
run: | | |
# We altered the path to avoid old actions to overwrite it | |
if [ ! -f ~/.cargo/bin/sccache ]; then | |
cargo install sccache \ | |
--git https://github.com/purestake/sccache.git \ | |
--rev $CARGO_SCCACHE_COMMIT \ | |
--force --no-default-features --features=dist-client | |
fi | |
if [[ -z `pgrep sccache` ]]; then | |
chmod +x ~/.cargo/bin/sccache | |
sccache --start-server | |
fi | |
sccache -s | |
echo "RUSTC_WRAPPER=${HOME}/.cargo/bin/sccache" >> $GITHUB_ENV | |
- name: Check other features | |
env: | |
SKIP_WASM_BUILD: true | |
run: cargo check --release --workspace --features "runtime-benchmarks try-runtime" -p avail-node |