43
43
packages/${{ matrix.package }}/dist/*.whl
44
44
name : dist-${{ matrix.package }}
45
45
46
- build_basemap :
47
- name : Build basemap package (${{ matrix.os }})
48
- needs : [build_data]
49
- strategy :
50
- matrix :
51
- os : [ubuntu-22.04, windows-2019, macos-13, macos-14]
52
- runs-on : ${{ matrix.os }}
46
+ build_sdist :
47
+ name : Build basemap sdist
48
+ runs-on : ubuntu-22.04
53
49
steps :
54
50
- uses : actions/checkout@v4
55
51
@@ -59,13 +55,83 @@ jobs:
59
55
python-version : " 3.9"
60
56
61
57
- name : Build sdist
62
- if : matrix.os == 'ubuntu-22.04'
63
58
run : |
64
59
cd packages/basemap
65
60
python -m pip install build
66
61
python -m build --sdist
67
62
68
- - name : Build wheels
63
+ - uses : actions/upload-artifact@v4
64
+ with :
65
+ path : packages/basemap/dist/*.tar.gz
66
+ name : basemap-sdist
67
+
68
+ build_wheels :
69
+ name : Build wheels on ${{ matrix.os }}
70
+ needs : [build_data, build_sdist]
71
+ strategy :
72
+ matrix :
73
+ os : [ubuntu-22.04, windows-2019, macos-13, macos-14]
74
+ runs-on : ${{ matrix.os }}
75
+ steps :
76
+ - uses : actions/checkout@v4
77
+
78
+ - name : Set up Python
79
+ uses : actions/setup-python@v5
80
+ with :
81
+ python-version : " 3.9"
82
+
83
+ - name : Download basemap sdist
84
+ uses : actions/download-artifact@v4
85
+ with :
86
+ name : basemap-sdist
87
+ path : ./sdist/
88
+
89
+ - name : Extract sdist (Linux/macOS)
90
+ if : runner.os != 'Windows'
91
+ shell : bash
92
+ run : |
93
+ # Create extraction directory in the workspace
94
+ mkdir -p ./sdist_extract
95
+
96
+ # Extract using tar (Unix-style)
97
+ tar -xvf ./sdist/*.tar.gz -C ./sdist_extract
98
+
99
+ # Get the extracted directory name
100
+ EXTRACTED_DIR=$(ls -d ./sdist_extract/*/ | head -1)
101
+ echo "SDIST_DIR=$(pwd)/${EXTRACTED_DIR}" >> $GITHUB_ENV
102
+
103
+ # Verify contents
104
+ ls -la ${EXTRACTED_DIR}
105
+
106
+ - name : Extract sdist (Windows)
107
+ if : runner.os == 'Windows'
108
+ shell : pwsh
109
+ run : |
110
+ # Create extraction directory
111
+ New-Item -ItemType Directory -Force -Path "sdist_extract"
112
+
113
+ # Find the tarball file (without using wildcards)
114
+ $tarball = Get-ChildItem -Path "sdist" -Filter "*.tar.gz" | Select-Object -First 1
115
+
116
+ # Debug - show what we found
117
+ Write-Host "Found tarball: $($tarball.FullName)"
118
+
119
+ # Extract using the specific file path (not wildcard)
120
+ tar -xvf $tarball.FullName -C "sdist_extract"
121
+
122
+ # Get the extracted directory name
123
+ $extractedDir = (Get-ChildItem -Path "sdist_extract" -Directory | Select-Object -First 1).FullName
124
+
125
+ # Debug - show what we found
126
+ Write-Host "Extracted directory: $extractedDir"
127
+
128
+ # Set the environment variable
129
+ echo "SDIST_DIR=$extractedDir" | Out-File -FilePath $env:GITHUB_ENV -Append
130
+
131
+ # Verify contents
132
+ Get-ChildItem $extractedDir
133
+
134
+ - name : Build wheels from sdist
69
135
uses : pypa/cibuildwheel@v2.22.0
70
136
env :
71
137
CIBW_ARCHS : " native"
@@ -82,22 +148,18 @@ jobs:
82
148
PIP_PREFER_BINARY=1
83
149
PYTHONUNBUFFERED=1
84
150
LD_LIBRARY_PATH="${GEOS_DIR}/lib"
85
- # LD_LIBRARY_PATH in environment is needed by
86
- # auditwheel (Linux) and delocate (MacOS).
87
151
with :
88
- package-dir : " packages/basemap "
89
- output-dir : " packages/basemap/ dist"
152
+ package-dir : ${{ env.SDIST_DIR }} # Use extracted sdist
153
+ output-dir : " dist"
90
154
91
155
- uses : actions/upload-artifact@v4
92
156
with :
93
- path : |
94
- packages/basemap/dist/*.tar.gz
95
- packages/basemap/dist/*.whl
96
- name : dist-basemap-${{ matrix.os }}
157
+ path : dist/*.whl
158
+ name : dist-basemap-wheels-${{ matrix.os }}
97
159
98
160
check :
99
161
name : Check packages
100
- needs : [build_data, build_basemap ]
162
+ needs : [build_data, build_sdist, build_wheels ]
101
163
runs-on : ubuntu-22.04
102
164
steps :
103
165
- uses : actions/download-artifact@v4
@@ -106,6 +168,11 @@ jobs:
106
168
pattern : " dist-*"
107
169
merge-multiple : true
108
170
171
+ - uses : actions/download-artifact@v4
172
+ with :
173
+ path : dist
174
+ name : basemap-sdist
175
+
109
176
- name : Set up Python
110
177
uses : actions/setup-python@v5
111
178
with :
@@ -117,9 +184,20 @@ jobs:
117
184
python -m twine check dist/*.tar.gz
118
185
python -m twine check dist/*.whl
119
186
187
+ # Verification step to ensure sdist is complete
188
+ - name : Verify sdist can build wheel
189
+ run : |
190
+ python -m pip install build setuptools wheel
191
+ mkdir -p /tmp/sdist_test
192
+ tar -xvf dist/*.tar.gz -C /tmp/sdist_test
193
+ cd /tmp/sdist_test/*/
194
+ python -m pip install -e .
195
+ python -m build --wheel
196
+ ls -la dist/*.whl
197
+
120
198
upload :
121
199
name : Upload packages
122
- needs : [build_data, build_basemap , check]
200
+ needs : [build_data, build_sdist, build_wheels , check]
123
201
runs-on : ubuntu-22.04
124
202
environment : PyPI
125
203
if : github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
@@ -130,6 +208,11 @@ jobs:
130
208
pattern : " dist-*"
131
209
merge-multiple : true
132
210
211
+ - uses : actions/download-artifact@v4
212
+ with :
213
+ path : dist
214
+ name : basemap-sdist
215
+
133
216
- name : Publish to PyPI
134
217
uses : pypa/gh-action-pypi-publish@release/v1
135
218
with :
0 commit comments