Skip to content

[PROTOCOL-NG] Solidity Semantic Money draft release 1 #5078

[PROTOCOL-NG] Solidity Semantic Money draft release 1

[PROTOCOL-NG] Solidity Semantic Money draft release 1 #5078

Workflow file for this run

name: CI | Feature Branches
env:
GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }}
on:
# TODO We no longer do these, instead you always need to create a pull request
# Triggered by internal pushes
# push:
# branches-ignore: ["dev", "release-*"]
#
# NOTE To continue the old behaviour, these code snipeets is needed in the check job
## triggered by internal pushes or external PRs
## if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != 'superfluid-finance/protocol-monorepo'
pull_request:
jobs:
check:
name: Checking what packages need to be built
runs-on: ubuntu-latest
outputs:
build_ethereum_contracts: ${{ env.BUILD_ETHEREUM_CONTRACTS }}
build_hot_fuzz: ${{ env.BUILD_HOT_FUZZ }}
build_solidity_semantic_money: ${{ env.BUILD_SOLIDITY_SEMANTIC_MONEY }}
build_subgraph: ${{ env.BUILD_SUBGRAPH }}
build_sdk_core: ${{ env.BUILD_SDK_CORE }}
build_spec_haskell: ${{ env.BUILD_SPEC_HASKELL }}
build_automation_contracts: ${{ env.BUILD_AUTOMATION_CONTRACTS }}
steps:
- 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 }}
- uses: actions/checkout@v3
- name: Check changeset
run: tasks/check-changeset.sh ${{ github.sha }} dev
test-ethereum-contracts:
name: Build and test ethereum-contracts (Feature Branch)
runs-on: ubuntu-latest
needs: [check]
if: needs.check.outputs.build_ethereum_contracts
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: Install, lint and build
run: |
yarn install --frozen-lockfile
yarn lint
yarn build
- name: Test ethereum-contracts
run: |
echo "FOUNDRY_PROFILE=ci" >> $GITHUB_ENV
echo "FOUNDRY_SOLC_VERSION=$SOLC_PATH" >> $GITHUB_ENV
yarn workspace @superfluid-finance/ethereum-contracts test
env:
# NOTE: This is currently unset and fork tests are not being run
POLYGON_MAINNET_ARCHIVE_PROVIDER_URL: ${{ secrets.POLYGON_MAINNET_ARCHIVE_PROVIDER_URL }}
- name: Print test benchmarking output
run: |
cat packages/ethereum-contracts/testing-benchmark.json
coverage-ethereum-contracts:
name: Build and test coverage of ethereum-contracts (Feature Branch)
runs-on: ubuntu-latest
needs: [check]
if: needs.check.outputs.build_ethereum_contracts
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 and build
run: |
yarn install --frozen-lockfile
yarn build
- name: Run coverage test
run: |
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: |
# extract coverage for NFT contracts from forge coverage
lcov -e lcov.info 'packages/ethereum-contracts/contracts/*' -o lcov.info
# remove mocks, base super app, test and deployer contracts (see .solcover.js)
lcov -r lcov.info 'packages/ethereum-contracts/contracts/mocks/*' 'packages/ethereum-contracts/contracts/apps/*Base*' 'packages/ethereum-contracts/contracts/utils/*Test*' 'packages/ethereum-contracts/contracts/utils/*Deployer*' -o lcov.info
# merge hardhat and forge coverage files
lcov -a lcov.info -a packages/ethereum-contracts/coverage/lcov.info -o packages/ethereum-contracts/coverage/lcov.info
- name: Upload ethereum-contracts-coverage to codecov
uses: codecov/codecov-action@v2
with:
files: lcov.info
name: ethereum-contracts-coverage
flags: ethereum-contracts
fail_ci_if_error: true
test-hot-fuzz:
uses: ./.github/workflows/call.test-hot-fuzz.yml
needs: [ check ]
if: false # TODO broken atm, otherwise needs.check.outputs.build_hot_fuzz
test-solidity-semantic-money:
uses: ./.github/workflows/call.test-solidity-semantic-money.yml
needs: [ check ]
if: needs.check.outputs.build_solidity_semantic_money
#test automations:
test-automation-contracts:
uses: ./.github/workflows/call.test-automation-contracts.yml
name: Build and Test Automation Contracts
needs: [ check ]
if: needs.check.outputs.build_automation_contracts
# subgraph integration test
test-subgraph:
uses: ./.github/workflows/call.test-local-subgraph.yml
name: Build and Test Subgraph (Feature Branch)
needs: [check]
if: needs.check.outputs.build_subgraph
# sdk-core integration test + local subgraph w/ local sdk-core
test-sdk-core:
uses: ./.github/workflows/call.test-sdk-core.yml
name: Build and Test SDK-Core (Feature Branch)
needs: [check]
if: needs.check.outputs.build_sdk_core
with:
subgraph-release: local
subgraph-endpoint: http://localhost:8000/subgraphs/name/superfluid-test
run-coverage-tests: false
test-spec-haskell:
uses: ./.github/workflows/call.test-spec-haskell.yml
name: Build and Test Spec Haskell (Feature Branch)
needs: [check]
if: needs.check.outputs.build_spec_haskell
all-packages-tested:
name: All packages tested (Feature Branch)
runs-on: ubuntu-latest
if: always()
needs: [ test-spec-haskell
, test-solidity-semantic-money
, test-ethereum-contracts, coverage-ethereum-contracts
, test-hot-fuzz
, test-sdk-core
, test-subgraph
, test-automation-contracts
]
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 spec-haskell ${{ needs.test-spec-haskell.result }}
check_result ethereum-contracts ${{ needs.test-ethereum-contracts.result }}
check_result ethereum-contracts-coverage ${{ needs.coverage-ethereum-contracts.result }}
check_result hot-fuzz ${{ needs.test-hot-fuzz.result }}
check_result sdk-core ${{ needs.test-sdk-core.result }}
check_result subgraph ${{ needs.test-subgraph.result }}
check_result automation-contracts ${{ needs.test-automation-contracts.result }}