ci: 添加构建 Libtorrent 轮子的 GitHub Actions 工作流 #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Libtorrent Wheel | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: windows-latest | |
strategy: | |
matrix: | |
python-version: [3.11] | |
include: | |
- python-version: 3.11 | |
architecture: x64 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
architecture: ${{ matrix.architecture }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install cmake b2 setuptools wheel | |
- name: Install Boost and Libtorrent dependencies | |
run: | | |
choco install boost-msvc-14.2 --version=1.75.0 | |
choco install boost-python --version=1.75.0 | |
- name: Build Libtorrent | |
run: | | |
git clone --recurse-submodules https://github.com/arvidn/libtorrent.git | |
cd libtorrent | |
b2 -j4 | |
- name: Build Python Bindings | |
run: | | |
cd libtorrent | |
python setup.py build_ext | |
- name: Create Wheel | |
run: | | |
cd libtorrent | |
python setup.py bdist_wheel | |
- name: Upload wheel to GitHub Actions artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: libtorrent-wheel | |
path: libtorrent/dist/*.whl |