Skip to content

Commit

Permalink
update ci (#22)
Browse files Browse the repository at this point in the history
* update ci

* improve ci

* dummy

* cache-all-crates

* fix

* fix

* udpate

* ci

* ci

* fix

* update

* check poc-runtime
  • Loading branch information
xlc authored May 22, 2024
1 parent 496ef9e commit b58e547
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 17 deletions.
52 changes: 41 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Check
name: Build

on:
push:
Expand All @@ -14,35 +14,65 @@ concurrency:
cancel-in-progress: true

jobs:
build:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Install toolchain
uses: dtolnay/rust-toolchain@nightly
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
components: rust-src, rustfmt, clippy

- uses: Swatinem/rust-cache@v2

- name: Check format
run: cargo fmt --all -- --check

- name: Make dummpy poc-guest.polkavm file
run: mkdir -p output; touch output/poc-guest.polkavm

- name: Cargo clippy
run: SKIP_WASM_BUILD= cargo clippy -- -D warnings

- name: Check no-std
run: make check-wasm

- name: Check std
run: SKIP_WASM_BUILD= cargo check

build-guest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Install toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
components: rustfmt, clippy

- uses: Swatinem/rust-cache@v2
with:
workspaces: poc/guest -> poc/guest/target
cache-all-crates: true

- name: Install toolchain targeting RV32E
run: |
curl -sL https://github.com/paritytech/rustc-rv32e-toolchain/releases/download/v1.1.0/rust-rve-nightly-2024-01-05-x86_64-unknown-linux-gnu.tar.zst -o rv32e.tar.zst
tar --zstd -xf rv32e.tar.zst
mv rve-nightly ~/.rustup/toolchains/
- uses: Swatinem/rust-cache@v2

- name: Check format
run: cargo fmt --all -- --check
- name: Cargo clippy
run: cd poc/guest; cargo clippy -- -D warnings

- name: Install polkatool
run: make tools
run: make polkatool

- name: Generate poc-guest.polkavm
run: make poc-guest

- name: Custom cargo clippy
run: make clippy
19 changes: 13 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,22 @@ poc-guest:
mkdir -p output
polkatool link --run-only-if-newer -s poc/guest/target/riscv32ema-unknown-none-elf/release/poc-guest -o output/poc-guest.polkavm

tools:
cargo install --git https://github.com/koute/polkavm --force polkatool
cargo install --git https://github.com/paritytech/polkadot-sdk --tag polkadot-v1.9.0 --force staging-chain-spec-builder
tools: polkatool chain-spec-builder

polkatool:
cargo install --git https://github.com/koute/polkavm polkatool

chain-spec-builder:
cargo install --git https://github.com/paritytech/polkadot-sdk --tag polkadot-v1.9.0 staging-chain-spec-builder

fmt:
cargo fmt --all -- --check
cargo fmt --all

check-wasm:
cargo check --no-default-features --target=wasm32-unknown-unknown -p xcq-api -p xcq-executor -p xcq-extension-core -p xcq-extension-fungibles -p xcq-extension -p xcq-primitives -p xcq-runtime-api -p xcq-types
SKIP_WASM_BUILD= cargo check --no-default-features --target=wasm32-unknown-unknown -p poc-runtime

check:
SKIP_WASM_BUILD= cargo check --no-default-features --target=wasm32-unknown-unknown
check: check-wasm
SKIP_WASM_BUILD= cargo check
cd poc/guest; cargo check

Expand Down
2 changes: 2 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
[toolchain]
channel = "1.78.0"
components = ["rust-src", "rustfmt", "clippy"]
targets = ["wasm32-unknown-unknown"]

0 comments on commit b58e547

Please sign in to comment.