-
Notifications
You must be signed in to change notification settings - Fork 195
147 lines (119 loc) · 4.12 KB
/
python.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
name: Python CI/CD
on:
push:
branches: ['**']
tags-ignore: ['**']
pull_request:
release:
types:
- published
jobs:
build_sdist:
name: Build source distribution
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@master
- run: git fetch --prune --unshallow
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install pypa/build
run: pip install build
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential libace-dev swig
- name: Build sdist
run: python -m build --sdist --outdir dist/ scripts/pip
- name: Install sdist
run: pip -v install --use-feature=in-tree-build dist/yarp_middleware-*.tar.gz
- name: Test import
run: python -c 'import yarp; yarp.Bottle()'
- name: Remove external wheels
run: find dist/ -type f -not -name 'yarp_middleware-*' -delete -print
- name: Inspect dist folder
run: ls -lah dist/
- uses: actions/upload-artifact@v2
with:
name: dist
path: dist/*.tar.gz
build_wheels:
name: Build wheels [${{ matrix.os }}]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version:
- 3.8
os:
- ubuntu-20.04
#- macos-latest
#- windows-latest
steps:
- uses: actions/checkout@master
- run: git fetch --prune --unshallow
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install cibuildwheel
run: pip install cibuildwheel
- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse scripts/pip
env:
CIBW_BUILD_VERBOSITY: 1
CIBW_BUILD: cp37-manylinux_x86_64 cp38-manylinux_x86_64 cp39-manylinux_x86_64 cp310-manylinux_x86_64
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_24
CIBW_ENVIRONMENT_LINUX: "AUDITWHEEL_PLAT=manylinux_2_24_x86_64 CC=clang-7 CXX=clang++-7"
CIBW_BEFORE_ALL_LINUX: |
apt-get update &&\
apt-get install -y libace-dev libeigen3-dev &&\
# Use clang: http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1684
apt-get install -y clang-7
CIBW_TEST_COMMAND: "python -c 'import yarp; yarp.Bottle()'"
- name: Inspect wheelhouse folder
run: ls -lah wheelhouse/
- uses: actions/upload-artifact@v2
with:
name: dist
path: ./wheelhouse/*.whl
upload_pypi:
needs:
- build_sdist
- build_wheels
runs-on: ubuntu-latest
environment: pypi
# Master branch produces pre-releases.
# GitHub Releases 'vX.Y.Z' produce stable releases.
steps:
- uses: actions/download-artifact@v2
with:
name: dist
path: dist
- name: Inspect dist folder
run: ls -lah dist/
# Validate the tag accordingly to PEP440
# From https://stackoverflow.com/a/37972030/12150968
- name: Check PEP440 compliance
if: github.event_name == 'release'
run: |
sudo apt-get update
sudo apt-get install -y source-highlight
last_tag_with_v="$(git describe --abbrev=0 --tags)"
last_tag=${last_tag_with_v#v}
rel_regexp='^(\d+!)?(\d+)(\.\d+)+([\.\-\_])?((a(lpha)?|b(eta)?|c|r(c|ev)?|pre(view)?)\d*)?(\.?(post|dev)\d*)?$'
echo ""
echo $last_tag
echo ""
check-regexp ${rel_regexp} ${last_tag}
match=$(check-regexp ${rel_regexp} ${last_tag} | grep matches | cut -d ' ' -f 5)
test $match -eq 1 && true
- uses: pypa/gh-action-pypi-publish@master
if: |
github.repository == 'robotology/yarp' &&
((github.event_name == 'release' && github.event.action == 'published') ||
(github.event_name == 'push' && github.ref == 'refs/heads/master'))
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}