Add CodSpeed performance benchmarking integration #2
This file contains hidden or 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: CodSpeed | |
| on: | |
| push: | |
| branches: | |
| - "master" | |
| pull_request: | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| id-token: write | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| benchmarks: | |
| name: Run benchmarks | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repository code | |
| uses: actions/checkout@v6 | |
| with: | |
| persist-credentials: false | |
| - name: Setup Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.12" | |
| cache: pip | |
| cache-dependency-path: | | |
| pyproject.toml | |
| poetry.lock | |
| - name: Load cached Poetry installation | |
| id: cached-poetry | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/.local | |
| key: poetry-${{ runner.os }}-3.12-0 | |
| - name: Install Poetry | |
| if: steps.cached-poetry.outputs.cache-hit != 'true' | |
| uses: snok/install-poetry@v1 | |
| - name: Load cached venv | |
| id: cached-poetry-dependencies | |
| uses: actions/cache@v5 | |
| with: | |
| path: .venv | |
| key: venv-${{ runner.os }}-3.12-${{ hashFiles('**/poetry.lock') }}-codspeed-0 | |
| - name: Install Dependencies | |
| if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
| run: poetry install --no-interaction | |
| shell: bash | |
| - name: Upgrade Setuptools | |
| if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
| run: poetry run python -m pip install -U "setuptools<81" | |
| shell: bash | |
| - name: Setup brownie networks | |
| run: poetry run brownie networks modify mainnet host=${{ secrets.TENDERLY_PROVIDER }} | |
| shell: bash | |
| continue-on-error: true | |
| - name: Run benchmarks | |
| uses: CodSpeedHQ/action@v4 | |
| with: | |
| mode: simulation | |
| run: poetry run pytest tests/benchmarks/ --codspeed | |
| env: | |
| PYTEST_NETWORK: mainnet | |
| ETHERSCAN_TOKEN: ${{ secrets.ETHERSCAN_TOKEN }} | |
| MAX_RETRIES: 2 | |
| MIN_SLEEP_TIME: 1 | |
| MAX_SLEEP_TIME: 3 |