-
Notifications
You must be signed in to change notification settings - Fork 0
202 lines (163 loc) Β· 6.08 KB
/
release.yml
File metadata and controls
202 lines (163 loc) Β· 6.08 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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
name: Release
on:
push:
tags:
- '*'
workflow_dispatch:
inputs:
dry-run:
description: 'Perform a dry run (build packages but do not publish)'
type: boolean
default: false
jobs:
build-htty-core-wheels:
strategy:
fail-fast: false
matrix:
include:
# Linux builds
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
# macOS builds
- os: macos-13 # Intel
target: x86_64-apple-darwin
- os: macos-latest # ARM64
target: aarch64-apple-darwin
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build htty-core wheel
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist --manifest-path htty-core/Cargo.toml
sccache: 'true'
manylinux: ${{ contains(matrix.target, 'linux') && '2_17' || 'auto' }}
- name: Setup Python 3.10
# Skip cross-compiled aarch64 builds on x86_64 runners
if: matrix.target != 'aarch64-unknown-linux-gnu'
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Test wheel installation (native builds only)
# Skip cross-compiled aarch64 builds on x86_64 runners
if: matrix.target != 'aarch64-unknown-linux-gnu'
run: |
echo "π§ͺ Testing htty-core wheel installation and functionality"
WHEEL_PATH=$(ls dist/*.whl | head -1)
WHEEL_NAME=$(basename "$WHEEL_PATH")
echo "π¦ Installing wheel: $WHEEL_NAME"
# Create a clean Python environment for testing wheel installation
python -m venv test_env
source test_env/bin/activate
# Install and test the wheel
pip install --force-reinstall --verbose "$WHEEL_PATH"
echo "π§ Testing Python import..."
python -c "import htty_core; print('β
htty_core import successful')"
echo "π§ Testing binary availability..."
python -c "import htty_core; print(f'β
Binary path: {htty_core.find_ht_binary()}')"
# Clean up
deactivate
rm -rf test_env
echo "π htty-core wheel testing complete!"
- name: Upload htty-core wheel
uses: actions/upload-artifact@v4
with:
name: htty-core-wheel-${{ matrix.target }}
path: "dist/*.whl"
build-htty-sdist:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Nix
uses: ./.github/actions/setup-nix
- name: Build htty source distribution
run: |
echo "π¦ Building htty source distribution"
nix build .#htty-sdist
# Copy sdist to dist directory
mkdir -p dist
cp result/*.tar.gz dist/
echo "π¦ Built source distribution:"
ls -la dist/
- name: Upload htty sdist
uses: actions/upload-artifact@v4
with:
name: htty-sdist
path: "dist/*.tar.gz"
publish-to-pypi:
needs: [build-htty-core-wheels, build-htty-sdist]
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write # For trusted publishing
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Nix
uses: ./.github/actions/setup-nix
- name: Create packages directory
run: mkdir -p packages/
- name: Download all htty-core wheels
uses: actions/download-artifact@v4
with:
pattern: htty-core-wheel-*
path: packages/
merge-multiple: true
- name: Download htty source distribution
uses: actions/download-artifact@v4
with:
name: htty-sdist
path: packages/
- name: Verify packages for publication
run: |
echo "π¦ Packages to be published:"
ls -la packages/
# Count packages
HTTY_CORE_WHEELS=$(ls packages/htty_core-*.whl 2>/dev/null | wc -l)
HTTY_SDIST=$(ls packages/htty-*.tar.gz 2>/dev/null | wc -l)
echo " htty-core wheels: $HTTY_CORE_WHEELS"
echo " htty source distributions: $HTTY_SDIST"
# Verify we have expected packages
if [ "$HTTY_CORE_WHEELS" -eq 0 ]; then
echo "β ERROR: No htty-core wheels found"
exit 1
fi
if [ "$HTTY_SDIST" -eq 0 ]; then
echo "β ERROR: No htty source distribution found"
exit 1
fi
# Expected: 4 htty-core wheels (x86_64-linux, aarch64-linux, x86_64-darwin, aarch64-darwin)
if [ "$HTTY_CORE_WHEELS" -ne 4 ]; then
echo "β οΈ WARNING: Expected 4 htty-core wheels, found $HTTY_CORE_WHEELS"
fi
# Expected: 1 htty source distribution
if [ "$HTTY_SDIST" -ne 1 ]; then
echo "β οΈ WARNING: Expected 1 htty source distribution, found $HTTY_SDIST"
fi
echo "β
Package verification complete"
# Show package details
echo "π Package details:"
for pkg in packages/*; do
echo " $(basename "$pkg") - $(ls -lh "$pkg" | awk '{print $5}')"
done
- name: Publish to PyPI
if: ${{ !inputs.dry-run }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: packages/
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Dry run complete
if: ${{ inputs.dry-run }}
run: |
echo "π Dry run complete - packages built but not published"
echo ""
echo "π¦ Built packages:"
ls -la packages/
echo ""
echo "To publish for real, create a release tag or run workflow without dry-run"