Update Framework.js (#1494) #599
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.test-local-subgraph.yml" | |
jobs: | |
essential-build-and-test: | |
name: Build and test essential packages of dev branch | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [16, 18] | |
defaults: | |
run: | |
shell: nix develop .#ci-node${{ matrix.node-version }} -c bash {0} | |
steps: | |
- uses: actions/checkout@v3 | |
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 | |
echo "FOUNDRY_PROFILE=ci" >> $GITHUB_ENV | |
echo "FOUNDRY_SOLC_VERSION=$SOLC_PATH" >> $GITHUB_ENV | |
yarn test | |
env: | |
POLYGON_MAINNET_PROVIDER_URL: ${{ secrets.POLYGON_MAINNET_PROVIDER_URL }} | |
SUBGRAPH_RELEASE_TAG: dev | |
test-hot-fuzz: | |
uses: ./.github/workflows/call.test-hot-fuzz.yml | |
if: false # broken atm | |
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 | |
check: | |
name: Checking what packages need to be built | |
runs-on: ubuntu-latest | |
outputs: | |
build_subgraph: ${{ env.BUILD_SUBGRAPH }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Check changeset | |
run: tasks/check-changeset.sh ${{ github.sha }} dev | |
# 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-hosted-service-subgraph.yml | |
name: "Deploy Hosted Service Subgraph to dev endpoints on all networks" | |
needs: [check, test-subgraph] | |
if: needs.check.outputs.build_subgraph | |
with: | |
release_branch: 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: Run coverage test of ethereum-contracts of dev branch | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: nix develop -c bash {0} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: cachix/install-nix-action@v19 | |
with: | |
github_access_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install, run coverage test | |
run: | | |
yarn install --frozen-lockfile | |
yarn build | |
echo "FOUNDRY_PROFILE=ci" >> $GITHUB_ENV | |
echo "FOUNDRY_SOLC_VERSION=$SOLC_PATH" >> $GITHUB_ENV | |
yarn workspace @superfluid-finance/ethereum-contracts test-coverage | |
- name: Install lcov | |
run: sudo apt-get -y install lcov | |
- name: Clean up and merge coverage artifacts | |
run: ./tasks/coverage-cleanup.sh | |
- name: Create coverage artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ethereum-contracts-coverage | |
path: | | |
packages/ethereum-contracts/coverage/ | |
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 | |
publish-coverage-reports: | |
name: Publish coverage reports | |
needs: [coverage-ethereum-contracts, coverage-sdk-core] | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download ethereum-contracts-coverage | |
uses: actions/download-artifact@v3 | |
with: | |
name: ethereum-contracts-coverage | |
path: packages/ethereum-contracts/coverage | |
- name: Upload ethereum-contracts-coverage to codecov | |
uses: codecov/codecov-action@v2 | |
with: | |
files: packages/ethereum-contracts/coverage/lcov.info | |
name: ethereum-contracts-coverage | |
flags: ethereum-contracts | |
fail_ci_if_error: true | |
- name: Download sdk-core-coverage | |
uses: actions/download-artifact@v3 | |
with: | |
name: sdk-core-coverage | |
path: packages/sdk-core/coverage | |
- name: Upload sdk-core-coverage to codecov | |
uses: codecov/codecov-action@v2 | |
with: | |
files: packages/sdk-core/coverage/lcov.info | |
name: sdk-core-coverage | |
flags: sdk-core | |
fail_ci_if_error: true | |
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 }} | |
# removed check_result hot-fuzz | |
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 -c bash {0} | |
steps: | |
- uses: actions/checkout@v3 | |
- 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 | |
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 -c bash {0} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/checkout@v3 | |
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 "test") | |
needs: [all-packages-tested] | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
network: [avalanche-fuji] | |
defaults: | |
run: | |
shell: nix develop -c bash {0} | |
steps: | |
- uses: actions/checkout@v3 | |
- 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 | |
env: | |
RELEASE_VERSION: master | |
AVALANCHE_FUJI_MNEMONIC: ${{ secrets.BUILD_AGENT_MNEMONIC }} | |
AVALANCHE_FUJI_PROVIDER_URL: ${{ secrets.AVALANCHE_FUJI_PROVIDER_URL }} |