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,108 @@ 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 : dist-basemap-sdist
67
+
68
+ build_wheels :
69
+ name : Build basemap wheels
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 data packages
84
+ uses : actions/download-artifact@v4
85
+ with :
86
+ pattern : dist-basemap_data*
87
+ path : ./data_packages/
88
+ merge-multiple : true
89
+
90
+ - name : Install data packages (Linux/macOS)
91
+ if : runner.os != 'Windows'
92
+ shell : bash
93
+ run : |
94
+ # Install the wheel data packages with wildcard
95
+ python -m pip install ./data_packages/*.whl
96
+
97
+ # Verify that the data packages can be imported
98
+ python -c "import mpl_toolkits.basemap_data; print('mpl_toolkits.basemap_data installed successfully')"
99
+
100
+ - name : Install data packages (Windows)
101
+ if : runner.os == 'Windows'
102
+ shell : pwsh
103
+ run : |
104
+ # Install the wheel data packages sequentially
105
+ $wheels = Get-ChildItem -Path "./data_packages" -Filter "*.whl" -Recurse
106
+ foreach ($wheel in $wheels) {
107
+ Write-Host "Installing $($wheel.FullName)"
108
+ python -m pip install $wheel.FullName
109
+ }
110
+
111
+ # Verify that the data packages can be imported
112
+ python -c "import mpl_toolkits.basemap_data; print('mpl_toolkits.basemap_data installed successfully')"
113
+
114
+ - name : Download basemap sdist
115
+ uses : actions/download-artifact@v4
116
+ with :
117
+ name : dist-basemap-sdist
118
+ path : ./sdist/
119
+
120
+ - name : Extract sdist (Linux/macOS)
121
+ if : runner.os != 'Windows'
122
+ shell : bash
123
+ run : |
124
+ # Create extraction directory in the workspace
125
+ mkdir -p ./sdist_extract
126
+
127
+ # Extract with tar using wildcard
128
+ tar -xvf ./sdist/*.tar.gz -C ./sdist_extract
129
+
130
+ # Get the extracted directory name
131
+ EXTRACTED_DIR="$(ls -d ./sdist_extract/*/ | head -1)"
132
+
133
+ # Verify contents
134
+ ls -la "${EXTRACTED_DIR}"
135
+
136
+ # Set the environment variable
137
+ echo "SDIST_DIR=$(pwd)/${EXTRACTED_DIR}" >> $GITHUB_ENV
138
+
139
+ - name : Extract sdist (Windows)
140
+ if : runner.os == 'Windows'
141
+ shell : pwsh
142
+ run : |
143
+ # Create extraction directory in the workspace
144
+ New-Item -ItemType Directory -Force -Path "sdist_extract"
145
+
146
+ # Extract with tar using the specific file path (no wildcard)
147
+ $tarball = Get-ChildItem -Path "sdist" -Filter "*.tar.gz" | Select-Object -First 1
148
+ tar -xvf $tarball.FullName -C "sdist_extract"
149
+
150
+ # Get the extracted directory name
151
+ $extractedDir = (Get-ChildItem -Path "sdist_extract" -Directory | Select-Object -First 1).FullName
152
+
153
+ # Verify contents
154
+ Get-ChildItem "$extractedDir"
155
+
156
+ # Set the environment variable
157
+ echo "SDIST_DIR=$extractedDir" | Out-File -FilePath $env:GITHUB_ENV -Append
158
+
159
+ - name : Build wheels from sdist
69
160
70
161
env :
71
162
CIBW_ARCHS : " native"
@@ -85,19 +176,22 @@ jobs:
85
176
# LD_LIBRARY_PATH in environment is needed by
86
177
# auditwheel (Linux) and delocate (MacOS).
87
178
with :
88
- package-dir : " packages/basemap"
89
- output-dir : " packages/basemap/dist"
179
+ package-dir : ${{ env.SDIST_DIR }}
180
+ output-dir : " dist"
181
+ # Set `package-dir` to a folder with the extracted sdist;
182
+ # otherwise, `cibuildwheel` uses `python -m pip wheel` or
183
+ # `python -m build --wheel` with the repository package
184
+ # folder and we cannot guarantee that wheels can be built
185
+ # from the sdist.
90
186
91
187
- uses : actions/upload-artifact@v4
92
188
with :
93
- path : |
94
- packages/basemap/dist/*.tar.gz
95
- packages/basemap/dist/*.whl
96
- name : dist-basemap-${{ matrix.os }}
189
+ path : dist/*.whl
190
+ name : dist-basemap-wheels-${{ matrix.os }}
97
191
98
192
check :
99
193
name : Check packages
100
- needs : [build_data, build_basemap ]
194
+ needs : [build_data, build_sdist, build_wheels ]
101
195
runs-on : ubuntu-22.04
102
196
steps :
103
197
- uses : actions/download-artifact@v4
@@ -119,7 +213,7 @@ jobs:
119
213
120
214
upload :
121
215
name : Upload packages
122
- needs : [build_data, build_basemap , check]
216
+ needs : [build_data, build_sdist, build_wheels , check]
123
217
runs-on : ubuntu-22.04
124
218
environment : PyPI
125
219
if : github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
0 commit comments