117 lines (98 loc) · 3.01 KB
/
test.yaml
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
name: Test
on:
push:
pull_request:
jobs:
test:
runs-on: ubuntu-20.04
strategy:
matrix:
include:
- db: "mariadb:10.2"
py: "3.9"
- db: "mariadb:10.3"
py: "3.8"
- db: "mariadb:10.5"
py: "3.7"
- db: "mysql:5.6"
py: "3.6"
- db: "mysql:5.7"
py: "pypy-3.6"
- db: "mysql:8.0"
py: "3.9"
mysql_auth: true
- db: "mysql:8.0"
py: "3.10-dev"
services:
mysql:
image: "${{ matrix.db }}"
ports:
- 3306:3306
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
options: "--name=mysqld"
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.py }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.py }}
- uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-1
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependency
run: |
pip install -U cryptography PyNaCl pytest pytest-cov coveralls
- name: Set up MySQL
run: |
while :
do
sleep 1
mysql -h127.0.0.1 -uroot -e 'select version()' && break
done
mysql -h127.0.0.1 -uroot -e "SET GLOBAL local_infile=on"
mysql -h127.0.0.1 -uroot --comments < ci/docker-entrypoint-initdb.d/init.sql
mysql -h127.0.0.1 -uroot --comments < ci/docker-entrypoint-initdb.d/mysql.sql
mysql -h127.0.0.1 -uroot --comments < ci/docker-entrypoint-initdb.d/mariadb.sql
cp ci/docker.json pymysql/tests/databases.json
- name: Run test
run: |
pytest -v --cov --cov-config .coveragerc pymysql
- name: Run MySQL8 auth test
if: ${{ matrix.mysql_auth }}
run: |
docker cp mysqld:/var/lib/mysql/public_key.pem "${HOME}"
docker cp mysqld:/var/lib/mysql/ca.pem "${HOME}"
docker cp mysqld:/var/lib/mysql/server-cert.pem "${HOME}"
docker cp mysqld:/var/lib/mysql/client-key.pem "${HOME}"
docker cp mysqld:/var/lib/mysql/client-cert.pem "${HOME}"
pytest -v --cov --cov-config .coveragerc tests/test_auth.py;
- name: Report coverage
run: coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: ${{ matrix.py }}-${{ matrix.db }}
COVERALLS_PARALLEL: true
coveralls:
name: Finish coveralls
runs-on: ubuntu-20.04
needs: test
steps:
- uses: actions/setup-python@v2
with:
python-version: 3.9
- uses: actions/cache@v2
with:
path: ~/.cache/pip
key: finish-pip-1
restore-keys: |
finish-pip-
- name: Finished
run: |
pip install --upgrade coveralls
coveralls --finish --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}