-
Notifications
You must be signed in to change notification settings - Fork 377
128 lines (110 loc) 路 3.87 KB
/
Copy pathtest.yml
File metadata and controls
128 lines (110 loc) 路 3.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
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_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: [1, 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