| 1 |
name: Test |
| 2 |
|
| 3 |
on: [push, pull_request] |
| 4 |
|
| 5 |
env: |
| 6 |
FORCE_COLOR: 1 |
| 7 |
|
| 8 |
jobs: |
| 9 |
build: |
| 10 |
runs-on: ${{ matrix.os }} |
| 11 |
strategy: |
| 12 |
fail-fast: false |
| 13 |
matrix: |
| 14 |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] |
| 15 |
os: [ubuntu-22.04] |
| 16 |
|
| 17 |
steps: |
| 18 |
- uses: actions/checkout@v4 |
| 19 |
|
| 20 |
- name: Set up Python ${{ matrix.python-version }} |
| 21 |
uses: actions/setup-python@v5 |
| 22 |
with: |
| 23 |
python-version: ${{ matrix.python-version }} |
| 24 |
|
| 25 |
- name: Get pip cache dir |
| 26 |
id: pip-cache |
| 27 |
run: | |
| 28 |
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT |
| 29 |
|
| 30 |
- name: Cache |
| 31 |
uses: actions/cache@v4 |
| 32 |
with: |
| 33 |
path: ${{ steps.pip-cache.outputs.dir }} |
| 34 |
key: |
| 35 |
${{ matrix.os }}-${{ matrix.python-version }}-v1-${{ |
| 36 |
hashFiles('**/setup.py') }} |
| 37 |
restore-keys: | |
| 38 |
${{ matrix.os }}-${{ matrix.python-version }}-v1- |
| 39 |
|
| 40 |
- name: Install dependencies |
| 41 |
run: | |
| 42 |
python -m pip install -U pip |
| 43 |
python -m pip install -U "tox>=4" |
| 44 |
|
| 45 |
- name: Install gmpy2 dependencies |
| 46 |
if: matrix.python-version == '3.11' || matrix.python-version == '3.12' |
| 47 |
run: | |
| 48 |
sudo apt-get -y update |
| 49 |
sudo apt-get install -y libmpfr-dev libmpc-dev |
| 50 |
|
| 51 |
- name: Tox tests |
| 52 |
run: | |
| 53 |
tox run |