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
55 changes: 54 additions & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,66 @@ jobs:
- name: Cargo hack; check each feature/crate on its own
run: cargo hack --exclude subxt --exclude subxt-signer --exclude subxt-lightclient --exclude subxt-rpcs --exclude-all-features --each-feature check --workspace

# Check the parachain-example code, which isn't a part of the workspace so is otherwise ignored.
# Check the full examples, which aren't a part of the workspace so are otherwise ignored.
- name: Cargo check parachain-example
run: cargo check --manifest-path examples/parachain-example/Cargo.toml
- name: Cargo check ffi-example
run: cargo check --manifest-path examples/ffi-example/Cargo.toml

- if: "failure()"
uses: "andymckay/cancel-action@a955d435292c0d409d104b57d8e78435a93a6ef1" # v0.5

ffi_example:
name: Run FFI Example
runs-on: ubuntu-latest
needs: [check]
steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Use substrate and polkadot node binaries
uses: ./.github/workflows/actions/use-nodes

- name: Install Rust stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: wasm32-unknown-unknown
override: true

- name: Rust Cache
uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2.7.8

- name: Install
uses: actions/setup-node@v4
with:
# Node version 20 and higher seem to cause an issue with the JS example so stick to 19 for now.
node-version: 19.x

- name: Cargo check/run ffi-example
run: |
# Start node on port 8000
substrate-node --dev --rpc-port 8000 > /dev/null 2>&1 &

# Build the Rust code (hopefully gives long enough for substrate server to start, too):
cd examples/ffi-example
cargo build

# Run the python version of the FFI code:
echo "Running Python FFI example..."
python3 src/main.py
echo "Python FFI example completed with exit code $?"

# Run the node version of the FFI code
echo "Installing Node.js dependencies..."
npm i
echo "Running Node FFI example..."
node src/main.js
echo "Node FFI example completed with exit code $?"

pkill substrate-node

wasm_check:
name: Cargo check (WASM)
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ exclude = [
"signer/wasm-tests",
"examples/wasm-example",
"examples/parachain-example",
"examples/ffi-example",
]
resolver = "2"

Expand Down
10 changes: 10 additions & 0 deletions examples/ffi-example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb
db.sqlite
db.sqlite-shm
db.sqlite-wal
.tool-versions

/target
/build
/node_modules
Loading
Loading