-
Notifications
You must be signed in to change notification settings - Fork 0
112 lines (95 loc) · 3.11 KB
/
build.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
109
110
111
112
name: Build
on:
pull_request:
branches:
- develop
- master
paths:
- '**.py' # Only run this workflow when python files change
jobs:
unit:
name: Unit Tests
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8]
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Fetch all history
run: git fetch --prune --unshallow --tags
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install -e .
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Run Unit Tests
run: python -m unittest discover -s tests/unit
functional:
name: Functional Tests
runs-on: ubuntu-latest
if: github.base_ref == 'master'
needs: unit
env:
GITHUB_SOURCE_BRANCH: ${{ github.head_ref }}
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: 3.x
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Install dependencies
run: pip install -r requirements.txt
- name: Run Functional Tests
run: python -m unittest discover -s tests/functional -f
pypi:
name: Test Pypi
runs-on: ubuntu-latest
if: github.base_ref == 'master'
needs: [unit, functional]
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Fetch all history
run: git fetch --prune --unshallow --tags
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
# - name: Calculate Next Version
# id: next_version
# uses: K-Phoen/semver-release-action@master
# with:
# release_branch: master
# release_strategy: none
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_TEST_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload --repository testpypi dist/*