-
Notifications
You must be signed in to change notification settings - Fork 68
142 lines (118 loc) · 3.66 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
name: Python CI/CD
on:
push:
branches: [ '**' ]
tags-ignore: [ '**' ]
pull_request:
workflow_dispatch:
release:
types:
- published
schedule:
# * is a special character in YAML so you have to quote this string
# Execute a "weekly" build at 2 AM UTC on Thursday
- cron: '0 2 * * *'
jobs:
# sdist can be built from any os and against any python version
build_sdist:
name: Build source distribution
runs-on: ubuntu-22.04
strategy:
matrix:
python-version:
- "3.10"
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
coinor-libipopt-dev \
libeigen3-dev \
swig \
libxml2-dev \
libassimp-dev \
libirrlicht-dev \
libglfw3-dev
pip install build
- name: Build sdist
run: python -m build --sdist
- name: Install sdist
run: pip -v install dist/*.tar.gz
- name: Test import
run: python -c 'import idyntree.bindings'
- uses: actions/upload-artifact@v4
with:
name: sdist
path: dist/*.tar.gz
build_wheels:
name: Build wheels [${{ matrix.os }}]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version:
- "3.10"
os:
- ubuntu-22.04
#- macos-latest
#- windows-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install cibuildwheel
run: pip install cibuildwheel
- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_BUILD_VERBOSITY: 1
CIBW_BUILD: cp39-*manylinux*_x86_64 cp310-*manylinux*_x86_64 cp311-*manylinux*_x86_64 cp312-*manylinux*_x86_64
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
CIBW_ENVIRONMENT_LINUX: AUDITWHEEL_PLAT=manylinux_2_28_x86_64
CIBW_BEFORE_BUILD_LINUX: |
# workaround for https://almalinux.org/blog/2023-12-20-almalinux-8-key-update/
rpm --import https://repo.almalinux.org/almalinux/RPM-GPG-KEY-AlmaLinux &&\
dnf update -y &&\
dnf install -y eigen3-devel libxml2-devel
# Pre-install NumPy > 2.0
pip install "numpy>=2.0.0"
CIBW_TEST_COMMAND: "python -c 'import idyntree.bindings'"
- uses: actions/upload-artifact@v4
with:
name: wheels
path: ./wheelhouse/*.whl
upload_pypi:
needs:
- build_sdist
- build_wheels
runs-on: ubuntu-latest
permissions:
id-token: write
# Devel branch produces pre-releases.
# Master branch produces stable releases linked to GitHub releases.
steps:
- uses: actions/download-artifact@v4
- name: Move sdist and wheels
run: |
mkdir -p dist/
mv sdist/* dist/
mv wheels/* dist/
- name: Inspect dist folder
run: ls -lah dist/
- uses: pypa/gh-action-pypi-publish@release/v1
if: |
github.repository == 'robotology/idyntree' &&
((github.event_name == 'release' && github.event.action == 'published') ||
(github.event_name == 'push' && github.ref == 'refs/heads/devel'))