-
Notifications
You must be signed in to change notification settings - Fork 7
185 lines (153 loc) · 5.69 KB
/
Copy pathbuild_wheels.yml
File metadata and controls
185 lines (153 loc) · 5.69 KB
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
name: Build and Publish Wheels
on: [workflow_dispatch]
env:
USING_PYTHON_VERSION: '3.13.9'
jobs:
prepare:
runs-on: tenki-standard-autoscale
outputs:
LATEST_TDLIB_VERSION: ${{ steps.vars.outputs.LATEST_TDLIB_VERSION }}
LATEST_TDLIB_COMMIT_HASH: ${{ steps.vars.outputs.LATEST_TDLIB_COMMIT_HASH }}
PYPI_RELEASE_VERSION: ${{ steps.vars.outputs.PYPI_RELEASE_VERSION }}
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.USING_PYTHON_VERSION }}
- name: Install dependencies
run: python -m pip install --upgrade packaging requests
- name: Fetch TDLib version and commit hash
id: vars
run: |
LATEST_TDLIB_COMMIT_HASH=$(curl -s "https://api.github.com/repos/tdlib/td/commits/master" | grep -oP '"sha": "\K[^"]+' | head -1)
LATEST_TDLIB_VERSION=$(curl -s "https://raw.githubusercontent.com/tdlib/td/$LATEST_TDLIB_COMMIT_HASH/CMakeLists.txt" | grep -oP 'project\(TDLib VERSION \K[0-9\.]+')
PYPI_RELEASE_VERSION=$(python next_version.py $LATEST_TDLIB_VERSION)
echo "LATEST_TDLIB_COMMIT_HASH=$LATEST_TDLIB_COMMIT_HASH" >> $GITHUB_OUTPUT
echo "LATEST_TDLIB_VERSION=$LATEST_TDLIB_VERSION" >> $GITHUB_OUTPUT
echo "PYPI_RELEASE_VERSION=$PYPI_RELEASE_VERSION" >> $GITHUB_OUTPUT
- name: Apply version changes
run: |
LATEST_TDLIB_VERSION=${{ steps.vars.outputs.LATEST_TDLIB_VERSION }}
PYPI_RELEASE_VERSION=${{ steps.vars.outputs.PYPI_RELEASE_VERSION }}
sed -i -r "s/^__version__ = \".*\"/__version__ = \"$PYPI_RELEASE_VERSION\"/" tdjson/_version.py
sed -i -r "s|(https://img.shields.io/badge/TDLib-v)[0-9\.]+(-blue)|\\1$LATEST_TDLIB_VERSION\\2|" README.md
- name: Upload updated files
uses: actions/upload-artifact@v4
with:
name: updated-files
path: |
tdjson/_version.py
README.md
linux-build:
needs: prepare
strategy:
matrix:
runner: [tenki-standard-autoscale, ubuntu-24.04-arm]
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4
- name: Download updated files
uses: actions/download-artifact@v4
with:
name: updated-files
path: .
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.USING_PYTHON_VERSION }}
- name: Install dependencies
run: python -m pip install --upgrade scikit-build-core nanobind build ninja cibuildwheel auditwheel
- name: Build wheels
run: |
mkdir -p ./wheelhouse
python -m cibuildwheel . --output-dir ./wheelhouse
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.runner }}
path: ./wheelhouse/*.whl
windows-build:
needs: prepare
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
- name: Download updated files
uses: actions/download-artifact@v4
with:
name: updated-files
path: .
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.USING_PYTHON_VERSION }}
- name: Install Python dependencies
shell: bash
run: python -m pip install --upgrade cibuildwheel
- name: Build TDLib
shell: bash
run: |
git clone --depth 1 https://github.com/tdlib/td.git
cd td
cat << EOF > vcpkg.json
{
"dependencies": [ "gperf", "openssl", "zlib" ],
"builtin-baseline": "afb2279ad78a7c29b5293d989b9a1a2ca00000cf",
"overrides": [
{ "name": "openssl", "version": "1.1.1m" }
]
}
EOF
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.bat
cd ..
rm -rf build
mkdir build
cd build
cmake -A x64 -DCMAKE_INSTALL_PREFIX:PATH=../tdlib -DCMAKE_TOOLCHAIN_FILE:FILEPATH=../vcpkg/scripts/buildsystems/vcpkg.cmake ..
cmake --build . --target install --config Release -j3
cd ..
cd ..
ls -l td/tdlib
echo "${{ github.workspace }}/td/tdlib/bin" >> $GITHUB_PATH
- name: Build wheels
shell: bash
env:
CMAKE_PREFIX_PATH: ${{ github.workspace }}/td/tdlib
run: |
mkdir -p ./wheelhouse
python -m cibuildwheel . --output-dir ./wheelhouse
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-windows
path: ./wheelhouse/*.whl
publish:
needs: [prepare, linux-build, windows-build]
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v4
- name: Download all wheels
uses: actions/download-artifact@v4
with:
pattern: wheels-*
merge-multiple: true
path: ./dist
- name: Download updated files
uses: actions/download-artifact@v4
with:
name: updated-files
path: .
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
- name: Commit updated files
uses: EndBug/add-and-commit@v9
with:
message: "Update TDLib to ${{ needs.prepare.outputs.LATEST_TDLIB_VERSION }} (tdlib/td@${{ needs.prepare.outputs.LATEST_TDLIB_COMMIT_HASH }})"
add: '["README.md", "tdjson/_version.py"]'
committer_name: GitHub Actions
committer_email: 41898282+github-actions[bot]@users.noreply.github.com