Skip to content

Commit 4d96b1f

Browse files
committed
consolidate workflows
1 parent 8c4f7f4 commit 4d96b1f

File tree

2 files changed

+220
-0
lines changed

2 files changed

+220
-0
lines changed

.github/workflows/build-data.yml

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Build Data Packages
2+
3+
env:
4+
PYTHONUNBUFFERED: "1"
5+
PYTHONWARNINGS: "ignore:DEPRECATION"
6+
7+
on:
8+
push:
9+
paths:
10+
- "packages/basemap_data/**"
11+
- "packages/basemap_data_hires/**"
12+
pull_request:
13+
paths:
14+
- "packages/basemap_data/**"
15+
- "packages/basemap_data_hires/**"
16+
workflow_dispatch:
17+
18+
jobs:
19+
build:
20+
runs-on: ubuntu-latest
21+
strategy:
22+
matrix:
23+
package: [basemap_data, basemap_data_hires]
24+
25+
steps:
26+
- uses: actions/checkout@v4
27+
28+
- name: Set up Python
29+
uses: actions/setup-python@v4
30+
with:
31+
python-version: "3.9"
32+
33+
- name: Build package
34+
run: |
35+
cd packages/${{ matrix.package }}
36+
pip install build
37+
python -m build
38+
39+
- uses: actions/upload-artifact@v4
40+
with:
41+
name: dist-${{ matrix.package }}
42+
path: packages/${{ matrix.package }}/dist/*
43+
44+
upload_testpypi:
45+
needs: [build]
46+
runs-on: ubuntu-latest
47+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
48+
strategy:
49+
matrix:
50+
package: [basemap_data, basemap_data_hires]
51+
environment:
52+
name: TestPyPI
53+
url: https://test.pypi.org/p/${{ matrix.package }}
54+
permissions:
55+
id-token: write
56+
steps:
57+
- uses: actions/download-artifact@v4
58+
with:
59+
name: dist-${{ matrix.package }}
60+
path: dist
61+
62+
- name: Upload to TestPyPI
63+
uses: pypa/gh-action-pypi-publish@release/v1
64+
with:
65+
repository-url: https://test.pypi.org/legacy/
66+
67+
upload_pypi:
68+
needs: [build, upload_testpypi]
69+
runs-on: ubuntu-latest
70+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
71+
strategy:
72+
matrix:
73+
package: [basemap_data, basemap_data_hires]
74+
environment:
75+
name: PyPI
76+
url: https://pypi.org/p/${{ matrix.package }}
77+
permissions:
78+
id-token: write
79+
steps:
80+
- uses: actions/download-artifact@v4
81+
with:
82+
name: dist-${{ matrix.package }}
83+
path: dist
84+
85+
- name: Upload to PyPI
86+
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/build.yml

+134
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
name: Build and Test
2+
3+
env:
4+
PKGDIR: "packages/basemap"
5+
CIBW_BUILD_VERBOSITY: 1
6+
PYTHONUNBUFFERED: "1"
7+
PYTHONWARNINGS: "ignore:DEPRECATION"
8+
9+
on:
10+
push:
11+
paths:
12+
- ".github/workflows/**"
13+
- "packages/basemap/**"
14+
- "packages/basemap_data/**"
15+
- "packages/basemap_data_hires/**"
16+
pull_request:
17+
paths:
18+
- ".github/workflows/**"
19+
- "packages/basemap/**"
20+
- "packages/basemap_data/**"
21+
- "packages/basemap_data_hires/**"
22+
workflow_dispatch:
23+
24+
jobs:
25+
build_wheels:
26+
name: Build wheels on ${{ matrix.os }}
27+
runs-on: ${{ matrix.os }}
28+
strategy:
29+
matrix:
30+
os: [ubuntu-20.04, windows-2019, macos-11]
31+
32+
steps:
33+
- uses: actions/checkout@v4
34+
35+
- name: Set up Python
36+
uses: actions/setup-python@v4
37+
with:
38+
python-version: "3.9"
39+
40+
- name: Install cibuildwheel
41+
run: python -m pip install cibuildwheel==2.16.2
42+
43+
- name: Build wheels
44+
env:
45+
CIBW_SKIP: "pp* *-musllinux*" # Skip PyPy and musllinux
46+
CIBW_BEFORE_BUILD: >
47+
pip install numpy cython &&
48+
python -c "import utils; utils.GeosLibrary('3.6.5').build('extern', njobs=16)"
49+
CIBW_BEFORE_TEST: "pip install -r {project}/requirements-test.txt"
50+
CIBW_TEST_COMMAND: >
51+
cd {project} && python -m pytest --cov="mpl_toolkits.basemap"
52+
--cov-report=term --ignore=dist --ignore=build
53+
CIBW_BUILD: "cp27-* cp35-* cp36-* cp37-* cp38-* cp39-* cp310-* cp311-* cp312-*"
54+
CIBW_ENVIRONMENT: "GEOS_DIR={project}/extern"
55+
run: |
56+
cd ${{ env.PKGDIR }}
57+
python -m cibuildwheel --output-dir wheelhouse
58+
59+
- uses: actions/upload-artifact@v4
60+
with:
61+
name: wheels-${{ matrix.os }}
62+
path: ${{ env.PKGDIR }}/wheelhouse/*.whl
63+
64+
build_sdist:
65+
name: Build source distribution
66+
runs-on: ubuntu-latest
67+
steps:
68+
- uses: actions/checkout@v4
69+
70+
- name: Set up Python
71+
uses: actions/setup-python@v4
72+
with:
73+
python-version: "3.9"
74+
75+
- name: Build sdist
76+
run: |
77+
cd ${{ env.PKGDIR }}
78+
pip install build
79+
python -m build --sdist
80+
81+
- uses: actions/upload-artifact@v4
82+
with:
83+
name: sdist
84+
path: ${{ env.PKGDIR }}/dist/*.tar.gz
85+
86+
upload_testpypi:
87+
needs: [build_wheels, build_sdist]
88+
runs-on: ubuntu-latest
89+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
90+
environment:
91+
name: TestPyPI
92+
url: https://test.pypi.org/p/basemap
93+
permissions:
94+
id-token: write
95+
steps:
96+
- uses: actions/download-artifact@v4
97+
with:
98+
pattern: wheels-*
99+
path: dist
100+
merge-multiple: true
101+
102+
- uses: actions/download-artifact@v4
103+
with:
104+
name: sdist
105+
path: dist
106+
107+
- name: Upload to TestPyPI
108+
uses: pypa/gh-action-pypi-publish@release/v1
109+
with:
110+
repository-url: https://test.pypi.org/legacy/
111+
112+
upload_pypi:
113+
needs: [build_wheels, build_sdist, upload_testpypi]
114+
runs-on: ubuntu-latest
115+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
116+
environment:
117+
name: PyPI
118+
url: https://pypi.org/p/basemap
119+
permissions:
120+
id-token: write
121+
steps:
122+
- uses: actions/download-artifact@v4
123+
with:
124+
pattern: wheels-*
125+
path: dist
126+
merge-multiple: true
127+
128+
- uses: actions/download-artifact@v4
129+
with:
130+
name: sdist
131+
path: dist
132+
133+
- name: Upload to PyPI
134+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)