Skip to content

[pre-commit.ci] pre-commit autoupdate #1481

[pre-commit.ci] pre-commit autoupdate

[pre-commit.ci] pre-commit autoupdate #1481

Workflow file for this run

name: RavenPy
on:
push:
branches:
- master
pull_request:
env:
RAVEN_TESTING_DATA_BRANCH: master
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
permissions:
contents: read
jobs:
lint:
name: Code linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install tox and setuptools
run: |
pip install tox
- name: Run linting suite
run: tox -e black
pip:
name: Python${{ matrix.python-version }} (${{ matrix.os }}, upstream=${{ matrix.upstream-branch }})
needs: lint
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- tox-env: py39-linux
python-version: "3.9"
os: ubuntu-latest
# - tox-env: py39-macos
# python-version: "3.9"
# os: macos-latest
- tox-env: py310-linux-upstream
python-version: "3.10"
os: ubuntu-latest
upstream-branch: "main"
# - tox-env: py310-macos-upstream
# python-version: "3.10"
# os: macos-latest
# upstream-branch: "main"
- tox-env: py311-linux
python-version: "3.11"
os: ubuntu-latest
# - tox-env: py311-macos
# python-version: "3.11"
# os: macos-latest
- tox-env: py312-linux
python-version: "3.12"
os: ubuntu-latest
# - tox-env: py312-macos
# python-version: "3.12"
# os: macos-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install GDAL (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install libgdal-dev
- name: Install GDAL (macOS)
if: matrix.os == 'macos-latest'
uses: tecolicom/actions-use-homebrew-tools@v1
with:
tools: gdal
cache: yes
- name: Set GDAL_VERSION (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
echo "GDAL_VERSION=$(gdal-config --version)" >> $GITHUB_ENV
- name: Set GDAL_VERSION (macOS)
if: matrix.os == 'macos-latest'
run: |
echo "GDAL_VERSION=$(gdalinfo --version | awk '{print $2}' | sed s'/.$//')" >> $GITHUB_ENV
- name: Install tox
run: |
python3 -m pip install tox~=4.5.0
- name: Test with tox and report coverage
run: |
python3 -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
UPSTREAM_BRANCH: ${{ matrix.upstream-branch }}
conda:
name: Python${{ matrix.python-version }} (${{ matrix.os }}) (Conda)
needs: lint
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
# - macos-latest # disabled until a new build of raven-hydro is available
# - windows-latest # disabled until xesmf is available
python-version: ["3.9", "3.10", "3.11", "3.12"]
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
- name: Patch Environment File
if: matrix.os == 'windows-latest'
run: |
sed -i 's/climpred >=2.4.0/xesmf/' environment.yml
- name: Setup Conda (Micromamba) with Python${{ matrix.python-version }}
uses: mamba-org/setup-micromamba@v1
with:
cache-downloads: true
cache-environment: true
cache-environment-key: environment-${{ matrix.python-version }}-${{ matrix.os }}-${{ github.head_ref }}
environment-file: environment.yml
create-args: >-
conda
python=${{ matrix.python-version }}
- name: Conda and Mamba versions
run: |
conda --version
echo "micromamba: $(micromamba --version)"
- name: Install RavenPy
run: |
python -m pip install -e ".[dev]"
- name: List installed packages
run: |
conda list
python -m pip check || true
- name: Test RavenPy
run: |
python -m pytest --cov --numprocesses=logical
- name: Report coverage
run: |
python -m coveralls
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: run-conda_${{ matrix.python-version }}_${{ matrix.os }}
COVERALLS_PARALLEL: true
COVERALLS_SERVICE_NAME: github
finish:
needs:
- pip
- conda
runs-on: ubuntu-latest
container: python:3-slim
steps:
- name: Coveralls Finished
run: |
python -m pip install --upgrade coveralls
python -m coveralls --finish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_SERVICE_NAME: github