Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
157 changes: 131 additions & 26 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,63 +14,168 @@ concurrency:
cancel-in-progress: true

jobs:
check:
# Fast format check - fails early if formatting is wrong
check-fmt:
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: rust-src, rustfmt, clippy
- name: Setup toolchain
run: |
rustup toolchain install 1.84.1 --profile minimal --component rustfmt
rustup default 1.84.1

- uses: Swatinem/rust-cache@v2

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

- name: Make dummy poc-guest files
run: make dummy-guests
check-wasm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Setup toolchain
run: |
rustup toolchain install 1.84.1 --profile minimal --component clippy
rustup default 1.84.1

- uses: Swatinem/rust-cache@v2

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

- name: Install pvq-program-metadata-gen
run: cargo install --path pvq-program-metadata-gen
# Root workspace clippy linting
clippy-root:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Clippy
run: make clippy
- name: Setup toolchain
run: |
rustup toolchain install 1.84.1 --profile minimal --component clippy
rustup default 1.84.1

- uses: Swatinem/rust-cache@v2

- name: Clippy root workspace
run: make clippy-root

# Guest examples clippy linting
clippy-guests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Setup toolchain
run: |
rustup toolchain install nightly-2025-06-09 --profile minimal --component clippy
rustup default nightly-2025-06-09

- uses: Swatinem/rust-cache@v2
with:
cache-bin: "false"

- name: Install polkatool and pvq-program-metadata-gen
run: |
make polkatool
make pvq-program-metadata-gen


- name: Clippy guest examples
run: make clippy-guests


# Run tests
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Setup toolchain
run: |
rustup toolchain install 1.84.1 --profile minimal
rustup default 1.84.1

- uses: Swatinem/rust-cache@v2

- name: Make dummy poc-guest files
run: make dummy-guests

- name: Run tests
run: make test

# Build guest programs in parallel using matrix
build-guest:
runs-on: ubuntu-latest
strategy:
matrix:
guest: [
sum-balance,
sum-balance-hand-written,
sum-balance-percent,
swap-info,
total-supply,
total-supply-hand-written,
transparent-call-hand-written
]
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Install toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rust-src, rustfmt, clippy
- name: Setup toolchain
run: |
rustup toolchain install nightly-2025-06-09 --profile minimal --component rust-src
rustup default nightly-2025-06-09

- uses: Swatinem/rust-cache@v2
with:
workspaces: |
guest-examples -> guest-examples/target
cache-all-crates: true
cache-bin: "false"
prefix-key: "guest-${{ matrix.guest }}"

- name: Install polkatool
run: make polkatool
- name: Install polkatool and pvq-program-metadata-gen
run: |
make polkatool
make pvq-program-metadata-gen

- name: Install pvq-program-metadata-gen
run: cargo install --path pvq-program-metadata-gen
- name: Build guest ${{ matrix.guest }}
run: make guest-${{ matrix.guest }}

- name: Build guests
run: make guests
- name: Upload guest artifact
uses: actions/upload-artifact@v4
with:
name: guest-${{ matrix.guest }}
path: output/guest-${{ matrix.guest }}.polkavm
retention-days: 1

# Collect all guest artifacts (optional - for when you need all guests together)
collect-guests:
runs-on: ubuntu-latest
needs: build-guest
if: github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'full-build')
steps:
- name: Download all guest artifacts
uses: actions/download-artifact@v4
with:
pattern: guest-*
path: output/
merge-multiple: true

- name: Upload combined guests
uses: actions/upload-artifact@v4
with:
name: all-guests
path: output/
retention-days: 7

8 changes: 0 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ members = [
"pvq-primitives",
"pvq-runtime-api",
"pvq-test-runner",

"examples/example-fungibles",
"examples/example-helloworld",
]
exclude = ["guest-examples", "vendor"]

Expand Down
31 changes: 21 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ guests: $(GUEST_TARGETS)
dummy-guests: $(DUMMY_GUEST_TARGETS)

