-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (68 loc) · 2.03 KB
/
python-tests-and-publish.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
name: Python Tests and Publish
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
release:
types: [created]
jobs:
test:
runs-on: self-hosted
strategy:
matrix:
python-version: [3.7, 3.8, 3.9]
steps:
- uses: actions/checkout@v2
- name: Set Environment Variables
run: |
export PATH="/home/dixon/actions-runner/_work/_tool:$PATH"
export RUNNER_TOOL_CACHE="/home/dixon/actions-runner/_work/_tool"
export AGENT_TOOLSDIRECTORY="/home/dixon/actions-runner/_work/_tool"
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
architecture: 'x64'
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade setuptools wheel
pip install -r requirements.txt
- name: Install test dependencies
run: |
pip install pytest pytest-cov
- name: Run tests
run: |
export PYTHONPATH=$PYTHONPATH:$(pwd)
pytest tests/ --cov=src/ --cov-report=xml
- name: Upload coverage report
uses: codecov/codecov-action@v5
with:
file: ./coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}
slug: dxns-hub/vapos
flags: unittests
fail_ci_if_error: false
publish:
needs: test
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'created'
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
architecture: 'x64'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*