Skip to content

Commit

Permalink
Merge branch 'main' into plot_datetime_in_colorbar
Browse files Browse the repository at this point in the history
  • Loading branch information
mathause authored May 21, 2024
2 parents 135c34b + 12123be commit b9ac2b5
Show file tree
Hide file tree
Showing 130 changed files with 5,770 additions and 3,403 deletions.
1 change: 0 additions & 1 deletion .binder/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ dependencies:
- pip
- pooch
- pydap
- pynio
- rasterio
- scipy
- seaborn
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@ jobs:
environment-name: xarray-tests
cache-environment: true
cache-environment-key: "${{runner.os}}-${{runner.arch}}-py${{env.PYTHON_VERSION}}-${{env.TODAY}}-${{hashFiles(env.CONDA_ENV_FILE)}}-benchmark"
# add "build" because of https://github.com/airspeed-velocity/asv/issues/1385
create-args: >-
asv
build
mamba
- name: Run benchmarks
Expand All @@ -47,9 +50,6 @@ jobs:
asv machine --yes
echo "Baseline: ${{ github.event.pull_request.base.sha }} (${{ github.event.pull_request.base.label }})"
echo "Contender: ${GITHUB_SHA} (${{ github.event.pull_request.head.label }})"
# Use mamba for env creation
# export CONDA_EXE=$(which mamba)
export CONDA_EXE=$(which conda)
# Run benchmarks for current commit against base
ASV_OPTIONS="--split --show-stderr --factor $ASV_FACTOR"
asv continuous $ASV_OPTIONS ${{ github.event.pull_request.base.sha }} ${GITHUB_SHA} \
Expand Down
26 changes: 17 additions & 9 deletions .github/workflows/ci-additional.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,21 @@ on:
pull_request:
branches:
- "main"
paths:
- 'ci/**'
- '.github/**'
- '/*' # covers files such as `pyproject.toml`
- 'properties/**'
- 'xarray/**'
workflow_dispatch: # allows you to trigger manually

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
FORCE_COLOR: 3

jobs:
detect-ci-trigger:
name: detect ci trigger
Expand All @@ -35,14 +44,13 @@ jobs:
runs-on: "ubuntu-latest"
needs: detect-ci-trigger
if: needs.detect-ci-trigger.outputs.triggered == 'false'

defaults:
run:
shell: bash -l {0}

env:
CONDA_ENV_FILE: ci/requirements/environment.yml
PYTHON_VERSION: "3.11"

PYTHON_VERSION: "3.12"
steps:
- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -128,7 +136,7 @@ jobs:
python -m mypy --install-types --non-interactive --cobertura-xml-report mypy_report xarray/
- name: Upload mypy coverage to Codecov
uses: codecov/codecov-action@v4.1.0
uses: codecov/codecov-action@v4.4.0
with:
file: mypy_report/cobertura.xml
flags: mypy
Expand Down Expand Up @@ -182,7 +190,7 @@ jobs:
python -m mypy --install-types --non-interactive --cobertura-xml-report mypy_report xarray/
- name: Upload mypy coverage to Codecov
uses: codecov/codecov-action@v4.1.0
uses: codecov/codecov-action@v4.4.0
with:
file: mypy_report/cobertura.xml
flags: mypy39
Expand All @@ -206,7 +214,7 @@ jobs:
shell: bash -l {0}
env:
CONDA_ENV_FILE: ci/requirements/environment.yml
PYTHON_VERSION: "3.10"
PYTHON_VERSION: "3.12"

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -243,7 +251,7 @@ jobs:
python -m pyright xarray/
- name: Upload pyright coverage to Codecov
uses: codecov/codecov-action@v4.1.0
uses: codecov/codecov-action@v4.4.0
with:
file: pyright_report/cobertura.xml
flags: pyright
Expand Down Expand Up @@ -302,7 +310,7 @@ jobs:
python -m pyright xarray/
- name: Upload pyright coverage to Codecov
uses: codecov/codecov-action@v4.1.0
uses: codecov/codecov-action@v4.4.0
with:
file: pyright_report/cobertura.xml
flags: pyright39
Expand Down Expand Up @@ -331,7 +339,7 @@ jobs:
with:
environment-name: xarray-tests
create-args: >-
python=3.11
python=3.12
pyyaml
conda
python-dateutil
Expand Down
44 changes: 33 additions & 11 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,21 @@ on:
pull_request:
branches:
- "main"
paths:
- 'ci/**'
- '.github/**'
- '/*' # covers files such as `pyproject.toml`
- 'properties/**'
- 'xarray/**'
workflow_dispatch: # allows you to trigger manually

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
FORCE_COLOR: 3

