Skip to content

Commit

Permalink
Merge branch '2023-11-01-generate-schema-json' into 2023-11-02-wip-ci-sg
Browse files Browse the repository at this point in the history
  • Loading branch information
NanezX committed Nov 3, 2023
2 parents e7c2d39 + 54d447d commit 908db3d
Show file tree
Hide file tree
Showing 4 changed files with 40,208 additions and 12 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/subgraph-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ jobs:
working-directory: ./subgraph
run: npm install

- name: Obtain schema.json from subgraph
working-directory: ./subgraph
run: nix run .#gen-subgraph-schema

- name: Run test
working-directory: ./subgraph
run: nix run .#ci-test
Expand Down
2 changes: 0 additions & 2 deletions subgraph/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
/subgraph.yaml
/abis/*.json

// Subgraph Schema.json generated
tests/subgraph/query/schema.json

# Rust generated files
/tests/generated/abigen
Expand Down
22 changes: 16 additions & 6 deletions subgraph/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@
echo Removed duplicated at: $contract_path
'';

# The graphql file can generate the schema.json file needed for testing
# Of course, this need a graph node at localhost to work

gen-sg-schema = ''
# Use a arbitrary address to put the endpoint up
cargo run deploy \
Expand Down Expand Up @@ -82,12 +81,23 @@
kill -9 $(lsof -t -i :8545)
'');

gen-subgraph-schema = pkgs.writeShellScriptBin "gen-subgraph-schema" (gen-sg-schema);
# The graphql file can generate the schema.json file needed for testing
# Of course, this need a graph node at localhost to work
gen-subgraph-schema = pkgs.writeShellScriptBin "gen-subgraph-schema" (''
# Use a arbitrary address to put the endpoint up
cargo run deploy \
--name test/test \
--url http://localhost:8020 \
--network localhost \
--block 0 \
--address 0x0000000000000000000000000000000000000000
${graphql_client} introspect-schema \
--output tests/subgraph/query/schema.json \
http://localhost:8000/subgraphs/name/test/test
'');

ci-test = pkgs.writeShellScriptBin "ci-test" (''
# # This build is for generate the schema.json.
# # This in case the subgraph schema.graphql have changes when running tests
# ${gen-sg-schema}
# Run tests in single thread
cargo test -- --test-threads=1 --nocapture;
Expand Down
Loading

0 comments on commit 908db3d

Please sign in to comment.