-
Notifications
You must be signed in to change notification settings - Fork 0
131 lines (123 loc) · 3.39 KB
/
ci.yml
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
129
130
131
name: CI
on: push
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
### Style
lint_python:
name: Lint Python
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.8
cache: pip
cache-dependency-path: noxfile.py
- run: pip install nox
- run: nox -s lint
lint_rust:
name: Lint Rust
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
components: rustfmt, clippy
default: true
- uses: Swatinem/rust-cache@v2
continue-on-error: true
- run: cargo clippy
### Tests
test_python:
name: Test Python
runs-on: ubuntu-latest
strategy:
matrix:
python_version: [ '3.8', '3.9', '3.10' ]
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python_version }}
cache: pip
cache-dependency-path: |
pyproject.toml
noxfile.py
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
default: true
- uses: Swatinem/rust-cache@v2
continue-on-error: true
- run: pip install nox
- name: Run tests
env:
PY_VERSION: ${{ matrix.python_version }}
run: |
echo "version=$PY_VERSION" > $(pwd)/pyo3.conf
PYO3_CONFIG_FILE=$(pwd)/pyo3.conf nox -s test
test_rust:
name: Test Rust
runs-on: ubuntu-latest
strategy:
matrix:
python_version: [ '3.8', '3.9', '3.10' ]
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python_version }}
cache: pip
cache-dependency-path: pyproject.toml
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
default: true
- uses: Swatinem/rust-cache@v2
continue-on-error: true
- run: pip install .
- run: cargo test --no-default-features
benchmark:
name: Benchmark
needs: [ test_python, test_rust ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
default: true
- uses: Swatinem/rust-cache@v2
continue-on-error: true
- name: Install libmaxminddb
run: |
sudo add-apt-repository ppa:maxmind/ppa
sudo apt update
sudo apt install libmaxminddb0 libmaxminddb-dev mmdb-bin
- uses: actions/setup-python@v4
with:
python-version: 3.8
cache-dependency-path: |
pyproject.toml
noxfile.py
# Needed in order to pick up the C extension properly
- name: Force reinstall maxminddb
run: pip install maxminddb --force-reinstall --verbose --no-cache-dir
- run: pip install nox
- name: Bench
run: |
echo "version=3.8" > $(pwd)/pyo3.conf
PYO3_CONFIG_FILE=$(pwd)/pyo3.conf nox -s test