-
Notifications
You must be signed in to change notification settings - Fork 0
161 lines (127 loc) · 4.44 KB
/
python-publish.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
# This workflow will upload a Python Package to PyPI when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Build and Upload Python Package
on:
release:
types: [published]
push:
tags:
- "v*.*.*"
permissions:
contents: read
jobs:
linux-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Build on manylinux
run: |
docker run --rm \
-v ${{ github.workspace }}:/project \
-w /project \
quay.io/pypa/manylinux_2_28_x86_64 \
bash -c "
yum install -y patchelf
curl -L -o premake5.tar.gz https://github.com/premake/premake-core/releases/download/v5.0.0-alpha16/premake-5.0.0-alpha16-linux.tar.gz
tar -xvf premake5.tar.gz
mv premake5 /usr/local/bin/
cd PrjBarlib
premake5 gmake2 --python-include-path=/opt/python/cp313-cp313/include/python3.13 \
--python-version=3.13
cd build
make config=python Barlib
echo --DONE--
bash ../modules/python/make_package.sh Python /opt/python/cp313-cp313/bin/python3
mkdir -p /project/dist
/opt/python/cp313-cp313/bin/python3 -m pip install --upgrade auditwheel
auditwheel repair --plat manylinux_2_28_x86_64 ./Python/BarcodeProject/dist/*.whl -w /project/dist
# cp -rf ./Python/BarcodeProject/dist/* /project/dist/
"
- uses: actions/setup-python@v5
with:
python-version: "3.13"
# - name: Repair and validate wheel
# run: |
# python -m pip install --upgrade auditwheel
# auditwheel repair --plat manylinux_2_28_x86_64 -w dist dist/*.whl
# ls dist
- name: Upload distributions
uses: actions/upload-artifact@v4
with:
name: linux-dist
path: dist
windows-build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/setup-python@v5
id: cp313
with:
python-version: "3.13"
- name: Test Python vars
run: |
echo pythonLocation: ${{ env.pythonLocation }}
echo pythonLocation: ${{ steps.cp313.pythonLocation }}
# Cache the premmake5 binary
- uses: actions/cache@v3
with:
path: |
${{ github.workspace }}\.premake-build
key: ${{ runner.os }}-premake5
- name: setup-msbuild
uses: microsoft/setup-msbuild@v2
# install premmake5
- uses: Jarod42/install-premake5@v1
- name: Build library
run: |
cd PrjBarlib
premake5 vs2022 --python-include-path=${{ env.pythonLocation }}/include --python-lib-path=${{ env.pythonLocation }}/libs --python-version=3.13
cd build
msbuild /p:Configuration=python /p:Platform=x64 Barlib.vcxproj
- name: Make package
run: |
cd PrjBarlib/build
../modules/python/make_package.bat Python ${{ steps.cp313.outputs.python-path }}
xcopy Python\BarcodeProject\dist ..\..\dist /Q /E /Y /I
- name: Upload distributions
uses: actions/upload-artifact@v4
with:
name: windows-dist
path: ${{ github.workspace }}/dist
pypi-publish:
runs-on: ubuntu-latest
needs:
- linux-build
- windows-build
permissions:
id-token: write
environment:
name: pypi
url: https://pypi.org/project/ImageTopoDec
steps:
- name: Retrieve Linux distributions
uses: actions/download-artifact@v4
with:
name: linux-dist
path: dist
- name: Retrieve Windows distributions
uses: actions/download-artifact@v4
with:
name: windows-dist
path: dist
- name: Validate wheels
run: |
python -m pip install twine
twine check dist/*
- name: Publish release distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist