-
-
Notifications
You must be signed in to change notification settings - Fork 26
155 lines (130 loc) · 4.3 KB
/
wheel.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
name: Wheel
on:
push:
branches:
- main
tags:
- '*'
workflow_dispatch:
permissions: read-all
jobs:
build_wheels_windows:
name: Build Wheels for Python ${{ matrix.python }} on Windows
strategy:
fail-fast: false
matrix:
python: [ "3.9", "3.10", "3.11", "3.12", "3.13" ]
runs-on: windows-2019
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
cache: 'pip'
allow-prereleases: true
- name: Set up MSVC
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x86_64
- name: Set up CMake and Ninja
uses: lukka/get-cmake@latest
- name: Build Wheels
run: |
python -m pip install -U pip
pip install wheel
python -m pip wheel . --no-deps --wheel-dir=dist --verbose
- name: Test Wheels
run: |
pip install pytest
Get-ChildItem ./dist/ -Filter *-win_amd64.whl | ForEach-Object {
pip install $_.FullName
}
pytest python/tests
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: endstone-wheels-windows-python${{ matrix.python }}
path: dist/*-win_amd64.whl
build_wheels_linux:
name: Build Wheels for Python ${{ matrix.python }} on Ubuntu
strategy:
fail-fast: false
matrix:
python: [ "3.9", "3.10", "3.11", "3.12", "3.13" ]
runs-on: ubuntu-latest
container:
image: node:16-buster-slim
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Dependencies
run: |
apt-get update
apt-get install -y lsb-release sudo
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
# cache: 'pip'
allow-prereleases: true
- name: Set up Clang 15
env:
LLVM_VERSION: 15
run: |
sudo apt-get update -y -q
sudo apt-get install -y -q build-essential lsb-release wget software-properties-common gnupg
sudo wget https://apt.llvm.org/llvm.sh
sudo chmod +x llvm.sh
sudo ./llvm.sh ${LLVM_VERSION}
sudo apt-get install -y -q libc++-${LLVM_VERSION}-dev libc++abi-${LLVM_VERSION}-dev
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${LLVM_VERSION} 100
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-${LLVM_VERSION} 100
sudo update-alternatives --install /usr/bin/llvm-cov llvm-cov /usr/bin/llvm-cov-${LLVM_VERSION} 100
sudo update-alternatives --install /usr/bin/ld ld /usr/bin/ld.lld-${LLVM_VERSION} 100
echo "CC=clang" >> $GITHUB_ENV
echo "CXX=clang++" >> $GITHUB_ENV
- name: Set up CMake and Ninja
uses: lukka/get-cmake@latest
- name: Build Wheels
run: |
python -m pip install -U pip
pip install wheel
python -m pip wheel . --no-deps --wheel-dir=wheelhouse --verbose
- name: Repair Wheels
run: |
pip install auditwheel setuptools "patchelf>=0.14"
python -m auditwheel --verbose repair --plat manylinux_2_31_x86_64 -w dist wheelhouse/*.whl
- name: Test Wheels
run: |
pip install pytest
pip install dist/*-manylinux_2_31_x86_64.whl
pytest python/tests
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: endstone-wheels-linux-python${{ matrix.python }}
path: dist/*-manylinux_2_31_x86_64.whl
publish:
name: Publish Wheels to PyPI
if: contains(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
needs: [ build_wheels_windows, build_wheels_linux ]
environment: pypi
permissions:
id-token: write
contents: write
steps:
- name: Restore Artifacts
uses: actions/download-artifact@v4
with:
pattern: endstone-wheels-*
path: dist
merge-multiple: true
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1