-
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.
Merge branch 'dev' into feature-trusted-macros-eip712
- Loading branch information
Showing
387 changed files
with
28,141 additions
and
17,753 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
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,52 @@ | ||
name: Setup Workflow Base | ||
description: > | ||
This sets up the base for a workflow, where: | ||
- nix is installed, | ||
- cache is looked up, | ||
- and nix dev shell is setup if cache is missed. | ||
inputs: | ||
package-name: | ||
description: Name of the package where input files are from | ||
required: true | ||
cache-key-prefix: | ||
description: Cache key prefix to attach to the calculated input files hash | ||
required: true | ||
dev-shell-name: | ||
description: Default shell to be used | ||
|
||
outputs: | ||
cache-hit: | ||
value: ${{ steps.cache.outputs.cache-hit }} | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- uses: DeterminateSystems/nix-installer-action@v13 | ||
|
||
- name: Load the half-board nix module | ||
id: hb | ||
run: | | ||
./tasks/mk-cache-key.sh ./packages/${{ inputs.package-name }} > cache.json | ||
jq . cache.json | ||
key_prefix="${{ inputs.cache-key-prefix }}" | ||
path=$(jq '.outputs | join("\n")' cache.json) | ||
hash=$(jq -r .hash cache.json) | ||
echo "path=$path" >> "$GITHUB_OUTPUT" | ||
echo "key=${key_prefix}${hash}" >> "$GITHUB_OUTPUT" | ||
shell: nix develop .#mk-cache-key -c bash -xe {0} | ||
|
||
- name: Lookup cache | ||
id: cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: ${{ fromJSON(steps.hb.outputs.path) }} | ||
key: ${{ steps.hb.outputs.key }} | ||
|
||
- name: Initialize nix dev shell | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
run: | | ||
node --version | ||
yarn --version | ||
shell: nix develop .#${{ inputs.dev-shell-name }} -c bash -xe {0} |
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 |
---|---|---|
|
@@ -5,29 +5,35 @@ on: | |
inputs: | ||
vendor: | ||
required: true | ||
description: "Where to deploy subgraph to; superfluid, graph, or satsuma" | ||
description: "Where to deploy subgraph to; superfluid, goldsky, or graph" | ||
type: string | ||
deployment_env: | ||
required: true | ||
type: string | ||
description: 'The subgraph deployment env: v1, dev, feature' | ||
description: "The subgraph deployment env: v1, dev, feature" | ||
network: | ||
required: true | ||
type: string | ||
description: 'The network you want to deploy to (matic, xdai, eth-mainnet, etc.) or `all` for all networks.' | ||
description: "The network you want to deploy to (matic, xdai, eth-mainnet, etc.) or `all` for all networks." | ||
|
||
secrets: | ||
SUBGRAPH_URL_TEMPLATE: | ||
description: 'Subgraph endpoint url template' | ||
description: "Subgraph endpoint url template" | ||
required: false | ||
SATSUMA_DEPLOY_KEY: | ||
description: 'Satsuma deploy key' | ||
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" | ||
required: false | ||
AIRSTACK_API_KEY: | ||
description: "Airstack API key for deploying subgraphs" | ||
required: false | ||
SUPERFLUID_IPFS_API: | ||
description: 'Superfluid IPFS API endpoint' | ||
description: "Superfluid IPFS API endpoint" | ||
required: false | ||
|
||
jobs: | ||
|
@@ -49,19 +55,45 @@ 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: | ||
shell: nix develop -c bash {0} | ||
shell: nix develop .#ci-default -c bash {0} | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: cachix/install-nix-action@v19 | ||
with: | ||
|
@@ -74,55 +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
Oops, something went wrong.