-
Notifications
You must be signed in to change notification settings - Fork 21
69 lines (59 loc) · 1.71 KB
/
test.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
name: Test
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
get-tox-envlist:
runs-on: ubuntu-latest
outputs:
envlist: ${{ steps.generate-tox-envlist.outputs.envlist }}
steps:
- uses: actions/checkout@v3
- run: |
python -m pip install --upgrade pip
python -m pip install tox tox-gh-matrix
- id: generate-tox-envlist
run: python -m tox --gh-matrix
build:
name: Test ${{ matrix.tox.name }}
runs-on: ubuntu-latest
needs: get-tox-envlist
strategy:
fail-fast: false
matrix:
tox: ${{ fromJSON(needs.get-tox-envlist.outputs.envlist) }}
# Service containers to run with `container-job`
services:
# Label used to access the service container
redis:
# Docker Hub image
image: redis
# Set health checks to wait until redis has started
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps port 6379 on service container to the host
- 6379:6379
steps:
- uses: actions/checkout@v2
- name: Setup Python ${{ matrix.tox.python.version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.tox.python.spec }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade tox
- name: Tox tests
run: python -m tox -v -e ${{ matrix.tox.name }}
- name: Install codecov
run: python -m pip install codecov
- name: Upload coverage
run: python -m codecov --name "Python ${{ matrix.tox.python.spec }}"