1+ name : tests
2+ on :
3+ push :
4+ branches : [ master ]
5+
6+ pull_request :
7+ branches : [ master ]
8+
9+ jobs :
10+ test :
11+ runs-on : ${{ matrix.os }}
12+ strategy :
13+ fail-fast : false
14+ matrix :
15+ python-version : [ 3.6, 3.7, 3.8, 3.9 ]
16+ mongodb-version : ['4.0', '4.2', '4.4']
17+ os : [ ubuntu-latest ]
18+
19+ steps :
20+ - name : Checkout
21+ uses : actions/checkout@v2
22+
23+ - name : Set up Python ${{ matrix.python-version }}
24+ uses : actions/setup-python@v2
25+ with :
26+ python-version : ${{ matrix.python-version }}
27+
28+ - name : Start MongoDB
29+ uses : supercharge/mongodb-github-action@1.6.0
30+ with :
31+ mongodb-version : ${{ matrix.mongodb-version }}
32+
33+ - name : Install dependencies
34+ run : |
35+ pip install -r requirements.txt
36+ pip install coveralls
37+
38+ - name : Run tests
39+ run : |
40+ coverage run -m unittest discover --verbose --start-directory tests/ --pattern "test_*.py" --top-level-directory tests/
41+
42+ - name : Upload coverage data to coveralls.io
43+ run : coveralls --service=github
44+ env :
45+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
46+ COVERALLS_FLAG_NAME : ${{ matrix.os }} - ${{ matrix.python-version }}
47+ COVERALLS_PARALLEL : true
48+
49+ coveralls :
50+ name : Indicate completion to coveralls.io
51+ needs : test
52+ runs-on : ubuntu-latest
53+ container : python:3-slim
54+ steps :
55+ - name : Finished
56+ run : |
57+ pip3 install --upgrade coveralls
58+ coveralls --finish
59+ env :
60+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
61+
62+ release :
63+ name : Release
64+ runs-on : ubuntu-latest
65+ needs : [ test, coveralls ]
66+ steps :
67+ - name : Checkout
68+ uses : actions/checkout@v2
69+ with :
70+ fetch-depth : 0
71+
72+ - name : Setup Node.js
73+ uses : actions/setup-node@v1
74+
75+ - name : Setup
76+ run : npm install -g semantic-release @semantic-release/github @semantic-release/changelog @semantic-release/commit-analyzer @semantic-release/git @semantic-release/release-notes-generator semantic-release-pypi
77+
78+ - name : Set up python
79+ uses : actions/setup-python@v2
80+ with :
81+ python-version : 3.8
82+
83+ - name : Install setuptools
84+ run : python -m pip install --upgrade setuptools wheel twine
85+
86+ - name : Release
87+ env :
88+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
89+ PYPI_TOKEN : ${{ secrets.PYPI_TOKEN }}
90+ run : npx semantic-release
0 commit comments