Merge branch 'main' into ci/add-venom-tests #2758
Workflow file for this run
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: 🕵️♂️ Test smart contracts | |
on: [push, pull_request, workflow_dispatch] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
tests: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: | |
- ubuntu-latest | |
python_version: | |
- 3.12 | |
architecture: | |
- x64 | |
node_version: | |
- 20 | |
echidna: | |
- "--config test/echidna.yaml" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python_version }} | |
architecture: ${{ matrix.architecture }} | |
- name: Install Vyper | |
run: pip install git+https://github.com/vyperlang/vyper@master | |
- name: Show the Vyper version | |
run: vyper --version | |
- name: Setup Ape | |
uses: ApeWorX/github-action@v3 | |
with: | |
python-version: ${{ matrix.python_version }} | |
- name: Check Ape compilation | |
run: ape compile | |
- name: Show the Vyper version | |
run: vyper --version | |
- name: Install pnpm | |
uses: pnpm/action-setup@v3 | |
with: | |
version: latest | |
run_install: false | |
- name: Get pnpm cache directory path | |
id: pnpm-cache-dir-path | |
run: echo "dir=$(pnpm store path --silent)" >> $GITHUB_OUTPUT | |
- name: Restore pnpm cache | |
uses: actions/cache@v4 | |
id: pnpm-cache | |
with: | |
path: ${{ steps.pnpm-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: ${{ runner.os }}-pnpm-store- | |
- name: Use Node.js ${{ matrix.node_version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node_version }} | |
- name: Install pnpm project with a clean slate | |
run: pnpm install --prefer-offline --frozen-lockfile | |
- name: Install Foundry | |
uses: foundry-rs/foundry-toolchain@v1 | |
with: | |
version: nightly | |
- name: Add Vyper path to `ci` Foundry profile | |
run: | | |
sed -i '/\[profile.ci\]/a vyper = { path = "'"$(which vyper)"'" }' foundry.toml | |
- name: Show the Foundry CI config | |
run: forge config | |
env: | |
FOUNDRY_PROFILE: ci | |
- name: Foundry tests | |
run: forge test | |
env: | |
FOUNDRY_PROFILE: ci | |
- name: Add Vyper path to `default` Foundry profile | |
run: | | |
sed -i -e '/\[profile.default\]/,/^$/ { /^vyper/ d; }' -e '/\[profile.default\]/a vyper = { optimize = "gas", path = "'"$(which vyper)"'" }' foundry.toml | |
- name: Show the Foundry default config | |
run: forge config | |
env: | |
FOUNDRY_PROFILE: default | |
- name: Run snapshot | |
run: NO_COLOR=1 forge snapshot >> $GITHUB_STEP_SUMMARY | |
env: | |
FOUNDRY_PROFILE: default | |
- name: Install Homebrew | |
uses: Homebrew/actions/setup-homebrew@master | |
- name: Install Echidna | |
run: brew install echidna | |
- name: Show the Echidna version | |
run: echidna --version | |
- name: Add Vyper path to `echidna` Foundry profile | |
run: | | |
sed -i '/\[profile.echidna\]/a vyper = { path = "'"$(which vyper)"'" }' foundry.toml | |
- name: Show the Foundry Echidna config | |
run: forge config | |
env: | |
FOUNDRY_PROFILE: echidna | |
- name: Compile the Echidna test contracts | |
run: forge build --build-info | |
env: | |
FOUNDRY_PROFILE: echidna | |
- name: Run Echidna ERC-20 property tests | |
run: echidna test/tokens/echidna/ERC20Properties.sol --contract CryticERC20ExternalHarness ${{ matrix.echidna }} | |
env: | |
FOUNDRY_PROFILE: echidna | |
- name: Run Echidna ERC-721 property tests | |
run: echidna test/tokens/echidna/ERC721Properties.sol --contract CryticERC721ExternalHarness ${{ matrix.echidna }} | |
env: | |
FOUNDRY_PROFILE: echidna |