-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add xarray upstream CI workflow with cron job (#1327)
### What kind of change does this PR introduce? * Splits the existing upstream testing stage into its own workflow * This workflow uses xarray-developed actions for opening issues when this workflow fails * Is triggered when a PR is merged to master or every day at midnight. * Can be triggered via cron job or manually (using `workflow_dispatch`) * Unites the CI workflows for PyPI/`tox`-based jobs into one action with a strategy matrix ### Does this PR introduce a breaking change? No. ### Other information: See: corteva/rioxarray#654
- Loading branch information
Showing
4 changed files
with
137 additions
and
72 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: "xclim Testing Suite" | ||
name: xclim Testing Suite | ||
|
||
on: | ||
push: | ||
|
@@ -24,78 +24,109 @@ env: | |
|
||
jobs: | ||
black: | ||
name: Black (Python${{ matrix.python-version }}) | ||
runs-on: ubuntu-latest | ||
if: | | ||
((github.event_name == 'pull_request') && (github.event.action != 'labeled')) || | ||
(github.event.review.state == 'approved') || | ||
(github.event_name == 'push') | ||
strategy: | ||
matrix: | ||
python-version: | ||
- "3.8" | ||
steps: | ||
- name: Cancel previous runs | ||
uses: styfle/[email protected] | ||
with: | ||
access_token: ${{ github.token }} | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python3.8 | ||
- name: Set up Python${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.8" | ||
- name: Install tox | ||
run: pip install tox~=4.0 | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install pylint and tox | ||
run: pip install pylint tox~=4.0 | ||
- name: Run pylint | ||
run: pylint --rcfile=pylintrc --disable=import-error --exit-zero xclim | ||
- name: Run linting suite | ||
run: tox -e black | ||
|
||
test-py38: | ||
name: test-${{ matrix.tox-env }} (Python${{ matrix.python-version }}) | ||
needs: black | ||
if: | | ||
(github.event_name == 'pull_request') && !contains(github.event.pull_request.labels.*.name, 'approved') | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
tox-env: | ||
- "py38" | ||
python-version: | ||
- "3.8" | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python3.8 | ||
- name: Set up Python${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.8" | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install tox | ||
run: pip install tox~=4.0 | ||
- name: Test with tox | ||
run: tox -e py38 | ||
run: tox -e ${{ matrix.tox-env }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
test-py39-upstream-sbck-eofs-coverage: | ||
test-pypi: | ||
needs: black | ||
name: test-${{ matrix.tox-env }} (Python${{ matrix.python-version }}) | ||
if: | | ||
contains(github.event.pull_request.labels.*.name, 'approved') || | ||
(github.event.review.state == 'approved') || | ||
(github.event_name == 'push') | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
include: | ||
- tox-env: py38-coverage | ||
python-version: "3.8" | ||
- tox-env: py39-coverage-sbck-eofs | ||
python-version: "3.9" | ||
- tox-env: notebooks_doctests | ||
python-version: "3.10" | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Install Eigen3 | ||
if: ${{ matrix.tox-env == 'py39-coverage-sbck-eofs' }} | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install libeigen3-dev | ||
- name: Set up Python3.9 | ||
- name: Set up Python${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.9" | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install tox | ||
run: pip install tox~=4.0 | ||
- name: Test with tox | ||
run: tox -e py39-upstream-sbck-eofs-coverage | ||
run: tox -e ${{ matrix.tox-env }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
COVERALLS_FLAG_NAME: run-py39-upstream-sbck-eofs | ||
COVERALLS_FLAG_NAME: run-{{ matrix.tox-env }} | ||
COVERALLS_PARALLEL: true | ||
COVERALLS_SERVICE_NAME: github | ||
|
||
test-py310-opt-slow: | ||
test-conda: | ||
needs: black | ||
name: test-conda-${{ matrix.tox-env }} (Python${{ matrix.python-version }}) | ||
if: | | ||
contains(github.event.pull_request.labels.*.name, 'approved') || | ||
(github.event.review.state == 'approved') || | ||
(github.event_name == 'push') | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
include: | ||
- tox-env: py310 | ||
python-version: "3.10" | ||
defaults: | ||
run: | ||
shell: bash -l {0} | ||
|
@@ -108,22 +139,22 @@ jobs: | |
micromamba-version: 'latest' | ||
environment-file: environment.yml | ||
extra-specs: | | ||
python="3.10" | ||
python=${{ matrix.python-version }} | ||
- name: Conda and Mamba versions | ||
run: | | ||
conda --version | ||
echo "micromamba: $(micromamba --version)" | ||
- name: Install xclim | ||
run: | | ||
python -m pip install --no-user . | ||
- name: Test | ||
- name: Check versions | ||
run: | | ||
pip list | ||
conda list | ||
xclim show_version_info | ||
pip check | ||
- name: Test with pytest | ||
run: | | ||
pytest xclim --numprocesses=logical --durations=10 --cov=xclim --cov-report=term-missing | ||
env: | ||
CONDA_EXE: mamba | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
# - name: Install tox | ||
# shell: bash -l {0} | ||
# run: | | ||
|
@@ -142,63 +173,14 @@ jobs: | |
coveralls | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
COVERALLS_FLAG_NAME: run-py310-opt-slow | ||
COVERALLS_PARALLEL: true | ||
COVERALLS_SERVICE_NAME: github | ||
|
||
test-py38-coverage: | ||
needs: black | ||
if: | | ||
contains(github.event.pull_request.labels.*.name, 'approved') || | ||
(github.event.review.state == 'approved') || | ||
(github.event_name == 'push') | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python3.8 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.8" | ||
- name: Install tox | ||
run: pip install tox~=4.0 | ||
- name: Test with tox | ||
run: tox -e py38-coverage | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
COVERALLS_FLAG_NAME: run-py38-coverage | ||
COVERALLS_PARALLEL: true | ||
COVERALLS_SERVICE_NAME: github | ||
|
||
py38-notebooks_doctests: | ||
needs: black | ||
if: | | ||
contains(github.event.pull_request.labels.*.name, 'approved') || | ||
(github.event.review.state == 'approved') || | ||
(github.event_name == 'push') | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python3.8 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.8" | ||
- name: Install pylint and tox | ||
run: pip install pylint tox~=4.0 | ||
- name: Run pylint | ||
run: pylint --rcfile=pylintrc --disable=import-error --exit-zero xclim | ||
- name: Test with tox | ||
run: tox -e notebooks_doctests | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
COVERALLS_FLAG_NAME: run-py38-notebooks_doctests | ||
COVERALLS_FLAG_NAME: run-{{ matrix.tox-env }}-opt-slow | ||
COVERALLS_PARALLEL: true | ||
COVERALLS_SERVICE_NAME: github | ||
|
||
finish: | ||
needs: | ||
- py38-notebooks_doctests | ||
- test-py38-coverage | ||
- test-py310-opt-slow | ||
- test-pypi | ||
- test-conda | ||
runs-on: ubuntu-latest | ||
container: python:3-slim | ||
steps: | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
name: xclim Upstream dependencies | ||
on: | ||
push: | ||
branches: | ||
- master | ||
paths-ignore: | ||
- CHANGES.rst | ||
- README.rst | ||
- pyproject.toml | ||
- setup.cfg | ||
- xclim/__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 | ||
|
||
jobs: | ||
upstream-dev: | ||
name: test-upstream-dev (Python${{ matrix.python-version }}) | ||
runs-on: ubuntu-latest | ||
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: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 # Fetch all history for all branches and tags. | ||
- name: Set up conda environment | ||
uses: mamba-org/provision-with-micromamba@main | ||
with: | ||
cache-downloads: true | ||
micromamba-version: 'latest' | ||
environment-file: environment.yml | ||
extra-specs: | | ||
python=${{ matrix.python-version }} | ||
pytest-reportlog | ||
- name: Conda and Mamba versions | ||
run: | | ||
conda --version | ||
echo "micromamba: $(micromamba --version)" | ||
- name: Install upstream versions | ||
run: | | ||
python -m pip install -r requirements_upstream.txt | ||
- name: Install xclim | ||
run: | | ||
python -m pip install --no-user --no-deps . | ||
- name: Check versions | ||
run: | | ||
conda list | ||
xclim show_version_info | ||
pip check | ||
- name: Run Tests | ||
if: success() | ||
id: status | ||
run: | | ||
pytest xclim --numprocesses=logical --durations=10 --cov=xclim --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@v1 | ||
with: | ||
log-path: output-${{ matrix.python-version }}-log.jsonl |
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
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