Skip to content

Commit 4df58ec

Browse files
authored
chore(build): fix build issues and improve MyPyC integration (#45)
Address build problems related to MyPyC and enhance the workflow for building and testing packages, including version tagging for MyPyC wheels. Adjustments to the testing matrix allow for more flexible testing configurations.
1 parent 74a866b commit 4df58ec

File tree

2 files changed

+128
-58
lines changed

2 files changed

+128
-58
lines changed

.github/workflows/publish.yml

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ jobs:
9191
- name: Set up Python ${{ matrix.python-version }}
9292
run: uv python install ${{ matrix.python-version }}
9393

94+
- name: Set version to include mypyc suffix
95+
run: |
96+
sed -i 's/version = "0.15.0"/version = "0.15.0+mypyc"/' pyproject.toml
97+
shell: bash
98+
9499
- name: Install dependencies with mypyc extras
95100
run: uv sync --extra mypyc --group build
96101

@@ -106,17 +111,6 @@ jobs:
106111
env:
107112
HATCH_BUILD_HOOKS_ENABLE: "1"
108113

109-
- name: Rename wheel with mypyc tag
110-
run: |
111-
for wheel in dist/*.whl; do
112-
if [[ -f "$wheel" ]]; then
113-
base=$(basename "$wheel" .whl)
114-
dir=$(dirname "$wheel")
115-
mv "$wheel" "$dir/${base}+mypyc.whl"
116-
fi
117-
done
118-
shell: bash
119-
120114
- name: Upload mypyc wheel artifacts
121115
uses: actions/upload-artifact@v4
122116
with:
@@ -179,6 +173,9 @@ jobs:
179173
url: https://pypi.org/project/sqlspec/
180174

181175
steps:
176+
- name: Install uv
177+
uses: astral-sh/setup-uv@v4
178+
182179
- name: Download all artifacts
183180
uses: actions/download-artifact@v4
184181
with:

.github/workflows/test-build.yml

Lines changed: 120 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -3,47 +3,58 @@ name: Test Build Configuration
33
on:
44
workflow_dispatch:
55
inputs:
6-
test_os:
7-
description: 'OS to test (or "all")'
6+
test_matrix:
7+
description: 'Test full matrix or subset'
88
required: false
9-
default: 'ubuntu-latest'
9+
default: 'subset'
1010
type: choice
1111
options:
12-
- 'all'
13-
- 'ubuntu-latest'
14-
- 'windows-latest'
15-
- 'macos-latest'
16-
- 'macos-13'
17-
test_python:
18-
description: 'Python version to test (or "all")'
19-
required: false
20-
default: '3.12'
21-
type: choice
22-
options:
23-
- 'all'
24-
- '3.9'
25-
- '3.10'
26-
- '3.11'
27-
- '3.12'
28-
- '3.13'
12+
- 'full'
13+
- 'subset'
2914
pull_request:
3015
paths:
3116
- '.github/workflows/publish.yml'
3217
- 'pyproject.toml'
3318

3419
jobs:
35-
test-standard-build:
36-
name: Test Std ${{ matrix.os }} py${{ matrix.python-version }}
20+
build-source:
21+
name: Build source distribution
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Check out repository
25+
uses: actions/checkout@v4
26+
27+
- name: Install uv
28+
uses: astral-sh/setup-uv@v4
29+
30+
- name: Set up Python
31+
run: uv python install 3.12
32+
33+
- name: Install dependencies
34+
run: uv sync --extra performance --group build
35+
36+
- name: Build source distribution
37+
run: uv build --sdist
38+
39+
- name: Upload source artifacts
40+
uses: actions/upload-artifact@v4
41+
with:
42+
name: source-dist
43+
path: dist/*.tar.gz
44+
45+
build-wheels-standard:
46+
name: Std ${{ matrix.os }} py${{ matrix.python-version }}
3747
strategy:
3848
fail-fast: false
3949
matrix:
40-
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
41-
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
50+
os: ${{ github.event.inputs.test_matrix == 'full' && fromJSON('["ubuntu-latest", "windows-latest", "macos-latest", "macos-13"]') || fromJSON('["ubuntu-latest"]') }}
51+
python-version: ${{ github.event.inputs.test_matrix == 'full' && fromJSON('["3.9", "3.10", "3.11", "3.12", "3.13"]') || fromJSON('["3.12"]') }}
4252
exclude:
4353
- os: macos-13
4454
python-version: "3.13"
4555
- os: windows-latest
4656
python-version: "3.9"
57+
4758
runs-on: ${{ matrix.os }}
4859
steps:
4960
- name: Check out repository
@@ -61,24 +72,25 @@ jobs:
6172
- name: Build standard wheel
6273
run: uv build --wheel
6374

64-
- name: Test wheel installation
65-
run: |
66-
uv venv test-env --python ${{ matrix.python-version }}
67-
uv pip install --python test-env --find-links dist/ sqlspec
68-
uv run --python test-env python -c "import sqlspec; print('Standard wheel test passed')"
75+
- name: Upload wheel artifacts
76+
uses: actions/upload-artifact@v4
77+
with:
78+
name: wheels-standard-${{ matrix.os }}-py${{ matrix.python-version }}
79+
path: dist/*.whl
6980

70-
test-mypyc-build:
71-
name: Test MyPyC ${{ matrix.os }} py${{ matrix.python-version }}
81+
build-wheels-mypyc:
82+
name: MyPyC ${{ matrix.os }} py${{ matrix.python-version }}
7283
strategy:
7384
fail-fast: false
7485
matrix:
75-
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
76-
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
86+
os: ${{ github.event.inputs.test_matrix == 'full' && fromJSON('["ubuntu-latest", "windows-latest", "macos-latest", "macos-13"]') || fromJSON('["ubuntu-latest"]') }}
87+
python-version: ${{ github.event.inputs.test_matrix == 'full' && fromJSON('["3.9", "3.10", "3.11", "3.12", "3.13"]') || fromJSON('["3.12"]') }}
7788
exclude:
7889
- os: windows-latest
7990
python-version: "3.9"
8091
- os: macos-13
8192
python-version: "3.13"
93+
8294
runs-on: ${{ matrix.os }}
8395
steps:
8496
- name: Check out repository
@@ -90,7 +102,12 @@ jobs:
90102
- name: Set up Python ${{ matrix.python-version }}
91103
run: uv python install ${{ matrix.python-version }}
92104

93-
- name: Install dependencies with mypyc
105+
- name: Set version to include mypyc suffix
106+
run: |
107+
sed -i 's/version = "0.15.0"/version = "0.15.0+mypyc"/' pyproject.toml
108+
shell: bash
109+
110+
- name: Install dependencies with mypyc extras
94111
run: uv sync --extra mypyc --group build
95112

96113
- name: Set up MyPyC environment variables
@@ -105,24 +122,80 @@ jobs:
105122
env:
106123
HATCH_BUILD_HOOKS_ENABLE: "1"
107124

108-
- name: Rename wheel with mypyc tag
125+
- name: Upload mypyc wheel artifacts
126+
uses: actions/upload-artifact@v4
127+
with:
128+
name: wheels-mypyc-${{ matrix.os }}-py${{ matrix.python-version }}
129+
path: dist/*.whl
130+
131+
test-wheels:
132+
name: Test ${{ matrix.os }} py${{ matrix.python-version }}
133+
needs: [build-wheels-standard, build-wheels-mypyc]
134+
strategy:
135+
fail-fast: false
136+
matrix:
137+
os: ${{ github.event.inputs.test_matrix == 'full' && fromJSON('["ubuntu-latest", "windows-latest", "macos-latest"]') || fromJSON('["ubuntu-latest"]') }}
138+
python-version: ${{ github.event.inputs.test_matrix == 'full' && fromJSON('["3.10", "3.12"]') || fromJSON('["3.12"]') }}
139+
140+
runs-on: ${{ matrix.os }}
141+
steps:
142+
- name: Check out repository
143+
uses: actions/checkout@v4
144+
145+
- name: Install uv
146+
uses: astral-sh/setup-uv@v4
147+
148+
- name: Set up Python ${{ matrix.python-version }}
149+
run: uv python install ${{ matrix.python-version }}
150+
151+
- name: Download standard wheel artifacts
152+
uses: actions/download-artifact@v4
153+
with:
154+
name: wheels-standard-${{ matrix.os }}-py${{ matrix.python-version }}
155+
path: dist-standard/
156+
157+
- name: Download mypyc wheel artifacts
158+
uses: actions/download-artifact@v4
159+
with:
160+
name: wheels-mypyc-${{ matrix.os }}-py${{ matrix.python-version }}
161+
path: dist-mypyc/
162+
163+
- name: Test standard wheel installation
109164
run: |
110-
for wheel in dist/*.whl; do
111-
if [[ -f "$wheel" ]]; then
112-
base=$(basename "$wheel" .whl)
113-
dir=$(dirname "$wheel")
114-
mv "$wheel" "$dir/${base}+mypyc.whl"
115-
fi
116-
done
117-
shell: bash
165+
uv venv test-standard --python ${{ matrix.python-version }}
166+
uv pip install --python test-standard --find-links dist-standard/ sqlspec
167+
uv run --python test-standard python -c "import sqlspec; print('Standard wheel OK')"
118168
119169
- name: Test mypyc wheel installation
120170
run: |
121-
uv venv test-env --python ${{ matrix.python-version }}
122-
uv pip install --python test-env --find-links dist/ sqlspec
123-
uv run --python test-env python -c "import sqlspec; print('MyPyC wheel test passed')"
171+
uv venv test-mypyc --python ${{ matrix.python-version }}
172+
uv pip install --python test-mypyc --find-links dist-mypyc/ sqlspec
173+
uv run --python test-mypyc python -c "import sqlspec; print('MyPyC wheel OK')"
174+
175+
verify-packages:
176+
name: Verify package integrity
177+
needs: [build-source, build-wheels-standard, build-wheels-mypyc]
178+
runs-on: ubuntu-latest
179+
steps:
180+
- name: Install uv
181+
uses: astral-sh/setup-uv@v4
182+
183+
- name: Download all artifacts
184+
uses: actions/download-artifact@v4
185+
with:
186+
pattern: "*"
187+
merge-multiple: true
188+
path: dist/
189+
190+
- name: List all built packages
191+
run: |
192+
echo "=== All built packages ==="
193+
find dist/ -name "*.whl" -o -name "*.tar.gz" | sort
194+
echo "=== Package count ==="
195+
find dist/ -name "*.whl" | wc -l
196+
find dist/ -name "*.tar.gz" | wc -l
124197
125-
- name: Verify wheel integrity
198+
- name: Verify package integrity
126199
run: |
127200
uv tool install twine
128201
uv tool run twine check dist/*

0 commit comments

Comments
 (0)