Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 31 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,33 @@ on:
pull_request:
branches: [ master ]

env:
# Public key for PRs, plz don't abuse
PROVIDER_MAINNET: ${{ secrets.MAINNET_PROVIDER || 'https://mainnet.infura.io/v3/42ffb4f2549c4a5fa3b5d6db70f6fad1' }}
PROVIDER_ARBITRUM: 'https://rpc.ankr.com/arbitrum'
PROVIDER_XDAI: 'https://rpc.ankr.com/gnosis'

jobs:
test:
name: test (v${{ matrix.uniswap-version }})
name: test (v${{ matrix.uniswap-version }}, ${{ matrix.network }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
uniswap-version: [1, 2, 3]
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@v2
Expand All @@ -35,26 +54,31 @@ jobs:
run: |
python -m pip install --upgrade pip poetry
poetry config virtualenvs.in-project true

- name: Set up cache
uses: actions/cache@v2
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
npm install -g [email protected]
npm install -g [email protected]

- name: Test
env:
PROVIDER: ${{ secrets.MAINNET_PROVIDER }}
# 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@v1
with:
Expand All @@ -76,16 +100,19 @@ jobs:
id: full-python-version
run: |
echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info[:3]))")

- 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@v2
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
Expand All @@ -94,6 +121,7 @@ jobs:
run: |
python -m pip install --upgrade pip poetry
poetry install

- name: Typecheck
run: |
make typecheck
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.PHONY: test typecheck lint precommit docs

test:
poetry run pytest -v --tb=line --maxfail=4 --cov=uniswap --cov-report html --cov-report term --cov-report xml
poetry run pytest -v --maxfail=10 --cov=uniswap --cov-report html --cov-report term --cov-report xml

typecheck:
poetry run mypy --pretty
Expand All @@ -11,7 +11,7 @@ lint:

format:
black uniswap

format-abis:
npx prettier --write --parser=json uniswap/assets/*/*.abi

Expand Down
Loading