-
Notifications
You must be signed in to change notification settings - Fork 3
121 lines (102 loc) · 3.44 KB
/
release.yml
File metadata and controls
121 lines (102 loc) · 3.44 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
name: Python package build and publish
on:
release:
types: [created]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Set up Python (Linux)
if: matrix.os == 'ubuntu-latest'
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Set up Python (Windows)
if: matrix.os == 'windows-latest'
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Add Rust to PATH
run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Install dependencies
run: |
python -m pip install pip
pip install cibuildwheel maturin twine cython
- name: Build wheels on Ubuntu
if: matrix.os == 'ubuntu-latest'
env:
CIBW_ARCHS: x86_64
# Install Rust inside the manylinux container.
CIBW_BEFORE_BUILD: "curl https://sh.rustup.rs -sSf | sh -s -- -y"
# Make sure Rust tools are on the PATH for the build.
CIBW_ENVIRONMENT: "PATH=/root/.cargo/bin:$PATH"
RUST_SUBPACKAGE_PATH: datamodel/rs_parsers
CIBW_BUILD: "cp3{10,11,12,13}-*" # Build for Python 3.10, 3.11, 3.12, 3.13
run: |
pip install --upgrade pip==25.0
pip install cibuildwheel
cibuildwheel --platform linux --output-dir dist
- name: Build wheels on Windows
if: matrix.os == 'windows-latest'
env:
CIBW_BUILD: "cp3{10,11,12,13}-*"
run: |
pip install cibuildwheel maturin
cibuildwheel --output-dir dist
- name: Upload wheel artifacts
uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}-py${{ matrix.python-version }}
path: dist/*.whl
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4.1.7
with:
path: dist
- name: Move wheel files to 'dist' directory
run: |
find dist -name '*.whl' -exec mv {} dist \;
- name: Build sdist
run: |
pip install build
python -m build --sdist --outdir dist
- name: Check for wheel types
id: check_wheels
run: |
echo "Checking for wheel types..."
if ls dist/*-manylinux*.whl 1> /dev/null 2>&1; then
echo "Found manylinux wheels."
echo "HAS_MANYLINUX_WHEELS=true" >> $GITHUB_ENV
fi
if ls dist/*-win_*.whl 1> /dev/null 2>&1; then
echo "Found Windows wheels."
echo "HAS_WINDOWS_WHEELS=true" >> $GITHUB_ENV
fi
- name: List files in dist
run: ls -l dist
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install twine
run: pip install twine
- name: Publish wheels and sdist to Production PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYTHON_DATAMODEL_PYPI_API_TOKEN }}
run: twine upload dist/*.whl dist/*.tar.gz || true