fix(examples): adjust breaking changes and detect failures in ci (#1040)
* dbg message * update ci * fix: examples * ci: add examples build step and set chmod +x examples.sh * echo filename * fix: path to examples
This commit is contained in:
parent
db331eeeb3
commit
5d14198fbe
|
@ -214,9 +214,18 @@ jobs:
|
|||
- uses: Swatinem/rust-cache@v1
|
||||
with:
|
||||
cache-on-failure: true
|
||||
- name: Build all examples
|
||||
run: |
|
||||
export PATH=$HOME/bin:$PATH
|
||||
for file in examples/*.rs; do
|
||||
name="$(echo "$file" | cut -f 1 -d '.')"
|
||||
echo "building $name"
|
||||
cargo build -p ethers --example "$(basename "$name")"
|
||||
done
|
||||
- name: Run all examples
|
||||
run: |
|
||||
export PATH=$HOME/bin:$PATH
|
||||
chmod +x ./scripts/examples.sh
|
||||
./scripts/examples.sh
|
||||
|
||||
windows-build:
|
||||
|
|
|
@ -31,7 +31,7 @@ async fn main() -> Result<()> {
|
|||
// compile the project and get the artifacts
|
||||
let output = project.compile().unwrap();
|
||||
let contract = output.find("SimpleStorage").expect("could not find contract").clone();
|
||||
let (abi, bytecode, _) = contract.into_parts_or_default();
|
||||
let (abi, bytecode, _) = contract.into_parts();
|
||||
|
||||
// 2. instantiate our wallet & ganache
|
||||
let ganache = Ganache::new().spawn();
|
||||
|
@ -46,7 +46,7 @@ async fn main() -> Result<()> {
|
|||
let client = Arc::new(client);
|
||||
|
||||
// 5. create a factory which will be used to deploy instances of the contract
|
||||
let factory = ContractFactory::new(abi, bytecode, client.clone());
|
||||
let factory = ContractFactory::new(abi.unwrap(), bytecode.unwrap(), client.clone());
|
||||
|
||||
// 6. deploy it with the constructor arguments
|
||||
let contract = factory.deploy("initial value".to_string())?.legacy().send().await?;
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
use ethers::prelude::*;
|
||||
use eyre::Result;
|
||||
use std::{convert::TryFrom, path::Path, sync::Arc, time::Duration};
|
||||
|
||||
abigen!(
|
||||
SimpleContract,
|
||||
|
@ -8,8 +6,6 @@ abigen!(
|
|||
event_derives(serde::Deserialize, serde::Serialize)
|
||||
);
|
||||
|
||||
const MOONBEAM_DEV_ENDPOINT: &str = "http://localhost:9933";
|
||||
|
||||
/// This requires a running moonbeam dev instance on `localhost:9933`
|
||||
/// See `https://docs.moonbeam.network/builders/get-started/moonbeam-dev/` for reference
|
||||
///
|
||||
|
@ -22,7 +18,10 @@ const MOONBEAM_DEV_ENDPOINT: &str = "http://localhost:9933";
|
|||
/// Also requires the `legacy` feature to send Legacy transaction instead of an EIP-1559
|
||||
#[tokio::main]
|
||||
#[cfg(feature = "legacy")]
|
||||
async fn main() -> Result<()> {
|
||||
async fn main() -> eyre::Result<()> {
|
||||
use std::{convert::TryFrom, path::Path, sync::Arc, time::Duration};
|
||||
const MOONBEAM_DEV_ENDPOINT: &str = "http://localhost:9933";
|
||||
|
||||
// set the path to the contract, `CARGO_MANIFEST_DIR` points to the directory containing the
|
||||
// manifest of `ethers`. which will be `../` relative to this file
|
||||
let source = Path::new(&env!("CARGO_MANIFEST_DIR")).join("examples/contract.sol");
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
set -e
|
||||
# shellcheck shell=bash
|
||||
# run all examples
|
||||
for file in examples/*.rs; do
|
||||
|
|
Loading…
Reference in New Issue