CI #1837
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: CI | |
on: | |
push: | |
branches: | |
- "main" | |
pull_request: | |
branches: | |
- "*" | |
schedule: | |
- cron: "0 13 * * 1" | |
concurrency: | |
group: ${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
COLUMNS: 120 | |
jobs: | |
build: | |
name: Build (${{ matrix.python-version }}, ${{ matrix.os }}) | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
shell: bash -l {0} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: ["ubuntu-latest"] | |
python-version: ["3.10", "3.12"] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Fetch all history for all branches and tags. | |
- name: Set environment variables | |
run: | | |
echo "PYTHON_VERSION=${{ matrix.python-version }}" >> $GITHUB_ENV | |
- name: Set up conda environment | |
uses: mamba-org/setup-micromamba@v2 | |
with: | |
environment-file: ci/environment.yml | |
environment-name: cf_xarray_test | |
cache-environment: true | |
create-args: >- | |
python=${{ matrix.python-version }} | |
- name: Install cf_xarray | |
run: | | |
python -m pip install --no-deps -e . | |
- name: Run Tests | |
run: | | |
pytest -n auto --cov=./ --cov-report=xml | |
- name: Upload code coverage to Codecov | |
uses: codecov/[email protected] | |
with: | |
file: ./coverage.xml | |
flags: unittests | |
env_vars: RUNNER_OS,PYTHON_VERSION | |
name: codecov-umbrella | |
fail_ci_if_error: false | |
no-optional-deps: | |
name: no-optional-deps | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
# need to fetch all tags to get a correct version | |
fetch-depth: 0 # fetch all branches and tags | |
- name: Set up conda environment | |
uses: mamba-org/setup-micromamba@v2 | |
with: | |
environment-file: ci/environment-no-optional-deps.yml | |
environment-name: cf_xarray_test | |
cache-environment: true | |
- name: Install cf_xarray | |
run: | | |
python -m pip install --no-deps -e . | |
- name: Run Tests | |
shell: bash -l {0} | |
run: | | |
pytest -n 2 | |
mypy: | |
name: mypy | |
runs-on: "ubuntu-latest" | |
defaults: | |
run: | |
shell: bash -l {0} | |
strategy: | |
matrix: | |
python-version: ["3.10", "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/environment.yml | |
environment-name: cf_xarray_test | |
cache-environment: true | |
create-args: >- | |
python=${{ matrix.python-version }} | |
- name: Install cf_xarray | |
run: | | |
python -m pip install --no-deps -e . | |
- name: Install mypy | |
run: | | |
python -m pip install 'mypy' | |
- name: Run mypy | |
run: | | |
python -m mypy --install-types --non-interactive --cobertura-xml-report mypy_report cf_xarray/ | |
- 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 |