Skip to content

Commit c639f47

Browse files
authored
Merge pull request #550 from 23-OSSCA-python-mysql-replication/bug/coverage-test
Bug/coverage test
2 parents 7bb5e36 + a2ed8c8 commit c639f47

File tree

1 file changed

+42
-29
lines changed

1 file changed

+42
-29
lines changed

.github/workflows/coverage.yml

+42-29
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,47 @@
11
name: Python Coverage
2-
3-
on: [push, pull_request]
4-
2+
on:
3+
push:
4+
pull_request:
5+
workflow_dispatch:
56
jobs:
67
build:
7-
88
runs-on: ubuntu-latest
9-
9+
timeout-minutes: 3
10+
1011
steps:
11-
- name: Check out code
12-
uses: actions/checkout@v2
13-
14-
- name: Set up Python
15-
uses: actions/setup-python@v2
16-
with:
17-
python-version: '3.x'
18-
19-
- name: Install dependencies
20-
run: |
21-
python -m pip install --upgrade pip
22-
pip install -r requirements.txt
23-
24-
- name: Run coverage
25-
run: |
26-
coverage run -m unittest discover
27-
coverage html
28-
29-
- run: smokeshow upload htmlcov
30-
env:
31-
SMOKESHOW_GITHUB_STATUS_DESCRIPTION: CLI Coverage {coverage-percentage}
32-
SMOKESHOW_GITHUB_COVERAGE_THRESHOLD: 50
33-
SMOKESHOW_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34-
SMOKESHOW_GITHUB_PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
12+
- name: Check out code
13+
uses: actions/checkout@v4
14+
15+
- name: Set up Python
16+
uses: actions/setup-python@v4
17+
with:
18+
python-version: '3.x'
19+
20+
- name: Run database server in docker
21+
run: |
22+
docker compose create
23+
docker compose start
24+
echo "wait mysql server"
25+
26+
while :
27+
do
28+
if mysql -h 127.0.0.1 --user=root --execute "SELECT version();" 2>&1 >/dev/null && mysql -h 127.0.0.1 --port=3307 --user=root --execute "SELECT version();" 2>&1 >/dev/null; then
29+
break
30+
fi
31+
sleep 1
32+
done
33+
34+
- name: Install dependencies
35+
run: |
36+
python -m pip install --upgrade pip
37+
pip install .
38+
pip install pytest coverage smokeshow
39+
40+
- name: Run coverage
41+
run: |
42+
coverage run -m pytest -k "not test_no_trailing_rotate_event and not test_end_log_pos and not test_query_event_latin1"
43+
coverage html
44+
45+
- run: smokeshow upload htmlcov
46+
env:
47+
SMOKESHOW_GITHUB_COVERAGE_THRESHOLD: 60

0 commit comments

Comments
 (0)