-
Notifications
You must be signed in to change notification settings - Fork 1
174 lines (153 loc) · 5.57 KB
/
release.yml
File metadata and controls
174 lines (153 loc) · 5.57 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
name: Release
on:
push:
tags: ['v*']
jobs:
# Configuration - Edit this section to enable/disable tests
config:
name: Configuration
runs-on: ubuntu-latest
outputs:
run-tests: ${{ steps.config.outputs.run-tests }}
os-matrix: ${{ steps.config.outputs.os-matrix }}
python-matrix: ${{ steps.config.outputs.python-matrix }}
steps:
- id: config
run: |
# Set to 'true' to run tests before building wheels, 'false' to skip tests
echo "run-tests=false" >> $GITHUB_OUTPUT
# Test matrix configuration (only used if run-tests is 'true')
echo 'os-matrix=["ubuntu-latest", "macos-latest", "windows-latest"]' >> $GITHUB_OUTPUT
echo 'python-matrix=["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]' >> $GITHUB_OUTPUT
test:
name: Run Tests
needs: config
if: needs.config.outputs.run-tests == 'true'
uses: ./.github/workflows/_test.yml
with:
os-matrix: ${{ needs.config.outputs.os-matrix }}
python-matrix: ${{ needs.config.outputs.python-matrix }}
primary-os: "ubuntu-latest"
primary-python: "3.11"
secrets: inherit
# Build wheels for each platform in parallel
build-windows:
name: Build Windows Wheels
needs: [config, test]
if: always() && (needs.test.result == 'success' || needs.test.result == 'skipped')
uses: ./.github/workflows/_build_windows.yml
build-linux-x86_64:
name: Build Linux x86_64 Wheels
needs: [config, test]
if: always() && (needs.test.result == 'success' || needs.test.result == 'skipped')
uses: ./.github/workflows/_build_linux_x86_64.yml
build-linux-aarch64:
name: Build Linux aarch64 Wheels
needs: [config, test]
if: always() && (needs.test.result == 'success' || needs.test.result == 'skipped')
uses: ./.github/workflows/_build_linux_aarch64.yml
build-macos:
name: Build macOS Wheels
needs: [config, test]
if: always() && (needs.test.result == 'success' || needs.test.result == 'skipped')
uses: ./.github/workflows/_build_macos.yml
publish:
name: Publish Release
needs: [build-windows, build-linux-x86_64, build-linux-aarch64, build-macos]
if: always() && startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
environment:
name: PYPI_RELEASE
url: https://pypi.org/project/httpmorph/
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v4
- name: Download wheels
uses: actions/download-artifact@v4
with:
path: dist/
pattern: wheels-*
merge-multiple: false
continue-on-error: true
- name: Flatten wheels and report build status
run: |
mkdir -p wheels
# Check which platforms built successfully
echo "===================="
echo "Build Status Report"
echo "===================="
# Check Windows
if [ -d "dist/wheels-windows" ]; then
wheel_count=$(find "dist/wheels-windows" -name "*.whl" 2>/dev/null | wc -l)
if [ "$wheel_count" -gt 0 ]; then
echo "✅ Windows: $wheel_count wheels built"
else
echo "❌ Windows: No wheels found"
fi
else
echo "❌ Windows: Build failed or artifacts missing"
fi
# Check Linux (both architectures)
linux_x86_64_count=0
linux_aarch64_count=0
if [ -d "dist/wheels-linux-x86_64" ]; then
linux_x86_64_count=$(find "dist/wheels-linux-x86_64" -name "*.whl" 2>/dev/null | wc -l)
fi
if [ -d "dist/wheels-linux-aarch64" ]; then
linux_aarch64_count=$(find "dist/wheels-linux-aarch64" -name "*.whl" 2>/dev/null | wc -l)
fi
linux_total=$((linux_x86_64_count + linux_aarch64_count))
if [ "$linux_total" -gt 0 ]; then
echo "✅ Linux: $linux_total wheels built (x86_64: $linux_x86_64_count, aarch64: $linux_aarch64_count)"
else
echo "❌ Linux: No wheels found"
fi
# Check macOS
if [ -d "dist/wheels-macos" ]; then
wheel_count=$(find "dist/wheels-macos" -name "*.whl" 2>/dev/null | wc -l)
if [ "$wheel_count" -gt 0 ]; then
echo "✅ macOS: $wheel_count wheels built"
else
echo "❌ macOS: No wheels found"
fi
else
echo "❌ macOS: Build failed or artifacts missing"
fi
echo "===================="
# Flatten all available wheels
find dist/ -name "*.whl" -exec cp {} wheels/ \; 2>/dev/null || true
# List wheels
if [ -n "$(ls -A wheels/)" ]; then
echo ""
echo "Available wheels:"
ls -lh wheels/
echo ""
echo "Total: $(ls wheels/*.whl 2>/dev/null | wc -l) wheels"
else
echo ""
echo "⚠️ No wheels available for release"
exit 1
fi
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
files: wheels/*.whl
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
pip install twine
if [ -n "$TWINE_PASSWORD" ]; then
echo "Publishing to PyPI..."
twine upload wheels/*.whl --skip-existing --verbose
else
echo "⚠️ PYPI_API_TOKEN not set - skipping PyPI upload"
echo "To publish to PyPI, add PYPI_API_TOKEN to the PYPI_RELEASE environment secrets"
fi
shell: bash