Skip to content

Add multimember test #10923

Add multimember test

Add multimember test #10923

Workflow file for this run

name: Testing
on:
push:
branches:
- main
paths-ignore:
- CHANGELOG.rst
- README.rst
- pyproject.toml
- src/xclim/__init__.py
pull_request:
types:
- opened
- reopened
- synchronize
pull_request_review:
types:
- submitted
env:
XCLIM_TESTDATA_BRANCH: v2025.4.29
concurrency:
# For a given workflow, if we push to the same branch, from the same event family, cancel all previous builds on that branch except on main.
group: "${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}"
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
permissions:
contents: read
pull-requests: read
jobs:
lint:
name: Lint
runs-on: ${{ matrix.os }}
if: |
(github.event.action != 'labeled') ||
(github.event.review.state == 'approved') ||
(github.event_name == 'push')
strategy:
matrix:
os: [ 'ubuntu-latest' ]
python-version: [ "3.14" ]
steps:
- name: Harden Runner
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
disable-sudo: true
egress-policy: block
allowed-endpoints: >
api.github.com:443
api.green-coding.io:443
files.pythonhosted.org:443
github.com:443
pypi.org:443
- name: Start Measurement
uses: green-coding-solutions/eco-ci-energy-estimation@782dd4a31bc426a6ae26a7b08d89af454b10ffc0 # v5.2
with:
task: start-measurement
branch: ${{ github.head_ref || github.ref_name }}
project: "xclim"
machine: ${{ matrix.os }}
tags: "CI/CD, Main, Lint-${{ matrix.python-version }}"
gmt-api-token: ${{ secrets.GMT_API_TOKEN }}
continue-on-error: true
- name: Checkout Repository
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- name: Set up Python3
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install CI libraries
run: |
python -m pip install --require-hashes -r CI/requirements_ci.txt
- name: Setup Python Measurement
uses: green-coding-solutions/eco-ci-energy-estimation@782dd4a31bc426a6ae26a7b08d89af454b10ffc0 # v5.2
with:
task: get-measurement
label: 'Environment setup (Python${{ matrix.python-version }}, lint)'
continue-on-error: true
- name: Environment Caching
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
${{ matrix.testdata-cache }}
.tox
key: ${{ runner.os }}-xclim-testdata-${{ env.XCLIM_TESTDATA_BRANCH }}-${{ hashFiles('pyproject.toml', 'tox.ini') }}-lint
- name: Run typing checks
run: |
make typing
- name: Run linting suite
run: |
python -m tox -e lint
- name: Tests measurement
uses: green-coding-solutions/eco-ci-energy-estimation@782dd4a31bc426a6ae26a7b08d89af454b10ffc0 # v5.2
with:
task: get-measurement
label: 'Lint (Python${{ matrix.python-version }})'
continue-on-error: true
- name: Show Energy Results
uses: green-coding-solutions/eco-ci-energy-estimation@782dd4a31bc426a6ae26a7b08d89af454b10ffc0 # v5.2
with:
task: display-results
continue-on-error: true
test-preliminary:
name: Python${{ matrix.python-version }} (${{ matrix.os }})
needs: lint
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ 'ubuntu-latest' ]
python-version: [ "3.11" ]
testdata-cache: [ '~/.cache/xclim-testdata' ]
markers: [ "-m not slow" ]
steps:
- name: Harden Runner
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
disable-sudo: false
egress-policy: block
allowed-endpoints: >
*.archive.ubuntu.com:80
*.microsoft.com:443
api.electricitymap.org:443
api.github.com:443
api.green-coding.io:443
archive.ubuntu.com:443
coveralls.io:443
esm.ubuntu.com:443
files.pythonhosted.org:443
github.com:443
ipapi.co:443
pypi.org:443
raw.githubusercontent.com:443
security.ubuntu.com:443
- name: Start Energy Measurement
uses: green-coding-solutions/eco-ci-energy-estimation@782dd4a31bc426a6ae26a7b08d89af454b10ffc0 # v5.2
with:
task: start-measurement
branch: ${{ github.head_ref || github.ref_name }}
project: "xclim"
machine: ${{ matrix.os }}
tags: "CI/CD, Main, Test-${{ matrix.python-version }}"
gmt-api-token: ${{ secrets.GMT_API_TOKEN }}
continue-on-error: true
- name: Checkout Repository
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- name: Set up Python${{ matrix.python-version }}
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install HDF5 (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libhdf5-dev
- name: Install CI libraries
run: |
python -m pip install --require-hashes -r CI/requirements_ci.txt
- name: Environment Setup Energy Measurement
uses: green-coding-solutions/eco-ci-energy-estimation@782dd4a31bc426a6ae26a7b08d89af454b10ffc0 # v5.2
with:
task: get-measurement
label: 'Environment setup (Python${{ matrix.python-version }}, standard)'
continue-on-error: true
- name: Environment Caching
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
${{ matrix.testdata-cache }}
.tox
key: ${{ runner.os }}-xclim-testdata-${{ env.XCLIM_TESTDATA_BRANCH }}-${{ hashFiles('pyproject.toml', 'tox.ini') }}-Python${{ matrix.python-version }}
- name: Test with tox
run: |
python -m tox -e py${{ matrix.python-version }} -- ${{ matrix.markers }}
- name: Tests measurement
uses: green-coding-solutions/eco-ci-energy-estimation@782dd4a31bc426a6ae26a7b08d89af454b10ffc0 # v5.2
with:
task: get-measurement
label: 'Testing with tox (Python${{ matrix.python-version }})'
continue-on-error: true
- name: Show Energy Results
uses: green-coding-solutions/eco-ci-energy-estimation@782dd4a31bc426a6ae26a7b08d89af454b10ffc0 # v5.2
with:
task: display-results
continue-on-error: true
test-pypi:
needs: lint
name: Python${{ matrix.python-version }} (${{ matrix.os }}, ${{ matrix.tox-env }})
if: |
contains(github.event.pull_request.labels.*.name, 'approved') ||
(github.event.review.state == 'approved') ||
(github.event_name == 'push')
runs-on: ${{ matrix.os }}
timeout-minutes: 20
strategy:
matrix:
# Linux builds
os: [ 'ubuntu-latest', ]
testdata-cache: [ '~/.cache/xclim-testdata' ]
python-version: [ "3.12", "3.13", "3.14" ]
markers: [ "-m not slow" ]
include:
# macOS build
- os: 'macos-latest'
testdata-cache: '~/Library/Caches/xclim-testdata'
markers: '' # Slow tests
python-version: "3.13"
# Specialized tests
## Windows with Prefetch
- os: 'windows-latest'
testdata-cache: 'C:\Users\runneradmin\AppData\Local\xclim-testdata\xclim-testdata\Cache'
markers: '' # Markers handled by tox
python-version: "3.13"
tox-env: 'prefetch'
## Linux offline
- os: 'ubuntu-latest'
testdata-cache: '~/.cache/xclim-testdata'
markers: '' # Markers handled by tox + Slow tests
python-version: "3.12"
tox-env: 'offline'
## Linux notebooks
- os: 'ubuntu-latest'
testdata-cache: '~/.cache/xclim-testdata'
markers: '' # No markers for notebooks
python-version: "3.12"
tox-env: 'notebooks'
## Linux doctests
- os: 'ubuntu-latest'
testdata-cache: '~/.cache/xclim-testdata'
markers: '' # No markers for doctests
python-version: "3.12"
tox-env: 'doctests'
steps:
- name: Harden Runner
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
disable-sudo: false
egress-policy: block
allowed-endpoints: >
*.archive.ubuntu.com:80
*.microsoft.com:443
api.electricitymap.org:443
api.github.com:443
api.green-coding.io:443
coveralls.io:443
esm.ubuntu.com:443
files.pythonhosted.org:443
github.com:443
ip-api.com:80
ipapi.co:443
proxy.golang.org:443
pypi.org:443
raw.githubusercontent.com:443
release-assets.githubusercontent.com:443
sum.golang.org:443
- name: Start Energy Measurement
if : ${{ matrix.os == 'ubuntu-latest' }}
uses: green-coding-solutions/eco-ci-energy-estimation@782dd4a31bc426a6ae26a7b08d89af454b10ffc0 # v5.2
with:
task: start-measurement
branch: ${{ github.head_ref || github.ref_name }}
project: "xclim"
machine: ${{ matrix.os }}
tags: "CI/CD, Main, Test-${{ matrix.python-version }}"
gmt-api-token: ${{ secrets.GMT_API_TOKEN }}
continue-on-error: true
- name: Checkout Repository
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- name: Install HDF5 (Linux)
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
sudo apt-get update
sudo apt-get install -y libhdf5-dev
- name: Install HDF5 (macOS)
if: ${{ matrix.os == 'macos-latest' }}
uses: tecolicom/actions-use-homebrew-tools@b9c066b79607fa3d71e0be05d7003bb75fd9ff34 # v1.3
with:
tools: hdf5
cache: "yes"
- name: Install Eigen3 (SBCK)
if: ${{ matrix.python-version == '3.11' && matrix.os == 'ubuntu-latest' }}
run: |
sudo apt-get update
sudo apt-get install libeigen3-dev
- name: Set up Python${{ matrix.python-version }}
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install CI libraries
run: |
python -m pip install --require-hashes -r CI/requirements_ci.txt
- name: Environment Setup Energy Measurement
if : ${{ matrix.os == 'ubuntu-latest' }}
uses: green-coding-solutions/eco-ci-energy-estimation@782dd4a31bc426a6ae26a7b08d89af454b10ffc0 # v5.2
with:
task: get-measurement
label: 'Environment setup (Python${{ matrix.python-version }}, ${{ matrix.tox-env }})'
continue-on-error: true
- name: Environment Caching
# if prefetch is not in tox-env
if: contains(matrix.tox-env, 'prefetch') == false
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
${{ matrix.testdata-cache }}
.tox
key: ${{ runner.os }}-xclim-testdata-${{ env.XCLIM_TESTDATA_BRANCH }}-${{ hashFiles('pyproject.toml', 'tox.ini') }}-Python${{ matrix.python-version }}
- name: Test with tox
if: ${{ matrix.tox-env == '' || matrix.tox-env == null }}
run: |
python -m tox -- ${{ matrix.markers }}
env:
TOX_GH_MAJOR_MINOR: ${{ matrix.python-version }}
- name: Test with tox (specialized tests)
if: ${{ matrix.tox-env != '' && matrix.tox-env != null }}
run: |
python -m tox -e ${{ matrix.tox-env }} -- ${{ matrix.markers }}
- name: Trust Coveralls Homebrew tap # Homebrew v6.0 requirement; Remove when coverallsapp/github-action >2.3.7
if: matrix.os == 'macos-latest'
run: |
brew trust coverallsapp/coveralls
- name: Report Coverage
if: ${{ matrix.tox-env != 'notebooks' }}
uses: coverallsapp/github-action@5cbfd81b66ca5d10c19b062c04de0199c215fb6e # v2.3.7
with:
flag-name: run-${{ matrix.python-version }}-${{ matrix.os }}-${{ matrix.tox-env }}
parallel: true
- name: Tests measurement
if : ${{ matrix.os == 'ubuntu-latest' }}
uses: green-coding-solutions/eco-ci-energy-estimation@782dd4a31bc426a6ae26a7b08d89af454b10ffc0 # v5.2
with:
task: get-measurement
label: 'Testing with tox (Python${{ matrix.python-version }}, ${{ matrix.tox-env }})'
continue-on-error: true
- name: Show Energy Results
if : ${{ matrix.os == 'ubuntu-latest' }}
uses: green-coding-solutions/eco-ci-energy-estimation@782dd4a31bc426a6ae26a7b08d89af454b10ffc0 # v5.2
with:
task: display-results
continue-on-error: true
test-conda:
needs: lint
name: Python${{ matrix.python-version }} (${{ matrix.os }}, conda)
if: |
contains(github.event.pull_request.labels.*.name, 'approved') ||
(github.event.review.state == 'approved') ||
(github.event_name == 'push')
runs-on: ubuntu-latest
strategy:
matrix:
os: [ 'ubuntu-latest' ]
python-version: [ "3.11", "3.14" ]
testdata-cache: [ '~/.cache/xclim-testdata' ]
defaults:
run:
shell: bash -l {0}
steps:
- name: Harden Runner
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
disable-sudo: true
egress-policy: block
allowed-endpoints: >
api.electricitymap.org:443
api.github.com:443
api.green-coding.io:443
conda.anaconda.org:443
coveralls.io:443
files.pythonhosted.org:443
github.com:443
ipapi.co:443
objects.githubusercontent.com:443
pypi.org:443
raw.githubusercontent.com:443
release-assets.githubusercontent.com:443
- name: Start Energy Measurement
uses: green-coding-solutions/eco-ci-energy-estimation@782dd4a31bc426a6ae26a7b08d89af454b10ffc0 # v5.2
with:
task: start-measurement
branch: ${{ github.head_ref || github.ref_name }}
project: "xclim"
machine: ${{ matrix.os }}
tags: "CI/CD, Main, Test-${{ matrix.python-version }}, conda"
gmt-api-token: ${{ secrets.GMT_API_TOKEN }}
continue-on-error: true
- name: Checkout Repository
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- name: Setup Conda (Micromamba) with Python${{ matrix.python-version }}
uses: mamba-org/setup-micromamba@d7c9bd84e824b79d2af72a2d4196c7f4300d3476 # v3.0.0
with:
cache-downloads: true
cache-environment: true
environment-file: environment.yml
create-args: >-
python=${{ matrix.python-version }}
- name: Test Data Caching
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
${{ matrix.testdata-cache }}
key: ${{ runner.os }}-xclim-testdata-${{ env.XCLIM_TESTDATA_BRANCH }}-conda-${{ hashFiles('pyproject.toml', 'tox.ini') }}-Python${{ matrix.python-version }}
- name: Install xclim
run: |
python -m pip install --no-user --editable .
- name: Check versions
run: |
micromamba list
xclim show_version_info
python -m pip check || true
- name: Environment Setup Energy Measurement
uses: green-coding-solutions/eco-ci-energy-estimation@782dd4a31bc426a6ae26a7b08d89af454b10ffc0 # v5.2
with:
task: get-measurement
label: 'Environment setup (conda, Python${{ matrix.python-version }})'
continue-on-error: true
- name: Test with pytest
run: |
python -m pytest --numprocesses=logical --durations=10 --cov=xclim --cov-report=lcov
- name: Report Coverage
uses: coverallsapp/github-action@5cbfd81b66ca5d10c19b062c04de0199c215fb6e # v2.3.7
with:
flag-name: run-{{ matrix.python-version }}-conda
parallel: true
- name: Tests measurement
uses: green-coding-solutions/eco-ci-energy-estimation@782dd4a31bc426a6ae26a7b08d89af454b10ffc0 # v5.2
with:
task: get-measurement
label: 'Testing with pytest (conda, Python${{ matrix.python-version }})'
continue-on-error: true
- name: Show Energy Results
uses: green-coding-solutions/eco-ci-energy-estimation@782dd4a31bc426a6ae26a7b08d89af454b10ffc0 # v5.2
with:
task: display-results
continue-on-error: true
finish:
name: Finish
needs:
- test-preliminary
- test-pypi
- test-conda
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Harden Runner
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
disable-sudo: false
egress-policy: block
allowed-endpoints: >
api.electricitymap.org:443
api.github.com:443
api.green-coding.io:443
coveralls.io:443
files.pythonhosted.org:443
github.com:443
ip-api.com:80
ipapi.co:443
objects.githubusercontent.com:443
proxy.golang.org:443
pypi.org:443
release-assets.githubusercontent.com:443
sum.golang.org:443
- name: Start Energy Measurement
uses: green-coding-solutions/eco-ci-energy-estimation@782dd4a31bc426a6ae26a7b08d89af454b10ffc0 # v5.2
with:
task: start-measurement
branch: ${{ github.head_ref || github.ref_name }}
project: "xclim"
machine: ubuntu-latest
tags: "CI/CD, Main, Finish"
gmt-api-token: ${{ secrets.GMT_API_TOKEN }}
continue-on-error: true
- name: Coveralls Finished
uses: coverallsapp/github-action@5cbfd81b66ca5d10c19b062c04de0199c215fb6e # v2.3.7
with:
parallel-finished: true
- name: Finish measurement
uses: green-coding-solutions/eco-ci-energy-estimation@782dd4a31bc426a6ae26a7b08d89af454b10ffc0 # v5.2
with:
task: get-measurement
label: 'Finish Run'
continue-on-error: true
- name: Show Energy Results
uses: green-coding-solutions/eco-ci-energy-estimation@782dd4a31bc426a6ae26a7b08d89af454b10ffc0 # v5.2
with:
task: display-results
continue-on-error: true