diff --git a/.github/workflows/rust_test.yml b/.github/workflows/rust_test.yml index 38ae132d..49313070 100644 --- a/.github/workflows/rust_test.yml +++ b/.github/workflows/rust_test.yml @@ -24,17 +24,20 @@ jobs: submodules: recursive token: ${{ secrets.GITHUB_TOKEN }} + # NOTE: This is needed to ensure that hyperdrive-wrappers builds correctly. + - name: install foundry + uses: foundry-rs/foundry-toolchain@v1 + with: + version: nightly + - name: check out hyperdrive uses: actions/checkout@v3 with: repository: delvtech/hyperdrive path: "./hyperdrive" - # NOTE: This is needed to ensure that hyperdrive-wrappers builds correctly. - - name: install foundry - uses: foundry-rs/foundry-toolchain@v1 - with: - version: nightly + - name: build hyperdrive + run: cd hyperdrive && make build-sol - uses: actions-rs/toolchain@v1 with: diff --git a/crates/hyperdrive-wrappers/build.rs b/crates/hyperdrive-wrappers/build.rs index 06561a57..865257a0 100644 --- a/crates/hyperdrive-wrappers/build.rs +++ b/crates/hyperdrive-wrappers/build.rs @@ -1,7 +1,7 @@ -use std::{io::Write, path::Path, process::Command}; +use std::{fs, io::Write, path::Path, process::Command}; use ethers::prelude::Abigen; -use eyre::Result; +use eyre::{eyre, Result}; use heck::ToSnakeCase; const TARGETS: &[&str] = &[ @@ -58,6 +58,34 @@ const TARGETS: &[&str] = &[ fn get_artifacts(artifacts_path: &Path) -> Result> { let mut artifacts = Vec::new(); + println!("artifacts_path {:#?}", artifacts_path); + if !artifacts_path.exists() { + println!("----"); + let paths = fs::read_dir("/home/runner/work/hyperdrive-rs/hyperdrive-rs").unwrap(); + for path in paths { + println!("hyperdrive-rs/ name: {}", path.unwrap().path().display()) + } + + println!("----"); + let parent = artifacts_path.join("/.."); + println!("parent {:#?}", parent); + let paths = fs::read_dir(parent).unwrap(); + for path in paths { + println!("parent/ name: {}", path.unwrap().path().display()) + } + + println!("----"); + let parent_parent = artifacts_path.join("/..").join("/.."); + println!("parent_parent {:#?}", parent_parent); + let paths = fs::read_dir(parent_parent).unwrap(); + for path in paths { + println!("parent_parent/ name: {}", path.unwrap().path().display()) + } + return Err(eyre!( + "artifacts_path={:#?} does not exist!", + artifacts_path + )); + } for entry in std::fs::read_dir(artifacts_path)? { let entry = entry?; let path = entry.path(); @@ -88,6 +116,7 @@ fn main() -> Result<()> { // re-write these files. let root = Path::new(std::env!("CARGO_MANIFEST_DIR")); let generated = root.join("src/wrappers"); + println!("generated {:#?}", generated); if generated.exists() { std::fs::remove_dir_all(&generated)?; } @@ -97,9 +126,11 @@ fn main() -> Result<()> { .create(true) .write(true) .open(mod_file)?; + println!("mod_file {:#?}", mod_file); // Generate the relevant contract wrappers from Foundry's artifacts. let artifacts = root.join("../../hyperdrive/out"); + println!("artifacts {:#?}", artifacts); let mut artifacts = get_artifacts(&artifacts)?; artifacts.sort_by(|a, b| a.1.cmp(&b.1)); artifacts.dedup_by(|a, b| a.1.eq(&b.1));