-
Notifications
You must be signed in to change notification settings - Fork 1
108 lines (96 loc) · 3.02 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
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
name: Test
on: [push]
jobs:
Test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
- uses: actions/setup-python@v2
with:
python-version: "3.x"
architecture: "x64"
- name: cache setup
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: pip install -r requirements.txt
- run: sudo apt install software-properties-common
#install firejail
- run: sudo add-apt-repository -y ppa:deki/firejail
- run: sudo apt-get update
- run: sudo apt-get install firejail
- name: Install GCC
run: sudo apt-get install gcc
- name: Run Tests
run: pytest -n 4
Coverage:
runs-on: ubuntu-latest
env:
OS: ubuntu-latest
PYTHON: "3.8"
steps:
- name: Checkout
uses: actions/[email protected]
- name: cache setup
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- uses: actions/setup-python@v2
with:
python-version: "3.x"
architecture: "x64"
- name: Install dependencies
run: pip install -r requirements.txt
- run: sudo apt install software-properties-common
#install firejail
- run: sudo add-apt-repository -y ppa:deki/firejail
- run: sudo apt-get update
- run: sudo apt-get install firejail
- name: Install GCC
run: sudo apt-get install gcc
- name: Generate Report
run: |
coverage run -m pytest
coverage report --fail-under=99
Publish:
runs-on: ubuntu-latest
needs: [Test, Coverage]
steps:
- name: Checkout
uses: actions/[email protected]
- uses: actions/setup-python@v2
with:
python-version: "3.x"
architecture: "x64"
- name: cache setup
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: pip install -r requirements.txt
- name: Build package
run: python3 -m build --sdist --wheel --outdir dist/
- name: Publish package to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository_url: https://test.pypi.org/legacy/
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
skip_existing: true
verbose: true
- name: Publish package to PyPI
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
skip_existing: true