-
Notifications
You must be signed in to change notification settings - Fork 242
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WORKFLOW] Subgraph deploy matrix (#2003)
- Loading branch information
1 parent
349f760
commit c887de9
Showing
6 changed files
with
121 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ on: | |
inputs: | ||
vendor: | ||
required: true | ||
description: "Where to deploy subgraph to; superfluid, goldsky, graph or airstack" | ||
description: "Where to deploy subgraph to; superfluid, goldsky, or graph" | ||
type: string | ||
deployment_env: | ||
required: true | ||
|
@@ -24,7 +24,7 @@ on: | |
description: "Satsuma deploy key" | ||
required: false | ||
THE_GRAPH_ACCESS_TOKEN: | ||
description: "The Graph (hosted service) access token for deploying subgraphs" | ||
description: "The Graph access token for deploying subgraphs" | ||
required: false | ||
GOLDSKY_API_KEY: | ||
description: "Goldsky API key for deploying subgraphs" | ||
|
@@ -55,12 +55,38 @@ jobs: | |
echo github.head_ref: "$HEAD_REF" | ||
echo github.base_ref: ${{ github.base_ref }} | ||
determine-networks: | ||
name: Determine Networks | ||
runs-on: ubuntu-latest | ||
outputs: | ||
networks: ${{ steps.determine.outputs.networks }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: "Determine vendors for the network" | ||
id: determine | ||
run: | | ||
networks=$(jq -r --arg vendor "${{ inputs.vendor }}" --arg network "${{ inputs.network }}" ' | ||
if $network == "all" then | ||
.[$vendor] | @json | ||
else | ||
[$network] | @json | ||
end' packages/subgraph/tasks/vendorNetworkMap.json) | ||
if [ -z "$networks" ] || [ "$networks" == "null" ]; then | ||
echo "Unsupported vendor or network: ${{ inputs.vendor }} / ${{ inputs.network }}" | ||
exit 1 | ||
fi | ||
echo "networks=$networks" >> "$GITHUB_OUTPUT" | ||
deploy-subgraph: | ||
name: Build and Deploy Subgraph | ||
|
||
runs-on: ubuntu-latest | ||
env: | ||
subgraph-working-directory: ./packages/subgraph | ||
needs: determine-networks | ||
strategy: | ||
matrix: | ||
network: ${{ fromJson(needs.determine-networks.outputs.networks) }} | ||
fail-fast: false | ||
|
||
defaults: | ||
run: | ||
|
@@ -69,7 +95,9 @@ jobs: | |
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: DeterminateSystems/nix-installer-action@v13 | ||
- uses: cachix/install-nix-action@v19 | ||
with: | ||
github_access_token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: "Install dependencies" | ||
run: yarn install --frozen-lockfile | ||
|
@@ -78,57 +106,20 @@ jobs: | |
run: yarn build | ||
working-directory: ./packages/ethereum-contracts | ||
|
||
- name: "Get ABI" | ||
run: node scripts/getAbi.js | ||
working-directory: ${{ env.subgraph-working-directory }} | ||
|
||
- name: "Prepare subgraph manifest" | ||
# This step is required for generating a preliminary subgraph.yaml | ||
# and addresses.ts file for the yarn codegen step below | ||
# using a mock.json networks file. | ||
run: ./tasks/prepare-manifest.sh mock | ||
working-directory: ${{ env.subgraph-working-directory }} | ||
|
||
- name: "Generate meta.ignore.ts file" | ||
# Collects metadata like the git branch and commit hash | ||
run: "yarn generate-sf-meta" | ||
working-directory: ${{ env.subgraph-working-directory }} | ||
env: | ||
COMMIT_HASH: ${{ github.sha }} | ||
CONFIGURATION: ${{ inputs.deployment_env }} | ||
|
||
- name: "Generate AssemblyScript types" | ||
run: "yarn codegen" | ||
working-directory: ${{ env.subgraph-working-directory }} | ||
|
||
- name: Get Hosted Service Networks from metadata | ||
run: npx ts-node ./scripts/getHostedServiceNetworks.ts | ||
working-directory: ${{ env.subgraph-working-directory }} | ||
|
||
# - name: Ensure deployment_env property is passed | ||
# run: | | ||
# if [ "${{ inputs.deployment_env }}" == "" ];then | ||
# echo "You must pass in the deployment_env at a minimum." | ||
# exit 1 | ||
# fi | ||
|
||
# If tagged, get subgraph tag name that starts with subgraph@. Outputs $GIT_TAG_NAME | ||
- uses: olegtarasov/[email protected] | ||
id: "getSubgraphTag" | ||
with: | ||
tagRegex: "subgraph@(.*)" | ||
|
||
# Version is the git tag or revision | ||
# Version is from subgraph@<version> git tag if exists, else short git commit revision | ||
- name: "Deploy to a node" | ||
run: | | ||
shortRev=$(git rev-parse --short ${{ github.sha }}) | ||
versionLabel="${GIT_TAG_NAME:-$shortRev}" | ||
./tasks/deploy.sh -o ${{ inputs.vendor }} -n ${{ inputs.network }} -r ${{ inputs.deployment_env }} -v $versionLabel | ||
working-directory: ${{ env.subgraph-working-directory }} | ||
versionTag=$(git tag --contains ${{ github.sha }} | grep "^subgraph@" | sed 's/^subgraph@//') | ||
versionLabel="${versionTag:-$shortRev}" | ||
./tasks/deploy.sh -o ${{ inputs.vendor }} -n ${{ matrix.network }} -r ${{ inputs.deployment_env }} -v $versionLabel | ||
working-directory: ./packages/subgraph | ||
env: | ||
SUBGRAPH_URL_TEMPLATE: ${{ secrets.SUBGRAPH_URL_TEMPLATE }} | ||
SUPERFLUID_IPFS_API: ${{ secrets.SUPERFLUID_IPFS_API }} | ||
THE_GRAPH_ACCESS_TOKEN: ${{ secrets.THE_GRAPH_ACCESS_TOKEN }} | ||
SATSUMA_DEPLOY_KEY: ${{ secrets.SATSUMA_DEPLOY_KEY }} | ||
GOLDSKY_API_KEY: ${{ secrets.GOLDSKY_API_KEY }} | ||
AIRSTACK_API_KEY: ${{ secrets.AIRSTACK_API_KEY }} | ||
COMMIT_HASH: ${{ github.sha }} | ||
CONFIGURATION: ${{ inputs.deployment_env }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"superfluid": ["polygon-mainnet", "xdai-mainnet", "base-mainnet", "optimism-mainnet", "arbitrum-one", "celo-mainnet", "bsc-mainnet", "avalanche-c", "optimism-sepolia", "scroll-sepolia", "scroll-mainnet", "degenchain", "base-sepolia"], | ||
"goldsky": ["polygon-mainnet", "xdai-mainnet", "eth-mainnet", "base-mainnet", "optimism-mainnet", "arbitrum-one", "bsc-mainnet", "avalanche-c", "optimism-sepolia", "scroll-sepolia", "scroll-mainnet", "eth-sepolia", "avalanche-fuji", "base-sepolia", "degenchain"], | ||
"graph": ["polygon-mainnet", "eth-mainnet", "celo-mainnet"] | ||
} | ||
|