forked from cellml/libcellml
-
Notifications
You must be signed in to change notification settings - Fork 0
129 lines (115 loc) · 4.21 KB
/
testing-pypi-upload.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
name: test-upload-to-pypi
on:
push:
env:
BUILD_TYPE: Release
MACOSX_DEPLOYMENT_TARGET: 10.15
jobs:
wheels:
name: ${{ matrix.name }} ${{ matrix.py }} wheel
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-13, ubuntu-20.04, windows-2019]
py: ['3.9']
include:
- name: 'Windows'
os: windows-2019
- name: 'Linux'
os: ubuntu-20.04
- name: 'macOS'
os: macos-13
exclude:
- os: macos-13
py: '3.7'
- os: ubuntu-20.04
py: '3.7'
steps:
- name: Check out libCellML
uses: actions/checkout@v4
with:
ref: ${{ github.event.release.tag_name }}
- name: Setup for cibuildwheel
id: setup
shell: bash
run: |
mkdir src/bindings/python/libcellml
cp src/bindings/python/README.rst src/bindings/python/libcellml/README.rst
mv src/bindings/python/cibuildwheel.setup.py src/bindings/python/setup.py
v=${{ matrix.py }}
echo "Setting tag as: tag=${GITHUB_REF#refs/tags/}"
echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
echo "Setting build as: build=cp${v/./}-*"
echo "build=cp${v/./}-*" >> $GITHUB_OUTPUT
if [[ "macOS" == "${{ matrix.name }}" ]]; then
if [[ "${{ matrix.py }}" == "3.8" ]]; then
echo "Setting macos_archs as: macos_archs='x86_64'"
echo "macos_archs=x86_64" >> $GITHUB_OUTPUT
echo "macos_deployment_target=10.15" >> $GITHUB_OUTPUT
else
echo "Setting macos_archs as: macos_archs='x86_64 arm64'"
echo 'macos_archs=x86_64 arm64' >> $GITHUB_OUTPUT
echo "macos_deployment_target=11.0" >> $GITHUB_OUTPUT
fi
else
echo "Setting macos_archs as: macos_archs='x86_64'"
echo "macos_archs=x86_64" >> $GITHUB_OUTPUT
fi
- name: Configure MSVC (Windows)
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
- name: Install SWIG (macOS)
if: runner.os == 'macOS'
run: brew install swig
- name: Build wheels
uses: pypa/[email protected]
env:
#CIBW_BUILD_VERBOSITY: 1
CIBW_ARCHS: auto64
CIBW_ARCHS_MACOS: ${{ steps.setup.outputs.macos_archs }}
CIBW_BUILD: ${{ steps.setup.outputs.build }}
CIBW_TEST_SKIP: "*_arm64"
CIBW_BEFORE_ALL_LINUX: yum install -y libxml2-devel || (apk add libxml2-dev && rm /usr/lib/cmake/libxml2/libxml2-config.cmake)
CIBW_BEFORE_ALL_WINDOWS: cd src/bindings/python && cmake -S wheel_dependencies -B build-wheel_dependencies -G Ninja && cd build-wheel_dependencies && ninja
CIBW_ENVIRONMENT: >
LIBCELLML_VERSION_TAG=${{ steps.setup.outputs.tag }}
MACOSX_DEPLOYMENT_TARGET=${{ steps.setup.outputs.macos_deployment_target }}
CIBW_REPAIR_WHEEL_COMMAND_MACOS: ""
CIBW_BEFORE_BUILD_LINUX: pip install renamewheel
CIBW_REPAIR_WHEEL_COMMAND_LINUX: renamewheel -w {dest_dir} {wheel}
with:
output-dir: wheelhouse
package-dir: src/bindings/python/
- name: Upload Python wheels as artifacts
uses: actions/upload-artifact@v4
with:
path: ./wheelhouse/*.whl
name: ${{ matrix.name }}-${{ matrix.py }}-wheel
retention-days: 7
publish-wheels:
# if: needs.setup-jobs.outputs.binaries-destination == 'Publish'
needs: wheels
runs-on: ubuntu-22.04
timeout-minutes: 5 # Docker+network are slow sometimes.
permissions:
id-token: write
name: Publish Wheels
steps:
- name: Download Python wheel artifacts
uses: actions/download-artifact@v4
with:
path: wheelhouse/
pattern: *-wheel
merge-multiple: true
- name: Display structure of downloaded files
run: |
ls -R
ls -R wheelhouse
- name: Publish Python wheels
env:
name: pypi
url: https://pypi.org/p/libcellml
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: ./wheelhouse/