Skip to content

PR comments

PR comments #10665

name: Protocol Foundry tests
on: [push, pull_request]
jobs:
check:
defaults:
run:
working-directory: packages/protocol
name: Run tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Fail if there are test with wrong extension
if: success() || failure()
run: |
if tree test-sol | grep -i ".sol" | grep -v ".sol"; then
echo "There are tests with wrong extensions"
tree test-sol | grep -i ".sol" | grep -v ".sol"
exit 1
fi
- name: Foundry cache
id: foundry-cache
uses: actions/cache@v3
with:
path: ./cache
key: ${{ runner.os }}-foundry-cache
- name: Foundry out
id: foundry-out
uses: actions/cache@v3
with:
path: ./out
key: ${{ runner.os }}-foundry-out
- name: Install Foundry
uses: onbjerg/foundry-toolchain@v1
with:
version: nightly
- name: Install forge dependencies
run: forge install
# "Run tests" already tries to compile the contracts
# Making it explicit here to have easier to read errors
- name: Compile Contracts
run: forge compile
- name: Run tests common
# can't use gas limit because some setUp function use more than the limit
run: forge test -vvv --match-path "test-sol/common/*" # --block-gas-limit 50000000
- name: Run tests compatibility
if: success() || failure()
run: forge test -vvv --block-gas-limit 50000000 --match-path "test-sol/compatibility/*"
- name: Run tests governance/network
if: success() || failure()
run: forge test -vvv --block-gas-limit 50000000 --match-path "test-sol/governance/network/*"
- name: Run tests governance/validators
if: success() || failure()
run: forge test -vvv --block-gas-limit 50000000 --match-path "test-sol/governance/validators/*"
- name: Run tests governance/voting
# can't use gas limit because some setUp function use more than the limit
if: success() || failure()
run: forge test -vvv --match-path "test-sol/governance/voting/*" --block-gas-limit 50000000
- name: Run tests stability
if: success() || failure()
run: forge test -vvv --block-gas-limit 50000000 --match-path "test-sol/stability/*"
- name: Run tests identity
if: success() || failure()
run: forge test -vvv --block-gas-limit 50000000 --match-path "test-sol/identity/*"
- name: Fail if there are tests without folder
if: success() || failure()
run: |
if ls test-sol | grep -qi '\.t\.sol'; then
echo "All tests should be in a folder"
exit 1
fi
- name: Run Everything just in case something was missed
# can't use gas limit because some setUp function use more than the limit
run: forge test -vvv