From 54b7c54321328fc459c0a12eddeb17c7f9c6b0e5 Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Tue, 27 Feb 2024 14:35:22 -0500 Subject: [PATCH 1/4] run upstream tests in dedicated build, add requirements_upstream.txt, modify tox flags --- .github/workflows/main.yml | 18 ++----- .github/workflows/upstream.yml | 87 ++++++++++++++++++++++++++++++++++ requirements_upstream.txt | 1 + tox.ini | 2 +- 4 files changed, 92 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/upstream.yml create mode 100644 requirements_upstream.txt diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 52b07a50..746585f5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -67,7 +67,7 @@ jobs: - python-version: "3.10" tox-build: "py310-coveralls" - python-version: "3.11" - tox-build: "py311-xclim-coveralls" + tox-build: "py311-coveralls" - python-version: "3.12" tox-build: "py312-esmpy-coveralls" defaults: @@ -131,13 +131,9 @@ jobs: matrix: include: - python-version: "3.9" - xclim-upstream: false - python-version: "3.10" - xclim-upstream: false - python-version: "3.11" - xclim-upstream: false - python-version: "3.12" - xclim-upstream: true defaults: run: shell: bash -l {0} @@ -151,21 +147,17 @@ jobs: uses: mamba-org/setup-micromamba@v1.8.1 with: cache-downloads: true + cache-environment: true environment-file: environment-dev.yml create-args: >- - mamba python=${{ matrix.python-version }} - name: Downgrade intake-esm if: matrix.python-version == '3.9' run: | micromamba install -y -c conda-forge intake-esm=2023.11.10 - - name: Install xclim main branch - if: matrix.xclim-upstream - run: | - python -m pip install git+https://github.com/Ouranosinc/xclim.git@main - name: Conda and Mamba versions run: | - mamba --version + micromamba list echo "micromamba $(micromamba --version)" - name: Compile catalogs and install xscen run: | @@ -194,10 +186,6 @@ jobs: runs-on: ubuntu-latest container: python:3-slim steps: - - name: Harden Runner - uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 - with: - gress-policy: audit - name: Coveralls Finished run: | python -m pip install --upgrade coveralls diff --git a/.github/workflows/upstream.yml b/.github/workflows/upstream.yml new file mode 100644 index 00000000..6c595416 --- /dev/null +++ b/.github/workflows/upstream.yml @@ -0,0 +1,87 @@ +name: Test Upstream Dependencies +on: + push: + branches: + - main + paths-ignore: + - .cruft.json + - CHANGES.rst + - README.rst + - pyproject.toml + - setup.cfg + - setup.py + - xscen/__init__.py + schedule: + - cron: "0 0 * * *" # Daily “At 00:00” UTC + workflow_dispatch: # allows you to trigger the workflow run manually + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + upstream-dev: + name: Python${{ matrix.python-version }}-upstream + runs-on: ubuntu-latest + permissions: + contents: read + issues: write + if: | + (github.event_name == 'schedule') || + (github.event_name == 'workflow_dispatch') || + (github.event_name == 'push') + strategy: + fail-fast: false + matrix: + python-version: + - "3.10" + defaults: + run: + shell: bash -l {0} + steps: + - name: Harden Runner + uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 + with: + audit: true + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + fetch-depth: 0 # Fetch all history for all branches and tags. + - name: Setup Conda (Micromamba) with Python${{ matrix.python-version }} + uses: mamba-org/setup-micromamba@422500192359a097648154e8db4e39bdb6c6eed7 # v1.8.1 + with: + cache-downloads: true + cache-environment: true + environment-file: environment-dev.yml + create-args: >- + python=${{ matrix.python-version }} + pytest-reportlog + - name: Conda and Mamba versions + run: | + echo "micromamba: $(micromamba --version)" + - name: Install upstream dependencies + run: | + python -m pip install -r requirements_upstream.txt + - name: Install xscen + run: | + python -m pip install --no-user --no-deps --editable . + - name: Check versions + run: | + micromamba list + python -m pip check || true + - name: Run Tests + if: success() + id: status + run: | + python -m pytest --durations=10 --cov=xscen --cov-report=term-missing --report-log output-${{ matrix.python-version }}-log.jsonl + - name: Generate and publish the report + if: | + failure() + && steps.status.outcome == 'failure' + && github.event_name == 'schedule' + && github.repository_owner == 'Ouranosinc' + uses: xarray-contrib/issue-from-pytest-log@138db94bfe4b12ac11fc1aff307ee0835feab403 # v1.2.8 + with: + log-path: output-${{ matrix.python-version }}-log.jsonl diff --git a/requirements_upstream.txt b/requirements_upstream.txt new file mode 100644 index 00000000..307df14e --- /dev/null +++ b/requirements_upstream.txt @@ -0,0 +1 @@ +xclim @ git+https://github.com/Ouranosinc/xclim.git@main diff --git a/tox.ini b/tox.ini index e5219c2f..72eb40fb 100644 --- a/tox.ini +++ b/tox.ini @@ -69,7 +69,7 @@ download = true deps = coveralls: coveralls esmpy: git+https://github.com/esmf-org/esmf.git@v{env:ESMF_VERSION}\#subdirectory=src/addon/esmpy - xclim: git+https://github.com/Ouranosinc/xclim.git@main + upstream: -rrequirements_upstream.txt extras = dev conda_channels = From d2cf32668627d0a0f54a6582d6b805b0f077f5e3 Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Tue, 27 Feb 2024 14:45:28 -0500 Subject: [PATCH 2/4] ensure translate is called --- .github/workflows/main.yml | 4 ++-- .github/workflows/upstream.yml | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 746585f5..35480a9a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -124,7 +124,7 @@ jobs: # COVERALLS_SERVICE_NAME: github test-conda: - name: Python${{ matrix.python-version }} (conda, upstream=${{ matrix.xclim-upstream }}) + name: Python${{ matrix.python-version }} (conda) needs: lint runs-on: ubuntu-latest strategy: @@ -162,7 +162,7 @@ jobs: - name: Compile catalogs and install xscen run: | make translate - python -m pip install --no-deps . + python -m pip install --no-user --no-deps . - name: Check versions run: | conda list diff --git a/.github/workflows/upstream.yml b/.github/workflows/upstream.yml index 6c595416..b6676a28 100644 --- a/.github/workflows/upstream.yml +++ b/.github/workflows/upstream.yml @@ -66,7 +66,8 @@ jobs: python -m pip install -r requirements_upstream.txt - name: Install xscen run: | - python -m pip install --no-user --no-deps --editable . + make translate + python -m pip install --no-user --no-deps . - name: Check versions run: | micromamba list From 2b7100f75ea35495082a72e9fa33f70d029fc1cd Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Tue, 27 Feb 2024 15:26:29 -0500 Subject: [PATCH 3/4] update CHANGES.rst --- CHANGES.rst | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 6d944165..e8743bd5 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -15,13 +15,15 @@ Internal changes ^^^^^^^^^^^^^^^^ * Added tests for diagnostics. (:pull:`352`). * Added a `SECURITY.md` file to the repository and the documentation. (:pull:`353`). -* Added `tox` modifier for testing builds against the `main` development branch of `xclim`. (:pull:`351`). +* Added `tox` modifier for testing builds against the `main` development branch of `xclim`. (:pull:`351`, :pull:`355`). +* Added a `requirements_upstream.txt` file to the repository to track the development branches of relevant dependencies. (:pull:`355`). +* Added a dedicated GitHub Workflow to evaluate compatibility with upstream dependencies. (:pull:`355`). Breaking changes ^^^^^^^^^^^^^^^^ * `xscen` now requires `pandas` >= 2.2 and `xclim` >= 0.48.2. (:pull:`351`). -* Functions that output a dict with keys as xrfreq (such as ``extract_dataset``, ``compute_indicators``) will now return the new nomenclature (e.g. "YS-JAN" instead of "AS-JAN"). (:pull:`351`). -* Going from `xrfreq` to frequencies or timedeltas will still work, but the opposite (frequency --> xrfreq/timedelta) will now only result in the new pandas nomenclature. (:pull:`351`). +* Functions that output a dict with keys as xrfreq (such as ``extract_dataset``, ``compute_indicators``) will now return the new nomenclature (e.g. ``"YS-JAN"`` instead of ``"AS-JAN"``). (:pull:`351`). +* Going from `xrfreq` to frequencies or timedeltas will still work, but the opposite (frequency --> xrfreq/timedelta) will now only result in the new `pandas` nomenclature. (:pull:`351`). v0.8.2 (2024-02-12) ------------------- From 643558c0ca5dba26e810ecdacd2bb5f3124b5cdb Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Tue, 27 Feb 2024 15:46:14 -0500 Subject: [PATCH 4/4] fix bump-version.yml --- .github/workflows/bump-version.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/bump-version.yml b/.github/workflows/bump-version.yml index 9b9f1719..b58e84af 100644 --- a/.github/workflows/bump-version.yml +++ b/.github/workflows/bump-version.yml @@ -70,7 +70,7 @@ jobs: git config --local user.name "bumpversion[bot]" - name: Install bump-my-version run: | - python -m pip install "bump-my-version>=0.17.1" + python -m pip install "bump-my-version>=0.18.3" - name: Current Version run: | bump-my-version show current_version @@ -80,11 +80,12 @@ jobs: run: | if [[ ${{ env.CURRENT_VERSION }} =~ -dev(\.\d+)? ]]; then echo "Development version (ends in 'dev(\.\d+)?'), bumping 'build' version" - bump-my-version show new_version --increment build + bump-my-version bump build else echo "Version is stable, bumping 'patch' version" - bump-my-version show new_version --increment patch + bump-my-version bump patch fi + bump-my-version show-bump - name: Push Changes uses: ad-m/github-push-action@v0.8.0 with: