fix is_time to avoid memory overload #1107
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CLISOPS Testing Suite | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
concurrency: | |
# For a given workflow, if we push to the same branch, cancel all previous builds on that branch except on master. | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} | |
env: | |
ESGF_TEST_DATA_VERSION: v1 | |
XCLIM_TEST_DATA_VERSION: v2024.8.23 | |
permissions: | |
contents: read | |
jobs: | |
lint: | |
name: Linting Suite | |
runs-on: ubuntu-latest | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0 | |
with: | |
disable-sudo: true | |
egress-policy: block | |
allowed-endpoints: > | |
files.pythonhosted.org:443 | |
github.com:443 | |
pypi.org:443 | |
- name: Checkout Repository | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
persist-credentials: false | |
- name: Set up Python${{ matrix.python-version }} | |
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0 | |
with: | |
python-version: "3.10" | |
cache: pip | |
- name: Install CI libraries | |
run: | | |
python -m pip install --require-hashes -r CI/requirements_ci.txt | |
- name: Environment Caching | |
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2 | |
with: | |
path: | | |
.tox | |
key: ${{ runner.os }}-${{ hashFiles('pyproject.toml', 'tox.ini') }}-lint-${{ env.ESGF_TEST_DATA_VERSION }} | |
- name: Run linting suite | |
run: | | |
python -m tox -e lint | |
test-pypi: | |
name: Python${{ matrix.python-version }} (PyPI + Tox) | |
needs: lint | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
strategy: | |
matrix: | |
python-version: [ "3.10", "3.11", "3.12", "3.13" ] | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0 | |
with: | |
disable-sudo: true | |
egress-policy: block | |
allowed-endpoints: > | |
coveralls.io:443 | |
files.pythonhosted.org:443 | |
github.com:443 | |
pypi.org:443 | |
raw.githubusercontent.com:443 | |
- name: Checkout Repository | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
persist-credentials: false | |
- name: Set up Python${{ matrix.python-version }} | |
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.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 Caching | |
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2 | |
with: | |
path: | | |
~/.cache/mini-esgf-data | |
~/.cache/xclim-testdata | |
.tox | |
key: ${{ runner.os }}-${{ hashFiles('pyproject.toml', 'tox.ini') }}-Python${{ matrix.python-version }}-${{ env.ESGF_TEST_DATA_VERSION }} | |
- name: Test with tox | |
run: | | |
python -m tox | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
COVERALLS_FLAG_NAME: run-Python${{ matrix.python-version }} | |
COVERALLS_PARALLEL: true | |
COVERALLS_SERVICE_NAME: github | |
test-conda: | |
name: Python${{ matrix.python-version }} (Anaconda) | |
needs: lint | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: [ "3.10", "3.11", "3.12", "3.13" ] | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0 | |
with: | |
disable-sudo: true | |
egress-policy: block | |
allowed-endpoints: > | |
conda.anaconda.org:443 | |
coveralls.io:443 | |
files.pythonhosted.org:443 | |
github.com:443 | |
objects.githubusercontent.com:443 | |
pypi.org:443 | |
raw.githubusercontent.com:443 | |
- name: Checkout Repository | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
persist-credentials: false | |
- name: Setup Conda (Micromamba) with Python${{ matrix.python-version }} | |
uses: mamba-org/setup-micromamba@0dea6379afdaffa5d528b3d1dabc45da37f443fc # v2.0.4 | |
with: | |
cache-downloads: true | |
cache-environment: true | |
environment-file: environment.yml | |
create-args: >- | |
python=${{ matrix.python-version }} | |
pytest-timeout | |
- name: Install CLISOPS | |
run: | | |
python -m pip install --no-user --no-deps --editable . | |
- name: Test Data Caching | |
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2 | |
with: | |
path: | | |
~/.cache/mini-esgf-data | |
~/.cache/xclim-testdata | |
key: ${{ runner.os }}-${{ hashFiles('pyproject.toml', 'tox.ini') }}-conda-Python${{ matrix.python-version }}-${{ env.ESGF_TEST_DATA_VERSION }} | |
- name: Check versions | |
run: | | |
micromamba list | |
python -m pip check || true | |
- name: Test with conda | |
run: | | |
python -m pytest -m "not slow" --timeout=300 --numprocesses=logical --durations=10 --cov=clisops --cov-report=lcov | |
- name: Report Coverage | |
uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b # v2.3.6 | |
with: | |
flag-name: run-Python${{ matrix.python-version }}-conda | |
parallel: true | |
finish: | |
name: Finish | |
needs: | |
- test-pypi | |
- test-conda | |
runs-on: ubuntu-latest | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0 | |
with: | |
disable-sudo: true | |
egress-policy: block | |
allowed-endpoints: > | |
coveralls.io:443 | |
github.com:443 | |
objects.githubusercontent.com:443 | |
- name: Coveralls Finished | |
uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b # v2.3.6 | |
with: | |
parallel-finished: true |