-
Notifications
You must be signed in to change notification settings - Fork 5
86 lines (72 loc) · 2.45 KB
/
python.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
name: Test against different Python version
on:
push:
branches: [ master ]
pull_request:
jobs:
python_tests:
runs-on: ubuntu-latest
strategy:
# Do not fail if one the tests did not pass
fail-fast: false
matrix:
# Python version(s) to use when running the tests
# https://github.com/actions/python-versions/blob/main/versions-manifest.json
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
# Docker images of MySQL-compliant databases to run the tests suite on
database:
- "mysql:8.0.20"
services:
mysql:
image: ${{ matrix.database }}
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: index_digest
ports:
- "53306:3306"
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- uses: actions/checkout@v4.2.2
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
# https://github.com/actions/cache/blob/main/examples.md#using-pip-to-get-cache-location
- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
- name: pip cache
uses: actions/cache@v4
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt', '**/setup.py') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install wheel
make install
- name: Linter
run: make lint
- name: Set up the database
run: |
docker ps
mysql --protocol=tcp --port=53306 -u root --password="" -v < setup.sql
# import the test schema files
"./sql/populate.sh"
mysql --protocol=tcp --port=53306 -uindex_digest -pqwerty index_digest -v -e '\s; SHOW TABLES; SHOW DATABASES;'
- name: Tests with code coverage
run: make coverage
# https://coveralls-python.readthedocs.io/en/latest/usage/index.html
# upload coverage report for just one of Python version matrix runs
- name: Upload coverage report to Coveralls
if: matrix.python-version == '3.9'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: coveralls --service=github