Small build pipeline improvements (#2005) #808
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
name: CI | Canary (Dev) | |
on: | |
push: | |
branches: ["dev"] | |
paths: | |
- "package.json" | |
- "packages/**" | |
# - "**.md" commented-out because README updates should go to the packages | |
- ".github/workflows/ci.canary.yml" | |
- "codecov.yml" | |
- ".github/workflows/call.*.yml" | |
jobs: | |
check: | |
name: Checking what packages need to be built | |
runs-on: ubuntu-latest | |
outputs: | |
build_subgraph: ${{ env.BUILD_SUBGRAPH }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Create build set | |
run: tasks/create-build-set.sh ${{ github.sha }} dev origin | |
essential-build-and-test: | |
name: Build and test essential packages of dev branch | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18, 20] | |
defaults: | |
run: | |
shell: nix develop .#ci-node${{ matrix.node-version }} -c bash -xe {0} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: cachix/install-nix-action@v19 | |
with: | |
github_access_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Show contexts | |
env: | |
HEAD_REF: ${{ github.head_ref }} | |
GITHUB_REF: ${{ github.ref }} | |
run: | | |
echo github.event_name: ${{ github.event_name }} | |
echo github.sha: ${{ github.sha }} | |
echo github.repository: ${{ github.repository }} | |
echo github.ref: "$GITHUB_REF" | |
echo github.head_ref: "$HEAD_REF" | |
echo github.base_ref: ${{ github.base_ref }} | |
- name: Install, lint, build, and test | |
run: | | |
yarn install --frozen-lockfile | |
yarn lint | |
yarn build | |
yarn test | |
env: | |
POLYGON_MAINNET_PROVIDER_URL: ${{ secrets.POLYGON_MAINNET_PROVIDER_URL }} | |
SUBGRAPH_RELEASE_TAG: dev | |
FOUNDRY_PROFILE: ci | |
test-hot-fuzz: | |
uses: ./.github/workflows/call.test-hot-fuzz.yml | |
name: Hot Fuzz (Development Branch) | |
test-subgraph: | |
uses: ./.github/workflows/call.test-local-subgraph.yml | |
name: Build and Test Subgraph (Development Branch) | |
test-sdk-core: | |
uses: ./.github/workflows/call.test-sdk-core.yml | |
name: Build and Test SDK-Core (Development Branch) | |
with: | |
subgraph-release: local | |
subgraph-endpoint: http://localhost:8000/subgraphs/name/superfluid-test | |
run-coverage-tests: false | |
# deploy subgraph if changes are made, we can call this every time, but we won't actually do any deployments | |
# if the IPFS hash generated stays the same (no mapping logic changes) | |
deploy-subgraph-changes: | |
uses: ./.github/workflows/call.deploy-subgraph.yml | |
name: "Deploy Hosted Service Subgraph to dev endpoints on all networks" | |
needs: [check, test-subgraph] | |
if: needs.check.outputs.build_subgraph | |
with: | |
vendor: graph | |
deployment_env: dev | |
network: "all" | |
secrets: | |
THE_GRAPH_ACCESS_TOKEN: ${{ secrets.THE_GRAPH_ACCESS_TOKEN }} | |
test-solidity-semantic-money: | |
name: Build and Test Solidity Semantic Money (Canary Branch) | |
uses: ./.github/workflows/call.test-solidity-semantic-money.yml | |
test-spec-haskell: | |
uses: ./.github/workflows/call.test-spec-haskell.yml | |
name: Build and Test Spec Haskell (Canary Branch) | |
test-automation-contracts: | |
uses: ./.github/workflows/call.test-automation-contracts.yml | |
name: Build and Test Automation Contracts (Canary Branch) | |
coverage-ethereum-contracts: | |
name: Coverage test ethereum-contracts (Canary Branch) | |
uses: ./.github/workflows/call.test-ethereum-contracts.yml | |
with: | |
run-coverage-tests: true | |
coverage-sdk-core: | |
uses: ./.github/workflows/call.test-sdk-core.yml | |
name: Build and Test SDK-Core Coverage (Canary Branch) | |
with: | |
subgraph-release: local | |
subgraph-endpoint: http://localhost:8000/subgraphs/name/superfluid-test | |
run-coverage-tests: true | |
upload-coverage-reports: | |
name: Upload Coverage Reports (Feature Branch) | |
uses: ./.github/workflows/call.upload-coverage-reports.yml | |
needs: [coverage-ethereum-contracts, coverage-sdk-core] | |
secrets: | |
codecov_token: ${{ secrets.CODECOV_TOKEN }} | |
all-packages-tested: | |
name: All packages tested (Dev Branch) | |
runs-on: ubuntu-latest | |
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-not-requiring-successful-dependent-jobs | |
if: ${{ always() }} | |
needs: [ essential-build-and-test | |
, test-spec-haskell | |
, test-solidity-semantic-money | |
, test-hot-fuzz | |
, test-subgraph | |
, coverage-ethereum-contracts | |
, coverage-sdk-core | |
] | |
steps: | |
- name: Test Results | |
run: | | |
function check_result() { | |
local package_name="$1" | |
local result="$2" | |
if [ "$result" == "skipped" ];then | |
echo "Skipped $package_name package." | |
else | |
echo "Checking if $package_name package test passes..." | |
test "$result" == "success" | |
echo "Passed." | |
fi | |
} | |
check_result essential-build-and-test ${{ needs.essential-build-and-test.result }} | |
check_result spec-haskell ${{ needs.test-spec-haskell.result }} | |
check_result hot-fuzz ${{ needs.test-hot-fuzz.result }} | |
check_result subgraph ${{ needs.test-subgraph.result }} | |
check_result ethereum-contracts-coverage ${{ needs.coverage-ethereum-contracts.result }} | |
check_result sdk-core-coverage ${{ needs.coverage-sdk-core.result }} | |
publish-npm-packages: | |
name: Publish canary packages to registries | |
permissions: write-all | |
needs: [all-packages-tested] | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: nix develop .#ci-default -c bash -xe {0} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: cachix/install-nix-action@v19 | |
with: | |
github_access_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
- name: Build | |
run: | | |
yarn --cwd packages/sdk-core set-default-subgraph-release-tag | |
yarn build | |
env: | |
SUBGRAPH_RELEASE_TAG: dev | |
- name: Setup canary package versions locally | |
run: | | |
shortRev=$(git rev-parse --short ${{ github.sha }}) | |
preId=dev.${shortRev} | |
yarn lerna version prerelease --yes --no-git-tag-version --preid "${preId}" | |
- name: Publish to npm | |
run: | | |
tasks/npm-publish.sh packages/ethereum-contracts/ dev --verbose | |
tasks/npm-publish.sh packages/sdk-core/ dev --verbose | |
tasks/npm-publish.sh packages/sdk-redux/ dev --verbose | |
tasks/npm-publish.sh packages/metadata/ dev --verbose | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPMJS_TOKEN: ${{ secrets.NPMJS_TOKEN }} | |
publish-sdk-html-docs: | |
name: Publish canary HTML docs | |
needs: [all-packages-tested] | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: nix develop .#ci-default -c bash -xe {0} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/checkout@v4 | |
with: | |
repository: superfluid-finance/build-scripts | |
path: build-scripts | |
- uses: cachix/install-nix-action@v19 | |
with: | |
github_access_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
- name: Build | |
run: | | |
yarn --cwd packages/sdk-core set-default-subgraph-release-tag | |
yarn build | |
env: | |
SUBGRAPH_RELEASE_TAG: dev | |
- name: Build HTML documentation of SDK-s | |
run: | | |
yarn --cwd packages/sdk-core doc:html | |
yarn --cwd packages/sdk-redux doc:html | |
- name: Upload sdk-core HTML documentation | |
uses: ./build-scripts/s3cloudfront-hosting/actions/sync | |
with: | |
local_build_dir: packages/sdk-core/dist/docs | |
aws_region: eu-west-2 | |
aws_access_key_id: ${{ secrets.SITE_DEPLOYER_AWS_ACCESS_KEY_ID }} | |
aws_secret_access_key: ${{ secrets.SITE_DEPLOYER_AWS_SECRET_ACCESS_KEY }} | |
s3_uri: ${{ format('{0}sdk-core@dev', secrets.SITE_DEPLOYER_AWS_S3_DOCS_URI) }} | |
cloudfront_distribution_id: E3JEO5R14CT8IH | |
- name: Upload sdk-redux HTML documentation | |
uses: ./build-scripts/s3cloudfront-hosting/actions/sync | |
with: | |
local_build_dir: packages/sdk-redux/dist/docs | |
aws_region: eu-west-2 | |
aws_access_key_id: ${{ secrets.SITE_DEPLOYER_AWS_ACCESS_KEY_ID }} | |
aws_secret_access_key: ${{ secrets.SITE_DEPLOYER_AWS_SECRET_ACCESS_KEY }} | |
s3_uri: ${{ format('{0}sdk-redux@dev', secrets.SITE_DEPLOYER_AWS_S3_DOCS_URI) }} | |
cloudfront_distribution_id: E3JEO5R14CT8IH | |
upgrade-contracts: | |
name: Upgrade ethereum-contracts on canary testnet (protocol release version "canary") | |
if: false # disable this for now | |
needs: [all-packages-tested] | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
network: [optimism-sepolia] | |
defaults: | |
run: | |
shell: nix develop .#ci-default -c bash -xe {0} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: cachix/install-nix-action@v19 | |
with: | |
github_access_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build | |
run: | | |
yarn install --frozen-lockfile | |
yarn build | |
- name: Deploy to ${{ matrix.network }} | |
run: | | |
cd packages/ethereum-contracts | |
npx truffle exec --network ${{ matrix.network }} ops-scripts/deploy-test-environment.js | |
npx truffle exec --network ${{ matrix.network }} ops-scripts/info-print-contract-addresses.js : addresses.vars | |
tasks/etherscan-verify-framework.sh ${{ matrix.network }} addresses.vars | |
env: | |
RELEASE_VERSION: canary | |
OPTIMISM_SEPOLIA_MNEMONIC: ${{ secrets.BUILD_AGENT_MNEMONIC }} | |
OPTIMISM_SEPOLIA_PROVIDER_URL: ${{ secrets.OPTIMISM_SEPOLIA_PROVIDER_URL }} |