Test Upstream Dependencies #313
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: Test Upstream Dependencies | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- CHANGELOG.rst | |
- README.rst | |
- pyproject.toml | |
- 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 | |
permissions: | |
contents: read | |
jobs: | |
upstream-dev: | |
name: test-upstream-dev (Python${{ matrix.python-version }}) | |
runs-on: ubuntu-latest | |
permissions: | |
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@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 | |
with: | |
disable-sudo: true | |
egress-policy: block | |
allowed-endpoints: > | |
api.github.com:443 | |
conda.anaconda.org:443 | |
dap.service.does.not.exist:443 | |
files.pythonhosted.org:443 | |
github.com:443 | |
objects.githubusercontent.com:443 | |
pypi.org:443 | |
raw.githubusercontent.com:443 | |
repo.anaconda.com:443 | |
- name: Checkout Repository | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
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@f8b8a1e23a26f60a44c853292711bacfd3eac822 # v1.9.0 | |
with: | |
cache-downloads: true | |
cache-environment: true | |
environment-file: environment.yml | |
create-args: >- | |
eigen | |
pybind11 | |
python=${{ matrix.python-version }} | |
pytest-reportlog | |
- name: Micromamba version | |
run: | | |
echo "micromamba: $(micromamba --version)" | |
- name: Install upstream versions and SBCK | |
run: | | |
# git-based dependencies cannot be installed from hashes | |
python -m pip install -r CI/requirements_upstream.txt | |
python -m pip install "sbck @ git+https://github.com/yrobink/SBCK-python.git@master" | |
- name: Install xclim | |
run: | | |
python -m pip install --no-user --no-deps --editable . | |
- name: Check versions | |
run: | | |
micromamba list | |
xclim show_version_info | |
python -m pip check || true | |
- name: Run Tests | |
if: success() | |
id: status | |
run: | | |
python -m pytest --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@f94477e45ef40e4403d7585ba639a9a3bcc53d43 # v1.3.0 | |
with: | |
log-path: output-${{ matrix.python-version }}-log.jsonl |