name: Test on: push: branches: [ master, dev/v4, dev/v4-fin ] pull_request: branches: [ master, dev/v4, dev/v4-fin ] env: # The repo secret still points at a rate-limited Infura URL, so CI must use # the public endpoint directly instead of preferring the secret on push runs. #PROVIDER_MAINNET: 'https://ethereum.publicnode.com' PROVIDER_MAINNET: 'https://eth.drpc.org' PROVIDER_ARBITRUM: 'https://arb1.arbitrum.io/rpc' PROVIDER_XDAI: 'https://rpc.ankr.com/gnosis' jobs: test: name: test (v${{ matrix.uniswap-version }}, ${{ matrix.network }}) runs-on: ubuntu-latest strategy: fail-fast: false matrix: uniswap-version: [2, 3, 4] network: ["mainnet"] # include: # - network: arbitrum # uniswap-version: 3 #include: # - network: xdai # uniswap-version: 3 #include: # - network: optimism # uniswap-version: 3 #include: # - network: polygon # uniswap-version: 3 steps: - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 with: python-version: '3.12' # Set up poetry cache, from https://github.com/python-poetry/poetry/blob/45a9b8f20384591d0a33ae876bcf23656f928ec0/.github/workflows/main.yml - name: Get full python version id: full-python-version run: | version=$(python3 -c "import sys; print('-'.join(str(v) for v in sys.version_info[:3]))") echo "version=$version" >> "$GITHUB_OUTPUT" - name: Set up poetry run: | python -m pip install --upgrade pip poetry poetry config virtualenvs.in-project true - name: Set up cache uses: actions/cache@v4 id: cache with: path: .venv key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }} - name: Ensure cache is healthy if: steps.cache.outputs.cache-hit == 'true' run: timeout 10s poetry run pip --version || rm -rf .venv - name: Install dependencies run: | poetry install - name: Install Foundry uses: foundry-rs/foundry-toolchain@v1 - name: Test env: # Use the secret if available, otherwise fallback to the public key PROVIDER: ${{ ((matrix.network == 'mainnet') && env.PROVIDER_MAINNET) || ((matrix.network == 'arbitrum') && env.PROVIDER_ARBITRUM) }} UNISWAP_VERSION: ${{ matrix.uniswap-version }} run: | make test - name: "Upload coverage to Codecov" uses: codecov/codecov-action@v4 with: token: ${{ secrets.CODECOV_TOKEN }} fail_ci_if_error: true typecheck: name: typecheck runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 with: python-version: '3.12' # Set up poetry cache, from https://github.com/python-poetry/poetry/blob/45a9b8f20384591d0a33ae876bcf23656f928ec0/.github/workflows/main.yml - name: Get full python version id: full-python-version run: | version=$(python3 -c "import sys; print('-'.join(str(v) for v in sys.version_info[:3]))") echo "version=$version" >> "$GITHUB_OUTPUT" - name: Set up poetry run: | python -m pip install --upgrade pip poetry poetry config virtualenvs.in-project true - name: Set up cache uses: actions/cache@v4 id: cache with: path: .venv key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }} - name: Ensure cache is healthy if: steps.cache.outputs.cache-hit == 'true' run: timeout 10s poetry run pip --version || rm -rf .venv - name: Install dependencies run: | python -m pip install --upgrade pip poetry poetry install - name: Typecheck run: | make typecheck