-
Notifications
You must be signed in to change notification settings - Fork 12
96 lines (80 loc) · 3.2 KB
/
python-package.yml
File metadata and controls
96 lines (80 loc) · 3.2 KB
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
name: CI
on: [push, pull_request]
jobs:
deploy:
strategy:
fail-fast: false
matrix:
os: ['macOS-latest', 'windows-latest']
python-version: ['3.10', '3.9', '3.8', '3.7']
compiler: ['gcc']
architecture: ['x86', 'x64']
include:
- os: 'ubuntu-latest'
python-version: '3.10'
compiler: 'gcc'
timeout-minutes: 30
runs-on: ${{ matrix.os }}
name: ${{ matrix.os }} ${{ matrix.architecture }} - ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v2
# Setup for Windows - installs the correct python architecture, x86 / x64
- name: Set up Python (Win) ${{ matrix.python-version }} ${{ matrix.architecture }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.architecture }}
if: runner.os == 'Windows'
# Setup for Mac & Linux, both don't support architecture selection without using specific versions
- name: Set up Python (Non-Win) ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
if: runner.os != 'Windows'
# Display the versions
- name: Show runner information
run: |
python --version
pip --version
# Installs the dependencies, add yours here
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade setuptools wheel pytest twine
# Syntax check
- name: Lint with flake8
run: |
pip install flake8
# 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
# Build
- name: Build package
run: python setup.py build
# Install Local
- name: Install package
run: python setup.py install --user
# Run Tests, have to be in a file with test in name in a folder named tests with functions with test in the name
- name: Run tests
run: pytest -v -s
# Create wheels for deployment
- name: Build wheels
run: python setup.py sdist bdist_wheel --skip-build
if: runner.os != 'Linux' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
- name: Build wheels (manylinux)
uses: RalfG/python-wheels-manylinux-build@v0.5.0-manylinux2010_x86_64
if: runner.os == 'Linux' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
# Deploy
- name: Publish
shell: bash
if: success() && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
if [ $(uname) == 'Linux' ]; then
twine upload dist/*-manylinux* --skip-existing
else
twine upload dist/* --skip-existing
fi