Skip to content

Commit a825a96

Browse files
committed
Merge branch 'main' into feat/flags-masks
* main: (33 commits) Update README.rst Update README.rst v0.8.0 release (xarray-contrib#424) Add sgrid axes parsing (xarray-contrib#421) Add rich repr (xarray-contrib#409) add `cf.grid_mapping_names` (xarray-contrib#391) Update CF standard name table v80 (xarray-contrib#423) Support grid_topology, mesh_topology CF roles. (xarray-contrib#420) added degrees units (xarray-contrib#390) Test and support 3.11 (xarray-contrib#417) Update link to COSIMA tutorial (xarray-contrib#419) Bump mamba-org/provision-with-micromamba from 14 to 15 (xarray-contrib#418) Update whats-new.rst (xarray-contrib#414) [skip-ci] Include data folder (xarray-contrib#416) Update changelog URL updated whats new for release (xarray-contrib#413) Using regex package for match (xarray-contrib#408) Try pytest-pretty (xarray-contrib#410) Update CITATION.cff (xarray-contrib#399) Fix upstream-dev CI (xarray-contrib#406) ...
2 parents b91a1da + ce9cd5a commit a825a96

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+3866
-2011
lines changed

.github/workflows/ci.yaml

Lines changed: 55 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ concurrency:
1313
group: ${{ github.ref }}
1414
cancel-in-progress: true
1515

16+
env:
17+
COLUMNS: 120
18+
1619
jobs:
1720
build:
1821
name: Build (${{ matrix.python-version }}, ${{ matrix.os }})
@@ -24,7 +27,7 @@ jobs:
2427
fail-fast: false
2528
matrix:
2629
os: ["ubuntu-latest"]
27-
python-version: ["3.8", "3.10"]
30+
python-version: ["3.8", "3.11"]
2831
steps:
2932
- uses: actions/checkout@v3
3033
with:
@@ -33,7 +36,7 @@ jobs:
3336
run: |
3437
echo "PYTHON_VERSION=${{ matrix.python-version }}" >> $GITHUB_ENV
3538
- name: Set up conda environment
36-
uses: mamba-org/provision-with-micromamba@v14
39+
uses: mamba-org/provision-with-micromamba@v15
3740
with:
3841
environment-file: ci/environment.yml
3942
environment-name: cf_xarray_test
@@ -73,7 +76,7 @@ jobs:
7376
run: |
7477
echo "PYTHON_VERSION=${{ matrix.python-version }}" >> $GITHUB_ENV
7578
- name: Set up conda environment
76-
uses: mamba-org/provision-with-micromamba@v14
79+
uses: mamba-org/provision-with-micromamba@v15
7780
with:
7881
environment-file: ci/environment.yml
7982
environment-name: cf_xarray_test
@@ -99,25 +102,63 @@ jobs:
99102
no-optional-deps:
100103
name: no-optional-deps
101104
runs-on: ubuntu-latest
105+
defaults:
106+
run:
107+
shell: bash -l {0}
102108
steps:
103109
- uses: actions/checkout@v3
104110
with:
105111
# need to fetch all tags to get a correct version
106112
fetch-depth: 0 # fetch all branches and tags
107-
- uses: conda-incubator/setup-miniconda@v2
108-
with:
109-
channels: conda-forge
110-
mamba-version: "*"
111-
activate-environment: cf_xarray_test
112-
auto-update-conda: false
113-
python-version: ${{ matrix.python-version }}
114113
- name: Set up conda environment
115-
shell: bash -l {0}
114+
uses: mamba-org/provision-with-micromamba@v15
115+
with:
116+
environment-file: ci/environment-no-optional-deps.yml
117+
environment-name: cf_xarray_test
118+
cache-env: true
119+
- name: Install cf_xarray
116120
run: |
117-
mamba env update -f ci/environment-no-optional-deps.yml
118-
python -m pip install -e .
119-
conda list
121+
python -m pip install --no-deps -e .
120122
- name: Run Tests
121123
shell: bash -l {0}
122124
run: |
123125
pytest -n 2
126+
127+
mypy:
128+
name: mypy
129+
runs-on: "ubuntu-latest"
130+
defaults:
131+
run:
132+
shell: bash -l {0}
133+
strategy:
134+
matrix:
135+
python-version: ["3.8", "3.11"]
136+
steps:
137+
- uses: actions/checkout@v3
138+
with:
139+
fetch-depth: 0 # Fetch all history for all branches and tags.
140+
- name: Set up conda environment
141+
uses: mamba-org/provision-with-micromamba@v15
142+
with:
143+
environment-file: ci/environment.yml
144+
environment-name: cf_xarray_test
145+
cache-env: true
146+
extra-specs: |
147+
python="${{ matrix.python-version }}"
148+
- name: Install cf_xarray
149+
run: |
150+
python -m pip install --no-deps -e .
151+
- name: Install mypy
152+
run: |
153+
python -m pip install 'mypy'
154+
- name: Run mypy
155+
run: |
156+
python -m mypy --install-types --non-interactive --cobertura-xml-report mypy_report cf_xarray/
157+
- name: Upload mypy coverage to Codecov
158+
uses: codecov/[email protected]
159+
with:
160+
file: mypy_report/cobertura.xml
161+
flags: mypy
162+
env_vars: PYTHON_VERSION
163+
name: codecov-umbrella
164+
fail_ci_if_error: false

.github/workflows/pypi.yaml

Lines changed: 83 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,95 @@
1-
name: Upload Package to PyPI
2-
1+
name: Build and Upload to PyPI
32
on:
43
release:
5-
types: [created]
4+
types:
5+
- published
6+
push:
7+
tags:
8+
- 'v*'
69

710
jobs:
8-
deploy:
11+
build-artifacts:
912
runs-on: ubuntu-latest
13+
if: github.repository == 'xarray-contrib/cf-xarray'
1014
steps:
1115
- uses: actions/checkout@v3
12-
- name: Set up Python
13-
uses: actions/setup-python@v4
1416
with:
15-
python-version: '3.x'
17+
fetch-depth: 0
18+
- uses: actions/setup-python@v4
19+
name: Install Python
20+
with:
21+
python-version: 3.8
22+
1623
- name: Install dependencies
1724
run: |
1825
python -m pip install --upgrade pip
19-
pip install setuptools setuptools-scm wheel twine
20-
- name: Build and publish
21-
env:
22-
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
23-
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
26+
python -m pip install build twine
27+
28+
- name: Build tarball and wheels
29+
run: |
30+
git clean -xdf
31+
git restore -SW .
32+
python -m build
33+
34+
- name: Check built artifacts
35+
run: |
36+
python -m twine check --strict dist/*
37+
pwd
38+
if [ -f dist/cf_xarray-0.0.0.tar.gz ]; then
39+
echo "❌ INVALID VERSION NUMBER"
40+
exit 1
41+
else
42+
echo "✅ Looks good"
43+
fi
44+
- uses: actions/upload-artifact@v3
45+
with:
46+
name: releases
47+
path: dist
48+
49+
test-built-dist:
50+
needs: build-artifacts
51+
runs-on: ubuntu-latest
52+
steps:
53+
- uses: actions/setup-python@v4
54+
name: Install Python
55+
with:
56+
python-version: 3.8
57+
- uses: actions/download-artifact@v3
58+
with:
59+
name: releases
60+
path: dist
61+
- name: List contents of built dist
62+
run: |
63+
ls -ltrh
64+
ls -ltrh dist
65+
66+
- name: Verify the built dist/wheel is valid
67+
if: github.event_name == 'push'
2468
run: |
25-
python setup.py sdist bdist_wheel
26-
twine upload dist/*
69+
python -m pip install --upgrade pip
70+
python -m pip install dist/cf_xarray*.whl
71+
python -m cf_xarray.scripts.print_versions
72+
73+
- name: Publish package to TestPyPI
74+
if: github.event_name == 'push'
75+
uses: pypa/[email protected]
76+
with:
77+
password: ${{ secrets.TESTPYPI_TOKEN }}
78+
repository_url: https://test.pypi.org/legacy/
79+
verbose: true
80+
81+
82+
upload-to-pypi:
83+
needs: test-built-dist
84+
if: github.event_name == 'release'
85+
runs-on: ubuntu-latest
86+
steps:
87+
- uses: actions/download-artifact@v3
88+
with:
89+
name: releases
90+
path: dist
91+
- name: Publish package to PyPI
92+
uses: pypa/[email protected]
93+
with:
94+
password: ${{ secrets.PYPI_PASSWORD }}
95+
verbose: true
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Build and Upload to TestPyPI
2+
3+
on:
4+
push:
5+
branches:
6+
- "main"
7+
pull_request:
8+
types: [opened, reopened, synchronize, labeled]
9+
branches:
10+
- "*"
11+
workflow_dispatch:
12+
13+
# no need for concurrency limits
14+
15+
jobs:
16+
build-artifacts:
17+
if: ${{ contains( github.event.pull_request.labels.*.name, 'test-build') && github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }}
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v3
21+
with:
22+
fetch-depth: 0
23+
24+
- uses: actions/setup-python@v4
25+
name: Install Python
26+
with:
27+
python-version: "3.10"
28+
29+
- name: Install dependencies
30+
run: |
31+
python -m pip install --upgrade pip
32+
python -m pip install build twine
33+
python -m pip install tomli tomli_w
34+
35+
# - name: Disable local versions
36+
# run: |
37+
# python .github/workflows/configure-testpypi-version.py pyproject.toml
38+
# git update-index --assume-unchanged pyproject.toml
39+
# cat pyproject.toml
40+
41+
- name: Build tarball and wheels
42+
run: |
43+
git clean -xdf
44+
python -m build
45+
46+
- name: Check built artifacts
47+
run: |
48+
python -m twine check --strict dist/*
49+
if [ -f dist/cf_xarray-0.0.0.tar.gz ]; then
50+
echo "❌ INVALID VERSION NUMBER"
51+
exit 1
52+
else
53+
echo "✅ Looks good"
54+
fi
55+
56+
- uses: actions/upload-artifact@v3
57+
with:
58+
name: releases
59+
path: dist
60+
61+
test-built-dist:
62+
needs: build-artifacts
63+
runs-on: ubuntu-latest
64+
steps:
65+
- uses: actions/setup-python@v4
66+
name: Install Python
67+
with:
68+
python-version: "3.10"
69+
- uses: actions/download-artifact@v3
70+
with:
71+
name: releases
72+
path: dist
73+
- name: List contents of built dist
74+
run: |
75+
ls -ltrh
76+
ls -ltrh dist
77+
78+
- name: Verify the built dist/wheel is valid
79+
run: |
80+
python -m pip install --upgrade pip
81+
python -m pip install dist/cf_xarray*.whl
82+
python -m cf_xarray.scripts.print_versions
83+
84+
# - name: Publish package to TestPyPI
85+
# uses: pypa/[email protected]
86+
# with:
87+
# password: ${{ secrets.TESTPYPI_TOKEN }}
88+
# repository_url: https://test.pypi.org/legacy/
89+
# verbose: true

0 commit comments

Comments
 (0)