Skip to content

Add pygrep-hooks and mdformat to pre-commit hooks #17396

Add pygrep-hooks and mdformat to pre-commit hooks

Add pygrep-hooks and mdformat to pre-commit hooks #17396

name: CI Upstream
on:
push:
branches:
- main
pull_request:
branches:
- main
types: [opened, reopened, synchronize, labeled]
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
env:
FORCE_COLOR: 3
jobs:
detect-ci-trigger:
name: detect upstream-dev ci trigger
runs-on: ubuntu-latest
if: |
github.repository == 'pydata/xarray'
&& (github.event_name == 'push' || github.event_name == 'pull_request')
outputs:
triggered: ${{ steps.detect-trigger.outputs.trigger-found }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- uses: xarray-contrib/ci-trigger@v1
id: detect-trigger
with:
keyword: "[test-upstream]"
upstream-dev:
name: upstream-dev
runs-on: ubuntu-latest
needs: detect-ci-trigger
env:
ZARR_V3_EXPERIMENTAL_API: 1
if: |
always()
&& (
(github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
|| needs.detect-ci-trigger.outputs.triggered == 'true'
|| contains( github.event.pull_request.labels.*.name, 'run-upstream')
)
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: false
matrix:
python-version: ["3.12"]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for all branches and tags.
- name: Set up conda environment
uses: mamba-org/setup-micromamba@v2
with:
environment-file: ci/requirements/environment.yml
environment-name: xarray-tests
create-args: >-
python=${{ matrix.python-version }}
pytest-reportlog
conda
- name: Install upstream versions
run: |
bash ci/install-upstream-wheels.sh
- name: Install xarray
run: |
python -m pip install --no-deps -e .
- name: Version info
run: |
conda info -a
conda list
python xarray/util/print_versions.py
- name: Import xarray
run: |
python -c 'import xarray'
- name: Run Tests
if: success()
id: status
run: |
python -m pytest --timeout=60 -rf \
--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 == 'pydata'
uses: xarray-contrib/issue-from-pytest-log@v1
with:
log-path: output-${{ matrix.python-version }}-log.jsonl
mypy-upstream-dev:
name: mypy-upstream-dev
runs-on: ubuntu-latest
needs: detect-ci-trigger
if: |
always()
&& (
contains( github.event.pull_request.labels.*.name, 'run-upstream')
)
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: false
matrix:
python-version: ["3.11"]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for all branches and tags.
- name: Set up conda environment
uses: mamba-org/setup-micromamba@v2
with:
environment-file: ci/requirements/environment.yml
environment-name: xarray-tests
create-args: >-
python=${{ matrix.python-version }}
pytest-reportlog
conda
- name: Install upstream versions
run: |
bash ci/install-upstream-wheels.sh
- name: Install xarray
run: |
python -m pip install --no-deps -e .
- name: Version info
run: |
conda info -a
conda list
python xarray/util/print_versions.py
- name: Install mypy
run: |
python -m pip install mypy --force-reinstall
- name: Run mypy
run: |
python -m mypy --install-types --non-interactive --cobertura-xml-report mypy_report
- name: Upload mypy coverage to Codecov
uses: codecov/[email protected]
with:
file: mypy_report/cobertura.xml
flags: mypy
env_vars: PYTHON_VERSION
name: codecov-umbrella
fail_ci_if_error: false