From b8c63a7aad3ea4bc525fb28890fe7a91b5a8bb0f Mon Sep 17 00:00:00 2001 From: NanezX Date: Sun, 3 Dec 2023 03:03:04 -0400 Subject: [PATCH] updated ci workflow --- .github/workflows/subgraph.yaml | 45 ++++++++++++++++++++++++++++++++- subgraph/tests/entities.rs | 12 +++++++++ 2 files changed, 56 insertions(+), 1 deletion(-) diff --git a/.github/workflows/subgraph.yaml b/.github/workflows/subgraph.yaml index c238404ff..64e3385c5 100644 --- a/.github/workflows/subgraph.yaml +++ b/.github/workflows/subgraph.yaml @@ -25,6 +25,49 @@ jobs: working-directory: ./subgraph run: npm install - - name: Initialize and build setup + - name: Initialize setup working-directory: ./subgraph run: nix run .#init-setup + + - name: Build subgraph + working-directory: ./subgraph + run: nix run .#build + + subgraph-test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Install Nix + uses: DeterminateSystems/nix-installer-action@v4 + + - uses: DeterminateSystems/magic-nix-cache-action@v2 + + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 + with: + version: nightly + + - name: Start docker container + working-directory: ./subgraph + run: nix run .#docker-up + + - name: Forge shallow install + run: forge install --shallow + + - name: install npm dependencies + working-directory: ./subgraph + run: npm install + + - name: Initialize setup + working-directory: ./subgraph + run: nix run .#init-setup + + - name: Run tests + working-directory: ./subgraph + run: nix run .#ci-test + + - name: Stop docker container + working-directory: ./subgraph + run: nix run .#docker-down diff --git a/subgraph/tests/entities.rs b/subgraph/tests/entities.rs index 243114007..e309c36d1 100644 --- a/subgraph/tests/entities.rs +++ b/subgraph/tests/entities.rs @@ -1,2 +1,14 @@ mod generated; mod utils; + +use utils::deploy::get_orderbook; + +#[tokio::main] +#[test] +async fn test_orderbook_entity() -> anyhow::Result<()> { + let orderbook = get_orderbook().await?; + + println!("orderbook: {:?}", orderbook.address()); + + Ok(()) +}