jobs:
detect-ci-trigger:
name: detect ci trigger
Expand Down Expand Up @@ -44,7 +53,7 @@ jobs:
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
# Bookend python versions
python-version: ["3.9", "3.11", "3.12"]
python-version: ["3.9", "3.12"]
env: [""]
include:
# Minimum python version:
Expand All @@ -56,10 +65,11 @@ jobs:
os: ubuntu-latest
# Latest python version:
- env: "all-but-dask"
python-version: "3.10"
# Not 3.12 because of pint
python-version: "3.11"
os: ubuntu-latest
- env: "flaky"
python-version: "3.10"
python-version: "3.12"
os: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -71,25 +81,30 @@ jobs:
if [[ ${{ matrix.os }} == windows* ]] ;
then
if [[ ${{ matrix.python-version }} != "3.12" ]]; then
if [[ ${{ matrix.python-version }} != "3.13" ]]; then
echo "CONDA_ENV_FILE=ci/requirements/environment-windows.yml" >> $GITHUB_ENV
else
echo "CONDA_ENV_FILE=ci/requirements/environment-windows-3.12.yml" >> $GITHUB_ENV
echo "CONDA_ENV_FILE=ci/requirements/environment-windows-3.13.yml" >> $GITHUB_ENV
fi
elif [[ "${{ matrix.env }}" != "" ]] ;
then
if [[ "${{ matrix.env }}" == "flaky" ]] ;
then
echo "CONDA_ENV_FILE=ci/requirements/environment.yml" >> $GITHUB_ENV
echo "PYTEST_EXTRA_FLAGS=--run-flaky --run-network-tests" >> $GITHUB_ENV
echo "PYTEST_ADDOPTS=-m 'flaky or network' --run-flaky --run-network-tests -W default" >> $GITHUB_ENV
else
echo "CONDA_ENV_FILE=ci/requirements/${{ matrix.env }}.yml" >> $GITHUB_ENV
fi
if [[ "${{ matrix.env }}" == "min-all-deps" ]] ;
then
# Don't raise on warnings
echo "PYTEST_ADDOPTS=-W default" >> $GITHUB_ENV
fi
else
if [[ ${{ matrix.python-version }} != "3.12" ]]; then
if [[ ${{ matrix.python-version }} != "3.13" ]]; then
echo "CONDA_ENV_FILE=ci/requirements/environment.yml" >> $GITHUB_ENV
else
echo "CONDA_ENV_FILE=ci/requirements/environment-3.12.yml" >> $GITHUB_ENV
echo "CONDA_ENV_FILE=ci/requirements/environment-3.13.yml" >> $GITHUB_ENV
fi
fi
Expand All @@ -109,7 +124,7 @@ jobs:
# We only want to install this on one run, because otherwise we'll have
# duplicate annotations.
- name: Install error reporter
if: ${{ matrix.os }} == 'ubuntu-latest' and ${{ matrix.python-version }} == '3.10'
if: ${{ matrix.os }} == 'ubuntu-latest' and ${{ matrix.python-version }} == '3.12'
run: |
python -m pip install pytest-github-actions-annotate-failures
Expand All @@ -127,13 +142,20 @@ jobs:
run: |
python -c "import xarray"
- name: Restore cached hypothesis directory
uses: actions/cache@v4
with:
path: .hypothesis/
key: cache-hypothesis
enableCrossOsArchive: true
save-always: true

- name: Run tests
run: python -m pytest -n 4
--timeout 180
--cov=xarray
--cov-report=xml
--junitxml=pytest.xml
$PYTEST_EXTRA_FLAGS

