Merge pull request #362 from roocs/dependabot/github_actions/pypa/gh-… #977
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 | |
permissions: | |
contents: read | |
jobs: | |
lint: | |
name: Linting Suite | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
tox-env: | |
- lint | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Set up Python${{ matrix.python-version }} | |
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 | |
with: | |
python-version: "3.9" | |
cache: pip | |
- name: Install tox | |
run: | | |
python -m pip install tox~=4.18.0 | |
- name: Environment Caching | |
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.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 ${{ matrix.tox-env }} | |
pypi: | |
name: Python${{ matrix.python-version }} (PyPI + Tox) | |
needs: lint | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
strategy: | |
matrix: | |
include: | |
- python-version: "3.9" | |
tox-env: py39 | |
- python-version: "3.10" | |
tox-env: py310 | |
- python-version: "3.11" | |
tox-env: py311 | |
- python-version: "3.12" | |
tox-env: py312 | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Set up Python${{ matrix.python-version }} | |
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: "pip" | |
- name: Install tox | |
run: | | |
python -m pip install tox~=4.18.0 | |
- name: Environment Caching | |
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.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 -e ${{ matrix.tox-env }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
COVERALLS_FLAG_NAME: run-${{ matrix.tox-env }} | |
COVERALLS_PARALLEL: true | |
COVERALLS_SERVICE_NAME: github | |
conda: | |
name: Python${{ matrix.python-version }} (Anaconda, upstream=${{ matrix.upstream }}) | |
needs: lint | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- python-version: "3.9" | |
upstream: false | |
- python-version: "3.10" | |
upstream: false | |
- python-version: "3.11" | |
upstream: false | |
# - python-version: "3.12" # Not yet available until https://github.com/pydata/xarray/issues/7794 is resolved | |
# upstream: false | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Setup Conda (Micromamba) with Python${{ matrix.python-version }} | |
uses: mamba-org/setup-micromamba@617811f69075e3fd3ae68ca64220ad065877f246 # v2.0.0 | |
with: | |
cache-downloads: true | |
cache-environment: true | |
environment-file: environment.yml | |
create-args: >- | |
python=${{ matrix.python-version }} | |
micromamba-version: "1.5.10-0" # pinned to avoid the breaking changes with mamba and micromamba (2.0.0). | |
- name: Install CLISOPS | |
run: | | |
python -m pip install --no-user --editable ".[dev]" | |
- name: Install upstream dependencies | |
if: ${{ matrix.upstream }} | |
run: | | |
python -m pip install -r requirements_upstream.txt | |
- name: Test Data Caching | |
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.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 --numprocesses=logical --durations=10 --cov=clisops --cov-report=term-missing | |
finish: | |
needs: | |
- pypi | |
- conda | |
runs-on: ubuntu-latest | |
container: python:3-slim | |
steps: | |
- name: Coveralls Finished | |
run: | | |
python -m pip install --upgrade coveralls | |
coveralls --finish | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
COVERALLS_SERVICE_NAME: github |