-
Notifications
You must be signed in to change notification settings - Fork 17
61 lines (58 loc) · 1.97 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
name: build
on:
push:
branches:
- master
paths-ignore:
- 'docs/**'
- '*.md'
pull_request:
branches:
- master
paths-ignore:
- 'docs/**'
- '*.md'
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [3.7, 3.9]
os: [ubuntu-latest, windows-latest]
name: Test & Build (Python ${{ matrix.python-version }} on ${{ matrix.os }})
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Install dependencies
run: |
# upgrade pip, install flake8 (for linting), bandit (another linter), pytest (for testing), wheel (for packaging) and the personio-py package
python -m pip install --upgrade pip
pip install flake8 pytest bandit responses wheel
pip install -r requirements.txt
python setup.py install
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 src --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. ignore unused imports in __init__.py (F401) and line break after binary operator (W504)
flake8 src --count --exit-zero --max-complexity=10 --max-line-length=100 --ignore=F401,W504 --statistics
- name: Lint with bandit
run: |
# stop the build if there are any security issues reported by bandit
bandit -r src
- name: Test with pytest
run: |
pytest tests
- name: Build a distribution package (wheel)
run: |
python setup.py sdist bdist_wheel
- name: Store distribution package
uses: actions/upload-artifact@v2
with:
name: personio-py_${{ matrix.python-version }}_${{ matrix.os }}
path: dist/