-
Notifications
You must be signed in to change notification settings - Fork 487
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add makefile and improve CI (#1354)
* deps: update substrate to polkadot-v1.9.0 * fix tests * chore: add makefile and improve CI * disable test of evm benchmarks * some trivials * some trivials * apply review suggestions
- Loading branch information
Showing
16 changed files
with
336 additions
and
160 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: Lint | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- 'polkadot-v**' | ||
pull_request: | ||
branches: | ||
- master | ||
- 'polkadot-v**' | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
RUSTC_WRAPPER: "sccache" | ||
SCCACHE_GHA_ENABLED: "true" | ||
|
||
jobs: | ||
lint: | ||
name: Run Code Lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v4 | ||
|
||
- name: Cache cargo registry & git sources | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
~/.cargo/bin/ | ||
~/.cargo/registry/ | ||
~/.cargo/git/db/ | ||
key: ${{ runner.os }}-cargo-lint-${{ hashFiles('**/Cargo.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-cargo-lint-${{ hashFiles('**/Cargo.lock') }} | ||
${{ runner.os }}-cargo-lint- | ||
${{ runner.os }}-cargo- | ||
- name: Run sccache | ||
uses: mozilla-actions/[email protected] | ||
|
||
- name: Install Rust toolchain | ||
run: make setup | ||
|
||
- name: Install protoc | ||
uses: arduino/setup-protoc@v3 | ||
with: | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Check code format | ||
run: make fmt-check | ||
|
||
- name: Run clippy | ||
run: make clippy-release |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
name: Test | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- 'polkadot-v**' | ||
pull_request: | ||
branches: | ||
- master | ||
- 'polkadot-v**' | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
RUSTC_WRAPPER: "sccache" | ||
SCCACHE_GHA_ENABLED: "true" | ||
|
||
jobs: | ||
unit-test: | ||
name: Run Unit Tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v4 | ||
|
||
- name: Cache cargo registry & git sources | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
~/.cargo/bin/ | ||
~/.cargo/registry/ | ||
~/.cargo/git/db/ | ||
key: ${{ runner.os }}-cargo-unittest-${{ hashFiles('**/Cargo.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-cargo-unittest-${{ hashFiles('**/Cargo.lock') }} | ||
${{ runner.os }}-cargo-unittest- | ||
${{ runner.os }}-cargo- | ||
- name: Run sccache | ||
uses: mozilla-actions/[email protected] | ||
|
||
- name: Install Rust toolchain | ||
run: make setup | ||
|
||
- name: Install protoc | ||
uses: arduino/setup-protoc@v3 | ||
with: | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Run unit tests | ||
run: make test-release | ||
|
||
integration-test: | ||
name: Run Integration Tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v4 | ||
|
||
- name: Cache cargo registry & git sources | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
~/.cargo/bin/ | ||
~/.cargo/registry/ | ||
~/.cargo/git/db/ | ||
key: ${{ runner.os }}-cargo-integration-test-${{ hashFiles('**/Cargo.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-cargo-integration-test-${{ hashFiles('**/Cargo.lock') }} | ||
${{ runner.os }}-cargo-integration-test- | ||
${{ runner.os }}-cargo- | ||
- name: Run sccache | ||
uses: mozilla-actions/[email protected] | ||
|
||
- name: Install Rust toolchain | ||
run: make setup | ||
|
||
- name: Install protoc | ||
uses: arduino/setup-protoc@v3 | ||
with: | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build client | ||
run: make build-release | ||
|
||
- name: Setup node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
|
||
- name: Run integration tests | ||
run: make integration-test |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
.PHONY: setup | ||
# Setup development environment | ||
setup: | ||
bash ./scripts/setup-dev.sh | ||
|
||
.PHONY: clean | ||
# Cleanup compilation outputs | ||
clean: | ||
cargo clean | ||
|
||
.PHONY: fmt-check fmt | ||
# Check the code format | ||
fmt-check: | ||
taplo fmt --check | ||
cargo fmt --all -- --check | ||
# Format the code | ||
fmt: | ||
taplo fmt | ||
cargo fmt --all | ||
|
||
.PHONY: clippy clippy-release | ||
# Run rust clippy with debug profile | ||
clippy: | ||
cargo clippy --all --all-targets --features=runtime-benchmarks,try-runtime -- -D warnings | ||
# Run rust clippy with release profile | ||
clippy-release: | ||
cargo clippy --release --all --all-targets --features=runtime-benchmarks,try-runtime -- -D warnings | ||
|
||
.PHONY: check check-release | ||
# Check code with debug profile | ||
check: | ||
cargo check | ||
# Check code with release profile | ||
check-release: | ||
cargo check --release | ||
|
||
.PHONY: build build-release | ||
# Build all binaries with debug profile | ||
build: | ||
WASM_BUILD_TYPE=debug cargo build | ||
# Build all binaries with release profile | ||
build-release: | ||
WASM_BUILD_TYPE=release cargo build --release | ||
|
||
.PHONY: test test-release | ||
# Run all unit tests with debug profile | ||
test: | ||
cargo test --lib --all | ||
cargo test --lib --all --features=runtime-benchmarks | ||
# Run all unit tests with release profile | ||
test-release: | ||
cargo test --release --lib --all | ||
cargo test --release --lib --all --features=runtime-benchmarks | ||
|
||
.PHONY: integration-test integration-test-lint | ||
# Check code format and lint of integration tests | ||
integration-test-lint: | ||
cd ts-tests && npm install && npm run fmt-check | ||
# Run all integration tests | ||
integration-test: build-release integration-test-lint | ||
cd ts-tests && npm run build && npm run test && npm run test-sql | ||
|
||
.PHONY: help | ||
# Show help | ||
help: | ||
@echo '' | ||
@echo 'Usage:' | ||
@echo ' make [target]' | ||
@echo '' | ||
@echo 'Targets:' | ||
@awk '/^[a-zA-Z\-\_0-9]+:/ { \ | ||
helpMessage = match(lastLine, /^# (.*)/); \ | ||
if (helpMessage) { \ | ||
helpCommand = substr($$1, 0, index($$1, ":")); \ | ||
helpMessage = substr(lastLine, RSTART + 2, RLENGTH); \ | ||
printf "\033[36m%-30s\033[0m %s\n", helpCommand,helpMessage; \ | ||
} \ | ||
} \ | ||
{ lastLine = $$0 }' $(MAKEFILE_LIST) | ||
|
||
.DEFAULT_GOAL := help |
Oops, something went wrong.