-
Notifications
You must be signed in to change notification settings - Fork 238
Superfluid GitHub Actions Deep Dive
- Currently we use lerna to manage the monorepo packages.
Even for projects that are not npm projects, a package.json is still provided in order to:
- Be part of the lerna workspace.
- Support repo-wide standard build pipeline tasks, often used via
yarn workspace
oryarn workspaces
:
yarn workspace @superfluid-finance/$i build
yarn workspace @superfluid-finance/$i clean
yarn workspaces run lint
yarn workspaces run pre-commit
- "tasks" folders are for build pipeline. 4 "scripts" are scripts to be used by local development or for distribution.
Note: targets for supply chain security examination:
- prepare
- postinstall
- Using ':' to separate npm sub scripts, use
run-s|run-p
to in series or in parallel.- use
run-s
to enforce pipeline sequence. - use
run-p
if parallel is desired.
- use
- Common npm scripts as standard "verbs":
- to be used in CI pipeline:
- install
- lint
- build
- test
- clean
- to be used in local development:
- git-submodule:*, git submodule workflows
- check-updates
- pre-commit # husky pre-commit hook (.husky/pre-commit)
- shell # nix shell
- for monorepo workflow:
- manage-versions
- to be used in CI pipeline:
- Required workspace package common "verbs":
- pre-commit
- lint
- build
- test
- clean
- check-updates
- cloc
- Common Workflow Patterns:
- Use nix shell to deterministically setup CI environment.
- "Small and lean": use as much common verbs as possible.
- Complex scripts to put into tasks/ of the workspace package.
The GitHub Actions in our monorepo leverage automations to enable:
- actions to run tests to ensure a baseline level of security
- actions to run tests to minimize unexpected behavior
- actions to automate tasks we might forget
- verifiability (deployments, governance actions, etc.)
Some principles we strive to follow:
- DRY (Don't Repeat Yourself)
- Don't trust, verify
- Speed
- Internal developer experience
call.*.yml
files are the reusable workflows we use throughout our workflow files. The purpose of this is to reduce duplication of jobs that may need to be run in different workflow files and steps. This improves maintainability and generally reduces complexity when making changes/reading code.
CI = Continuous Integration
ci.*.yml
files are continuous integration workflows we use to run tests at different stages to ensure regression does not occur and that obvious breaking changes are not pushed to prod.
CD = Continuous Deployment
cd.*.yml
files are continuous deployment workflows we use to handle a lot of tasks surrounding deployments. Using GitHub Actions to deploy contracts allows anyone to verify that a specific contract deployment is tied to a specific commit.
handler.*.yml
files are intermediary files used manually to execute multi-step operations OR to execute multi-step operations upon completion of another workflow.
daily-*.yml
files are used to run daily checks or to create daily messages.
I would recommend that you just read the one liner description of each of the files just to have an idea of the purpose of each file. If you are making changes to the file, then it makes a bit more sense to read further: e.g. where the file is used and the satellite files (files surrounding the specified workflow file which might need special attention/modification).
A reusable workflow to check that the SDK-Core GraphQL schema is consistent with the deployed subgraph's schema.
Expand
ci.canary
ci.feature
daily-query-check
packages/sdk-core/tasks/package.json
packages/sdk-core/tasks/startHardhatNode.sh
packages/sdk-core/tasks/setupTestEnvironment.sh
packages/sdk-core/tasks/testSchemasAndQueries.sh
packages/sdk-core/previous-versions-testing/runQueryTests.ts
A reusable workflow to deploy the subgraph.
Expand
ci.canary
handler.deploy-subgraph
SATSUMA_DEPLOY_KEY
THE_GRAPH_ACCESS_TOKEN
packages/subgraph/package.json
packages/subgraph/scripts/getAbi.js
packages/subgraph/subgraph.template.yaml
packages/subgraph/tasks/getSFMeta.sh
packages/subgraph/tasks/deploy.sh
packages/subgraph/tasks/deploy-all-networks.sh
packages/subgraph/tasks/deploy-to-network.sh
packages/subgraph/tasks/deploy-to-satsuma.sh
A reusable workflow to run unit and integration tests on the subgraph, it also tests the new subgraph schema against the local
Expand
ci.canary
ci.feature
ci.pre-release-subgraph
packages/ethereum-contracts/dev-scripts/runDeployContractsAndToken.js
packages/sdk-core/tasks/startHardhatNode.sh
-
packages/subgraph/src/*
: mapping files packages/subgraph/test/*
packages/subgraph/tests/*
packages/subgraph/tasks/setup-graph-node.sh
packages/subgraph/tasks/testenv-ctl.sh
packages/subgraph/docker-compose.yml
packages/subgraph/scripts/getAbi.js
packages/subgraph/subgraph.template.yaml
packages/subgraph/src/addresses.template.ts
A reusable workflow that builds and tests the automation contracts.
Expand
ci.feature
ci.canary
packages/automation-contracts/autowrap/*
packages/automation-contracts/scheduler/*
A reusable workflow that builds and tests SDK-Core.
Expand
ci.feature
ci.pre-release-sdk-core
packages/sdk-core/tasks/testenv-ctl.sh
packages/sdk-core/tasks/startHardhatNode.sh
packages/sdk-core/tasks/setupTestEnvironment.sh
packages/ethereum-contracts/dev-scripts/runDeployContractsAndToken.js
A reusable workflow that builds and tests the Haskell spec.
A reusable workflow that tests the deployed subgraph against previous SDK-Core versions.
A continuous deployment workflow that creates a release draft to be filled out and published for ethereum contracts.
A continuous deployment workflow that creates a PR artifact when a pull request is opened.
A continuous deployment workflow that creates a release draft to be filled out and published for sdk-core.
A continuous deployment workflow that creates a release draft to be filled out and published for sdk-redux.
A continuous deployment workflow that creates a release draft to be filled out and published for the subgraph.
A continuous integration workflow that builds, tests and publishes coverage reports for all packages in the monorepo upon a PR being merged to dev. It also publishes a dev build for ethereum-contracts
, sdk-core
and sdk-redux
and deploys the subgraph if there were changes made to subgraph files.
Expand
-
tasks/check-changeset.sh
: Only used for determining if we need to deploy the subgraph ./.github/workflows/call.setup-deploy-and-test-local-subgraph.yml@dev
./.github/workflows/call.test-subgraph-on-previous-sdk-core-versions.yml
./.github/workflows/call.check-query-schema-against-subgraph.yml
./.github/workflows/call.deploy-subgraph.yml
./.github/workflows/call.test-spec-haskell.yml
A continuous integration workflow that builds, tests and publishes coverage reports for all packages in the monorepo upon a PR being opened. It uses tasks/check-changeset.sh
to check what files were changed compared to dev
branch and will run specific jobs based on the output of the check
job.
Expand
tasks/check-changeset.sh
NOTE: It is important that you modify this file if you are adding a new package to the monorepo if you plan on adding tests for it to
ci.feature.yml
.
./.github/workflows/call.setup-deploy-and-test-local-subgraph.yml
./.github/workflows/call.test-sdk-core.yml
./.github/workflows/call.test-subgraph-on-previous-sdk-core-versions.yml
./.github/workflows/call.check-query-schema-against-subgraph.yml
./.github/workflows/call.test-spec-haskell.yml
A continuous integration workflow that builds, tests and publishes coverage reports for all packages in the monorepo. It also publishes a dev build for ethereum-contracts
, sdk-core
and sdk-redux
.
Expand
./.github/workflows/call.check-query-schema-against-subgraph.yml
./.github/workflows/call.test-sdk-core.yml
A continuous integration workflow that runs a series of tests upon PRs to release-subgraph-v1
branch to ensure that a subgraph deployment to V1 will not break the subgraph, previous versions and the current version of the sdk-core.
Expand
./.github/workflows/call.setup-deploy-and-test-local-subgraph.yml
./.github/workflows/call.test-subgraph-on-previous-sdk-core-versions.yml
A cron job run daily to check that the sdk-core query GraphQL schema representation is synced with the deployed v1 and dev endpoint schema representations.
A cron job run daily to report open PRs and the status of the latest canary (dev) build.
A handler workflow which creates a reminder to update the changelogs whenever a PR is created.
A handler workflow used to deploy the subgraph manually using the deploy subgraph reusable workflow.
A handler workflow used to deploy Superfluid contracts to mainnet.
A handler workflow used to deploy Superfluid contracts to testnets.
Expand
packages/ethereum-contracts/ops-scripts/deploy-test-environment.js
packages/ethereum-contracts/ops-scripts/info-print-contract-addresses.js
packages/ethereum-contracts/tasks/etherscan-verify-framework.sh
A handler workflow used to list super tokens on our resolver.
A handler workflow that can be used for testing and reverted before merging.
A handler workflow which publishes PR builds to Github upon a PR successfully passing all checks and our continuous deployment workflow file creating a PR artifact.
A handler workflow which publishes release packages to NPM upon a release draft being published.
Expand
tasks/npm-publish.sh
packages/sdk-core/src/*
packages/sdk-core/tsconfig.json
packages/sdk-core/tsconfig.module.json
packages/sdk-core/typedoc.js
packages/sdk-redux/src/*
packages/sdk-redux/tsconfig.json
packages/sdk-redux/tsconfig.module.json
A handler workflow which can execute any arbitrary script in our ethereum-contracts/scripts
folder.
A handler workflow which uses docgen to generate docs for our solidity contracts and handles deployment to our documentation site.
A handler workflow which is called to verify contracts on etherscan.
Expand
packages/ethereum-contracts/ops-scripts/info-print-contract-addresses.js
packages/ethereum-contracts/tasks/etherscan-verify-framework.sh
A handler workflow which creates a comment upon a PR being merged to dev which gets the corresponding xkcd comic based on the merged PR number.
- Governance Overview
- For Contributors
- Development Process
- Protocol EVMv1 Operations
- Protocol EVMv1 Technical Notes
- Protocol EVMv1 Core Subgraph