Skip to content

Commit

Permalink
[SUBGRAPH+SDK-CORE/CI] Build SDK-Core with locally deployed subgraph (#…
Browse files Browse the repository at this point in the history
…1222)

* running ci.feature with dev

- currently the subgraph's dev endpoint has new entities which are not mapped in SDK-core
- `yarn build` should fail when attempting to build sdk-core given `yarn generate-graphql-schema:${{ inputs.subgraph-release }}`

* trigger build

* actual trigger

* tests local schema

* remove redundant space

* fix regex

* test catch call

* previous commit was a test

* comment cleanup
  • Loading branch information
0xdavinchee authored Dec 9, 2022
1 parent e0aead8 commit 59b68fb
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 16 deletions.
26 changes: 18 additions & 8 deletions .github/workflows/call.setup-deploy-and-test-local-subgraph.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ jobs:

env:
subgraph-working-directory: ./packages/subgraph
sdk-core-working-directory: ./packages/sdk-core

steps:
- uses: actions/checkout@v3
Expand All @@ -62,30 +63,30 @@ jobs:
- name: "Start hardhat node"
run: |
./tasks/startHardhatNode.sh start
working-directory: ./packages/sdk-core
working-directory: ${{ env.sdk-core-working-directory }}

- name: "Build SDK-Core"
# build sdk-core because of auto linking to dependency
run: yarn build
working-directory: ./packages/sdk-core
working-directory: ${{ env.sdk-core-working-directory }}

- name: "Deploy Framework and Tokens"
run: npx hardhat run scripts/runDeployContractsAndToken.ts --network localhost
working-directory: ./packages/subgraph
working-directory: ${{ env.subgraph-working-directory }}

- name: "Prepare files for local testing"
run: yarn prepare-local
working-directory: ./packages/subgraph
working-directory: ${{ env.subgraph-working-directory }}

- name: "Run setup-graph-node"
run: |
chmod +x ./tasks/setup-graph-node.sh
./tasks/setup-graph-node.sh
working-directory: ./packages/subgraph
working-directory: ${{ env.subgraph-working-directory }}

- name: "Docker compose"
run: docker-compose up &
working-directory: ./packages/subgraph
working-directory: ${{ env.subgraph-working-directory }}

- name: "Run subgraph integration test suite"
if: inputs.run-sdk-core-tests == false
Expand All @@ -105,6 +106,15 @@ jobs:
yarn generate-graphql-schema:${{ inputs.subgraph-release }}
yarn generate
npx hardhat test --network localhost
working-directory: ./packages/sdk-core
working-directory: ${{ env.sdk-core-working-directory }}
env:
SUBGRAPH_RELEASE_TAG: ${{ inputs.subgraph-release }}
SUBGRAPH_RELEASE_TAG: ${{ inputs.subgraph-release }}

# test local subgraph schema against sdk-core schema representation
# this will break if there is an inconsistency between the subgraph schema
# and the sdk-core schema (if not all events are mapped)
- name: "Test new local subgraph schema against existing SDK-Core build"
run: |
npx get-graphql-schema http://localhost:8000/subgraphs/name/superfluid-test > src/subgraph/schema.graphql
yarn build
working-directory: ${{ env.sdk-core-working-directory }}
1 change: 1 addition & 0 deletions .github/workflows/call.test-sdk-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jobs:
- name: "Run test suite"
run: |
yarn generate-graphql-schema:${{ inputs.subgraph-release }}
yarn build
yarn test
working-directory: ./packages/sdk-core
env:
Expand Down
20 changes: 12 additions & 8 deletions tasks/check-changeset.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,38 +28,42 @@ function setBuildAll() {
# set BUILD_* variables to GITHUB_ENV
# (dependency graph implied below)
if ! [ -z "$GITHUB_ENV" ];then
# if ci workflow changed
if grep -E "^.github/workflows/ci.yml$" changed-files.list;then
# if ci workflows changed
if grep -E "^.github/workflows/ci.*.yml$" changed-files.list;then
setBuildAll
fi
# if root package changed, rebuild everything
# if call (reusable) workflows changed
if grep -E "^.github/workflows/call.*.yml$" changed-files.list;then
setBuildAll
fi
# if root package.json changed, rebuild everything
if grep -E "^package.json$" changed-files.list;then
setBuildAll
fi
# if ethereum-contracts package changed
# if specified ethereum-contracts folders and files changed
if grep -E "^packages/ethereum-contracts/(contracts/|scripts/|test/|truffle-config.js|package.json)" changed-files.list;then
BUILD_ETHEREUM_CONTRACTS=1
BUILD_SUBGRAPH=1
echo Ethereum contracts and Subgraph will be tested.
fi
# if sdk-core package changed
# if specified sdk-core folders and files changed
if grep -E "^packages/sdk-core/(src/|test/|package.json|tsconfig.*)" changed-files.list;then
BUILD_SDK_CORE=1
BUILD_SDK_REDUX=1
BUILD_SUBGRAPH=1
echo SDK-CORE, SDK-REDUX and SUBGRAPH will be tested.
fi
# if sdk-redux package changed
# if specified sdk-redux folders and files changed
if grep -E "^packages/sdk-redux/(src/|test/|package.json)" changed-files.list;then
BUILD_SDK_REDUX=1
echo SDK-REDUX will be tested.
fi
# if subgraph package changed
# if specified subgraph folders and files changed
if grep -E "^packages/subgraph/(subgraph.template.yaml|schema.graphql|config|scripts|src|tasks|test|hardhat.config.ts|package.json|docker-compose.yml)" changed-files.list;then
BUILD_SUBGRAPH=1
echo Subgraph will be tested.
fi
# if haskell spec package changed
# if specified haskell folders and files changed
if grep -E "^packages/spec-haskell/(packages/|cabal.project)" changed-files.list;then
BUILD_SPEC_HASKELL=1
echo SPEC-HASKELL will be tested.
Expand Down

0 comments on commit 59b68fb

Please sign in to comment.