guest-%:
cd guest-examples; METADATA_OUTPUT_DIR=$(realpath output) cargo build --release --bin guest-$* -p guest-$*
mkdir -p output
cd guest-examples; METADATA_OUTPUT_DIR=$(shell pwd)/output cargo build --release --bin guest-$* -p guest-$*
polkatool link --run-only-if-newer -s guest-examples/target/riscv32emac-unknown-none-polkavm/release/guest-$* -o output/guest-$*.polkavm

dummy-guest-%:
Expand Down Expand Up @@ -42,18 +42,29 @@ fmt:

.PHONY: check-wasm
check-wasm:
cargo check --no-default-features --target=wasm32-unknown-unknown -p pvq-program -p pvq-executor -p pvq-extension-core -p pvq-extension-fungibles -p pvq-extension -p pvq-primitives -p pvq-runtime-api
SKIP_WASM_BUILD= cargo check --no-default-features --target=wasm32-unknown-unknown -p poc-runtime
cargo check --no-default-features --target=wasm32-unknown-unknown \
-p pvq-program \
-p pvq-program-metadata-gen \
-p pvq-executor \
-p pvq-extension-core \
-p pvq-extension-fungibles \
-p pvq-extension-swap \
-p pvq-extension \
-p pvq-primitives \
-p pvq-runtime-api
cargo check -p poc-runtime

.PHONY: check
check: check-wasm
SKIP_WASM_BUILD= cargo check
cd pvq-program/examples; cargo check
.PHONY: clippy-root
clippy-root:
SKIP_WASM_BUILD=1 cargo clippy -- -D warnings

.PHONY: clippy-guests
clippy-guests:
mkdir -p output
cd guest-examples; METADATA_OUTPUT_DIR=$(shell pwd)/output cargo clippy --all

.PHONY: clippy
clippy:
SKIP_WASM_BUILD= cargo clippy -- -D warnings
cd guest-examples; METADATA_OUTPUT_DIR=$(realpath output) cargo clippy --all
clippy: clippy-root clippy-guests

.PHONY: test
test:
Expand Down
6 changes: 0 additions & 6 deletions examples/example-fungibles/Cargo.toml

This file was deleted.

3 changes: 0 additions & 3 deletions examples/example-fungibles/src/main.rs

This file was deleted.

6 changes: 0 additions & 6 deletions examples/example-helloworld/Cargo.toml

This file was deleted.

3 changes: 0 additions & 3 deletions examples/example-helloworld/src/main.rs

This file was deleted.

9 changes: 0 additions & 9 deletions guest-examples/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion guest-examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ members = [
"total-supply",
"total-supply-hand-written",
"transparent-call-hand-written",
"test-swap-extension",
"swap-info",
]
resolver = "2"
Expand Down
4 changes: 1 addition & 3 deletions guest-examples/sum-balance/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ fn main() {
println!("cargo:rerun-if-changed=src/main.rs");
let current_dir = env::current_dir().expect("Failed to get current directory");
// Determine the output directory for the metadata
let output_dir = PathBuf::from(env::var("METADATA_OUTPUT_DIR").expect("METADATA_OUTPUT_DIR is not set"))
.canonicalize()
.expect("Failed to canonicalize output directory");
let output_dir = PathBuf::from(env::var("METADATA_OUTPUT_DIR").expect("METADATA_OUTPUT_DIR is not set"));

// Build and run the command
let status = Command::new("pvq-program-metadata-gen")
Expand Down
4 changes: 1 addition & 3 deletions guest-examples/swap-info/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ fn main() {
// println!("cargo:rerun-if-changed=src/main.rs");
let current_dir = env::current_dir().expect("Failed to get current directory");
// Determine the output directory for the metadata
let output_dir = PathBuf::from(env::var("METADATA_OUTPUT_DIR").expect("METADATA_OUTPUT_DIR is not set"))
.canonicalize()
.expect("Failed to canonicalize output directory");
let output_dir = PathBuf::from(env::var("METADATA_OUTPUT_DIR").expect("METADATA_OUTPUT_DIR is not set"));

// Build and run the command
let status = Command::new("pvq-program-metadata-gen")
Expand Down
9 changes: 0 additions & 9 deletions guest-examples/test-swap-extension/Cargo.toml

This file was deleted.

Loading
Loading