- name: Upload test results
if: always()
Expand All @@ -143,7 +165,7 @@ jobs:
path: pytest.xml

- name: Upload code coverage to Codecov
uses: codecov/codecov-action@v4.1.0
uses: codecov/codecov-action@v4.4.0
with:
file: ./coverage.xml
flags: unittests
Expand Down
119 changes: 119 additions & 0 deletions .github/workflows/hypothesis.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
name: Slow Hypothesis CI
on:
push:
branches:
- "main"
pull_request:
branches:
- "main"
types: [opened, reopened, synchronize, labeled]
schedule:
- cron: "0 0 * * *" # Daily “At 00:00” UTC
workflow_dispatch: # allows you to trigger manually

env:
FORCE_COLOR: 3

jobs:
detect-ci-trigger:
name: detect ci trigger
runs-on: ubuntu-latest
if: |
github.repository == 'pydata/xarray'
&& (github.event_name == 'push' || github.event_name == 'pull_request')
outputs:
triggered: ${{ steps.detect-trigger.outputs.trigger-found }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- uses: xarray-contrib/ci-trigger@v1
id: detect-trigger
with:
keyword: "[skip-ci]"

hypothesis:
name: Slow Hypothesis Tests
runs-on: "ubuntu-latest"
needs: detect-ci-trigger
if: |
always()
&& (
(github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
|| needs.detect-ci-trigger.outputs.triggered == 'true'
|| contains( github.event.pull_request.labels.*.name, 'run-slow-hypothesis')
)
defaults:
run:
shell: bash -l {0}

env:
CONDA_ENV_FILE: ci/requirements/environment.yml
PYTHON_VERSION: "3.12"

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for all branches and tags.

- name: set environment variables
run: |
echo "TODAY=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- name: Setup micromamba
uses: mamba-org/setup-micromamba@v1
with:
environment-file: ci/requirements/environment.yml
environment-name: xarray-tests
create-args: >-
python=${{env.PYTHON_VERSION}}
pytest-reportlog
cache-environment: true
cache-environment-key: "${{runner.os}}-${{runner.arch}}-py${{env.PYTHON_VERSION}}-${{env.TODAY}}-${{hashFiles(env.CONDA_ENV_FILE)}}"

- name: Install xarray
run: |
python -m pip install --no-deps -e .
- name: Version info
run: |
conda info -a
conda list
python xarray/util/print_versions.py
# https://github.com/actions/cache/blob/main/tips-and-workarounds.md#update-a-cache
- name: Restore cached hypothesis directory
id: restore-hypothesis-cache
uses: actions/cache/restore@v4
with:
path: .hypothesis/
key: cache-hypothesis-${{ runner.os }}-${{ github.run_id }}
restore-keys: |
cache-hypothesis-
- name: Run slow Hypothesis tests
if: success()
id: status
run: |
python -m pytest --hypothesis-show-statistics --run-slow-hypothesis properties/*.py \
--report-log output-${{ matrix.python-version }}-log.jsonl
# explicitly save the cache so it gets updated, also do this even if it fails.
- name: Save cached hypothesis directory
id: save-hypothesis-cache
if: always() && steps.status.outcome != 'skipped'
uses: actions/cache/save@v4
with:
path: .hypothesis/
key: cache-hypothesis-${{ runner.os }}-${{ github.run_id }}

- name: Generate and publish the report
if: |
failure()
&& steps.status.outcome == 'failure'
&& github.event_name == 'schedule'
&& github.repository_owner == 'pydata'
uses: xarray-contrib/issue-from-pytest-log@v1
with:
log-path: output-${{ matrix.python-version }}-log.jsonl
issue-title: "Nightly Hypothesis tests failed"
issue-label: "topic-hypothesis"
4 changes: 2 additions & 2 deletions .github/workflows/pypi-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: "3.11"
python-version: "3.12"

- name: Install dependencies
run: |
Expand Down Expand Up @@ -53,7 +53,7 @@ jobs:
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: "3.11"
python-version: "3.12"
- uses: actions/download-artifact@v4
with:
name: releases
Expand Down
Loading

0 comments on commit b9ac2b5

Please sign in to comment.