Skip to content

Commit 0fe4496

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into fix-docs-shiftdata
2 parents 3acfbc7 + 6060315 commit 0fe4496

File tree

2 files changed

+200
-20
lines changed

2 files changed

+200
-20
lines changed

.github/workflows/build.yml

Lines changed: 193 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
run: |
3535
cd packages/${{ matrix.package }}
3636
python -m pip install build wheel
37-
python -m build --sdist --wheel
37+
python -m build
3838
3939
- uses: actions/upload-artifact@v4
4040
with:
@@ -43,13 +43,9 @@ jobs:
4343
packages/${{ matrix.package }}/dist/*.whl
4444
name: dist-${{ matrix.package }}
4545

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
5349
steps:
5450
- uses: actions/checkout@v4
5551

@@ -59,13 +55,108 @@ jobs:
5955
python-version: "3.9"
6056

6157
- name: Build sdist
62-
if: matrix.os == 'ubuntu-22.04'
6358
run: |
6459
cd packages/basemap
6560
python -m pip install build
6661
python -m build --sdist
6762
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
69160
uses: pypa/[email protected]
70161
env:
71162
CIBW_ARCHS: "native"
@@ -85,19 +176,22 @@ jobs:
85176
# LD_LIBRARY_PATH in environment is needed by
86177
# auditwheel (Linux) and delocate (MacOS).
87178
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.
90186

91187
- uses: actions/upload-artifact@v4
92188
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 }}
97191

98192
check:
99193
name: Check packages
100-
needs: [build_data, build_basemap]
194+
needs: [build_data, build_sdist, build_wheels]
101195
runs-on: ubuntu-22.04
102196
steps:
103197
- uses: actions/download-artifact@v4
@@ -117,9 +211,90 @@ jobs:
117211
python -m twine check dist/*.tar.gz
118212
python -m twine check dist/*.whl
119213
214+
docs:
215+
name: Build documentation
216+
needs: [build_wheels]
217+
runs-on: ubuntu-22.04
218+
steps:
219+
- uses: actions/checkout@v4
220+
221+
- name: Set up Python
222+
uses: actions/setup-python@v5
223+
with:
224+
python-version: "3.9"
225+
226+
- name: Download data packages
227+
uses: actions/download-artifact@v4
228+
with:
229+
path: ./data_packages/
230+
pattern: "dist-basemap_data*"
231+
merge-multiple: true
232+
233+
- name: Download basemap wheel for Linux
234+
uses: actions/download-artifact@v4
235+
with:
236+
path: ./wheels/
237+
pattern: "dist-basemap-wheels-ubuntu-*"
238+
merge-multiple: true
239+
240+
- name: Install packages
241+
run: |
242+
# Get Python version.
243+
IMPL=cp$(python -c "import sys; print('{0}{1}'.format(*sys.version_info[:2]))")
244+
245+
# Install basemap wheel matching current Python version.
246+
WHEEL=$(find ./wheels -name "*-${IMPL}-${IMPL}*.whl" | head -1)
247+
if [ -n "${WHEEL}" ]; then
248+
python -m pip install "${WHEEL}"
249+
else
250+
echo "No matching wheel found for ${IMPL}-${IMPL}"
251+
exit 1
252+
fi
253+
254+
# Install basemap data packages.
255+
python -m pip install ./data_packages/*.whl
256+
257+
- name: Install docs requirements
258+
run: |
259+
cd packages/basemap
260+
python -m pip install -r requirements-doc.txt
261+
262+
- name: Run sphinx
263+
run: |
264+
cd packages/basemap
265+
python -m sphinx doc/source public
266+
267+
- name: Upload docs artifacts
268+
uses: actions/upload-artifact@v4
269+
with:
270+
name: docs
271+
path: packages/basemap/public
272+
273+
- name: Upload github-pages artifact
274+
uses: actions/upload-pages-artifact@v3
275+
with:
276+
name: github-pages
277+
path: packages/basemap/public
278+
279+
pages:
280+
name: Deploy documentation
281+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
282+
needs: [docs, check]
283+
runs-on: ubuntu-22.04
284+
environment:
285+
name: github-pages
286+
url: ${{ steps.deployment.outputs.page_url }}
287+
permissions:
288+
pages: write
289+
id-token: write
290+
steps:
291+
- name: Deploy github-pages
292+
uses: actions/deploy-pages@v3
293+
id: deployment
294+
120295
upload:
121296
name: Upload packages
122-
needs: [build_data, build_basemap, check]
297+
needs: [build_data, build_sdist, build_wheels, check]
123298
runs-on: ubuntu-22.04
124299
environment: PyPI
125300
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')

CHANGELOG.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ https://semver.org/spec/v2.0.0.html
2222
- **BREAKING CHANGE**: Set Python minimum supported version to 3.9.
2323
- **BREAKING CHANGE**: Migrate `basemap` libraries to use implicit
2424
namespace packages (PR [#576] by @ksunden).
25-
- Migrate workflows to use `cibuildwheel` (PRs [#614] and [#618] by
26-
@cvanelteren and PR [#621], solves GitHub artifact actions v1 sunset).
25+
- Migrate workflows to use `cibuildwheel` (PRs [#614], [#618], [#622]
26+
and [#623] by @cvanelteren and PR [#621], solves GitHub artifact
27+
actions v1 sunset).
2728
- Update library dependencies:
2829
- Upgrade upper limit for `basemap_data` to 3.0.
2930
- Upgrade lower limit for `packaging` to 20.5.
@@ -1156,6 +1157,10 @@ https://semver.org/spec/v2.0.0.html
11561157
- Fix glitches in drawing of parallels and meridians.
11571158

11581159

1160+
[#623]:
1161+
https://github.com/matplotlib/basemap/pull/623
1162+
[#622]:
1163+
https://github.com/matplotlib/basemap/pull/622
11591164
[#621]:
11601165
https://github.com/matplotlib/basemap/pull/621
11611166
[#620]:

0 commit comments

Comments
 (0)