-
Notifications
You must be signed in to change notification settings - Fork 51
176 lines (160 loc) · 5.65 KB
/
python_pipeline.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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# This is a basic workflow to help you get started with Actions
name: python piepline
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [main]
pull_request:
branches: [main]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
flake8:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Run flake8 with reviewdog
# You may pin to the exact commit or the version.
# uses: reviewdog/action-flake8@6146a50d029068dbd40bf1c6ce75f5fd8970a1b1
uses: reviewdog/action-flake8@v3.0.0
with:
fail_on_error: false
flake8_args: "--ignore E501,E503,W503,E203 --exclude test/**,docs/*,e2e/**,rust/**,examples/**"
black:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- uses: psf/black@stable
pytype:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Pytype Python Checker
# You may pin to the exact commit or the version.
# uses: theahura/pytype-action@38cf548b60f6da64118a1d74e3277efcf533e1a2
uses: NOBLES5E/pytype-action@main
with:
args: -d import-error persia
pypi-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: recursive
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install Python packaging dependencies
run: |
python -m pip install --upgrade pip
cd persia && pip install build
- name: Build package
run: python -m build -s
- name: Publish a Python distribution to PyPI
if: github.ref == 'refs/heads/main' && !startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Publish package
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
wheel-publish:
strategy:
fail-fast: false
matrix:
cuda-version:
- "113"
- "111"
- "102"
use-cuda:
- "0"
- "1"
arch:
- x86_64
os:
- ubuntu-20.04
python-major-version:
- "3"
python-minor-version:
- "7"
- "8"
- "9"
exclude:
- use-cuda: "0"
cuda-version: "111"
- use-cuda: "0"
cuda-version: "113"
runs-on: ${{ matrix.os }}
env:
CIBW_BUILD: "${{ format('cp{0}{1}*', matrix.python-major-version, matrix.python-minor-version) || '*' }}"
CIBW_MANYLINUX_X86_64_IMAGE: "baguasys/manylinux-cuda:${{ matrix.cuda-version }}"
CIBW_ARCHS_LINUX: "${{ matrix.arch || 'auto' }}"
CIBW_ENVIRONMENT: 'AUDITWHEEL_PLAT="manylinux2014_${{ matrix.arch }}" PERSIA_CUDA_VERSION="${{ matrix.cuda-version }}" USE_CUDA="${{ matrix.use-cuda }}"'
CIBW_REPAIR_WHEEL_COMMAND: "auditwheel show {wheel} && auditwheel repair -w {dest_dir} {wheel}"
CIBW_BEFORE_BUILD: "pip install git+https://github.com/rossant/auditwheel.git@include-exclude"
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: recursive
- name: setup python
uses: actions/setup-python@v2
with:
python-version: ${{ format('{0}.{1}', matrix.python-major-version, matrix.python-minor-version) }}
architecture: "x64"
- name: install dependencies
run: |
pip install --upgrade setuptools pip wheel
pip install cibuildwheel==2.1.3
- name: show environment
run: |
pip freeze
- name: list target wheels
run: |
python -m cibuildwheel . --print-build-identifiers
- name: build wheels
run: |
python -m cibuildwheel .
- uses: actions/upload-artifact@v2
with:
name: wheels-package
path: "wheelhouse/*"
if-no-files-found: error
- name: Publish a Python distribution to PyPI
if: github.ref == 'refs/heads/main' && !startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
packages_dir: wheelhouse/
verbose: true
skip_existing: true
- name: Publish package
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
packages_dir: wheelhouse/
verbose: true