Skip to content

Commit

Permalink
test(subxt-tests): integration test for substrate using subxt
Browse files Browse the repository at this point in the history
Signed-off-by: Raymond Yeh <extraymond@gmail.com>
  • Loading branch information
extraymond committed May 31, 2023
1 parent c9b6a73 commit 2b6b2af
Show file tree
Hide file tree
Showing 29 changed files with 5,713 additions and 1 deletion.
39 changes: 38 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
pull_request:
workflow_dispatch:

# FIXME: currently needed to bypass a transient dependency using nightly feature
env:
RUSTC_BOOTSTRAP: 1

jobs:
repolinter:
name: Repolinter
Expand Down Expand Up @@ -80,7 +84,8 @@ jobs:
- uses: actions/upload-artifact@v3.1.0
with:
name: solang-linux-x86-64
path: ./target/debug/solang
path: ./target/debug/solang


linux-arm:
name: Linux Arm
Expand Down Expand Up @@ -337,6 +342,38 @@ jobs:
if: always()
run: docker kill ${{steps.substrate.outputs.id}}

substrate-subxt:
name: Substrate Integration test with subxt
runs-on: ubuntu-20.04
needs: linux-x86-64
steps:
- name: Checkout sources
uses: actions/checkout@v2
# We can't run substrate as a github actions service, since it requires
# command line arguments. See https://github.com/actions/runner/pull/1152
- name: Start substrate
run: docker run -d -p 9944:9944 paritytech/contracts-ci-linux:production substrate-contracts-node --dev --ws-external
- uses: actions/download-artifact@master
with:
name: solang-linux-x86-64
path: bin
- run: |
chmod 755 ./bin/solang
echo "$(pwd)/bin" >> $GITHUB_PATH
- name: Install latest rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
default: true
override: true
- run: solang compile --target substrate ../substrate/*.sol -o ./contracts/
working-directory: ./integration/subxt-tests
- run: solang compile --target substrate ../substrate/test/*.sol -o ./contracts/
working-directory: ./integration/subxt-tests
- name: Deploy and test contracts
run: cargo test -- --test-threads=1
working-directory: ./integration/subxt-tests

vscode:
name: Visual Code Extension
runs-on: solang-ubuntu-latest
Expand Down
12 changes: 12 additions & 0 deletions integration/substrate/createpair.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
pragma solidity ^0.8.0;
import "./UniswapV2Pair.sol";

contract Creator {
address public pair;

constructor() public {
pair = address(new UniswapV2Pair());
}

}

2 changes: 2 additions & 0 deletions integration/subxt-tests/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
contracts/
target/
32 changes: 32 additions & 0 deletions integration/subxt-tests/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[package]
edition = "2021"
name = "subxt-tests"
version = "0.1.0"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
anyhow = "1.0.62"
async-trait = "0.1.57"
contract-metadata = "2.0.0-alpha.2"
contract-transcode = "2.0.0-alpha.2"
hex = "0.4.3"
ink_metadata = "4.0.0-alpha.1"
jsonschema = "0.16.0"
num-bigint = "0.4.3"
once_cell = "1.14.0"
pallet-contracts-primitives = {git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.27"}
parity-scale-codec = "3.1.5"
rand = "0.8.5"
serde_json = "1.0.85"
sp-core = "6.0.0"
sp-keyring = "6.0.0"
subxt = "0.23.0"
tokio = {version = "1.20.1", features = ["rt-multi-thread", "macros", "time"]}

[workspace]
members = []

[patch.crates-io]
ink_metadata = {git = "https://github.com/paritytech/ink.git"}

Loading

0 comments on commit 2b6b2af

Please sign in to comment.