-
Notifications
You must be signed in to change notification settings - Fork 14
101 lines (86 loc) · 3.14 KB
/
pythonBinding.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
name: PythonBinding
on:
workflow_run:
workflows: [Windows]
types: [completed]
jobs:
build:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
container: ubuntu:latest
steps:
- uses: actions/checkout@v4
- name: Install python
run: |
apt-get update
export DEBIAN_FRONTEND=noninteractive
apt-get install -y python3.12 python3.12-venv python3-pip cython3
mkdir venv
python3.12 -m venv venv/
. venv/bin/activate
python3.12 -m pip install --upgrade pip
python3.12 -m pip install setuptools build cython twine
- name: Download Linux artifact
id: download-artifact-linux
uses: dawidd6/action-download-artifact@v7
with:
workflow: linux.yml
workflow_conclusion: success
if_no_artifact_found: fail
path: linux-artifact
- name: Download macOS artifact
id: download-artifact-macos
uses: dawidd6/action-download-artifact@v7
with:
workflow: macOS.yml
workflow_conclusion: success
if_no_artifact_found: fail
path: macOS-artifact
- name: Download Windows artifact
id: download-artifact-windows
uses: dawidd6/action-download-artifact@v7
with:
workflow: windows.yml
workflow_conclusion: success
if_no_artifact_found: fail
path: windows-artifact
- name: Copy files from artifacts
run: |
mkdir -p libraries/Linux
mkdir -p libraries/macOS
mkdir -p libraries/Windows
cp -r linux-artifact/libpointing/pointing/libpointing.a libraries/Linux/
cp -r macOS-artifact/artifact/pointing/libpointing.a libraries/macOS/
cp -r windows-artifact/artifact/pointing/release/pointing.lib libraries/Windows/
cp -r linux-artifact/libpointing/bindings/Python/cython/libpointing/*.so bindings/Python/cython/libpointing/
cp -r macOS-artifact/artifact/bindings/Python/cython/libpointing/*.so bindings/Python/cython/libpointing/
cp -r windows-artifact/artifact/bindings/Python/cython/libpointing/*.pyd bindings/Python/cython/libpointing/
- name: compile Python binding
run: |
. venv/bin/activate
cd bindings/Python/cython/
ls -la libpointing/
python3 -m build
ls -la dist/
cd ../../..
mkdir python
cp -r bindings/Python/cython/dist/*.whl python/
- name: Save the compiled libraries
uses: actions/upload-artifact@v4
with:
path: |
libraries/
python/
- name: Publish Python 🐍 distribution 📦 to PyPI
# if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
run : |
cat <<EOF > ~/.pypirc
[distutils]
index-servers =
libpointing
[libpointing]
repository = https://upload.pypi.org/legacy/
username = __token__
password = $PYPI_TOKEN
EOF
python3 -m twine upload python/*