Skip to content

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

[pre-commit.ci] pre-commit autoupdate

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

Workflow file for this run

name: raven-hydro Testing Suite
on:
push:
branches:
- main
pull_request:
concurrency:
# For a given workflow, if we push to the same branch, cancel all previous builds on that branch except on main.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
black:
name: Code linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- uses: pre-commit/action@v3.0.1
build:
name: Python${{ matrix.python-version }} (${{ matrix.os }}, conda=${{ matrix.conda }}, args=${{ matrix.install_args }})
needs: black
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
os:
- ubuntu-latest
# - macos-latest # macOS with Apple Silicon is not supported yet
conda: [false]
install_args: [""]
include:
- python-version: "3.8"
os: windows-latest
conda: true
- python-version: "3.9"
os: ubuntu-latest
conda: true
- python-version: "3.10"
os: ubuntu-latest
conda: true
- python-version: "3.10"
os: windows-latest
conda: true
# - python-version: "3.10" # macOS with Apple Silicon is not supported yet
# os: macos-latest
# conda: true
- python-version: "3.11"
os: ubuntu-latest
conda: false
install_args: "-Ccmake.define.USE_NETCDF=false"
- python-version: "3.12"
os: ubuntu-latest
conda: true
defaults:
run:
shell: bash -l {0}
steps:
- name: Harden Runner
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
with:
egress-policy: audit
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
fetch-depth: 0
submodules: true
- name: Set up Python${{ matrix.python-version }}
if: ${{ !matrix.conda }}
id: pyinstalled
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: ${{ matrix.python-version }}
- name: Set up Python${{ matrix.python-version }} with NetCDF4 (conda)
if: ${{ matrix.conda }}
uses: mamba-org/setup-micromamba@f8b8a1e23a26f60a44c853292711bacfd3eac822 # v1.9.0
with:
cache-downloads: true
cache-environment: true
environment-file: environment.yml
create-args: >-
python=${{ matrix.python-version }}
- name: Install NetCDF4 (Ubuntu/apt)
if: (matrix.os == 'ubuntu-latest') && (!matrix.install_args) && (!matrix.conda)
run: |
sudo apt-get update
sudo apt-get install libnetcdf-dev
- name: Install NetCDF4 (macOS/homebrew)
if: (matrix.os == 'macos-latest') && (!matrix.conda)
uses: tecolicom/actions-use-homebrew-tools@5c37fd17a71166ce64ee8ba712f6f2b8c4e6089a # v1.2
with:
tools: netcdf
cache: yes
- name: Check for OPeNDAP Support
if: (!matrix.install_args)
run: |
nc-config --has-dap
- name: Install raven-hydro
if: ${{ !matrix.conda }}
run: |
${{ steps.pyinstalled.outputs.python-path }} -m pip install --editable . ${{ matrix.install_args }}
- name: Check versions
if: ${{ !matrix.conda }}
run: |
${{ steps.pyinstalled.outputs.python-path }} -m pip list
${{ steps.pyinstalled.outputs.python-path }} -m pip check || true
- name: Test raven-hydro
if: ${{ !matrix.conda }}
run: |
${{ steps.pyinstalled.outputs.python-path }} -c "import raven_hydro; print(f'Description: {raven_hydro.__doc__}')"
${{ steps.pyinstalled.outputs.python-path }} -c "import raven_hydro; print(f'Built with netcdf: {raven_hydro.__netcdf__}')"
${{ steps.pyinstalled.outputs.python-path }} -c "import raven_hydro; print(f'RavenHydroFramework version: {raven_hydro.__raven_version__}')"
${{ steps.pyinstalled.outputs.python-path }} -c "import raven_hydro; print(f'raven_hydro version: {raven_hydro.__version__}')"
- name: Install raven-hydro (conda)
if: ${{ matrix.conda }}
run: |
python -m pip install --editable . ${{ matrix.install_args }}
- name: Check versions
if: ${{ matrix.conda }}
run: |
micromamba list
python -m pip list
python -m pip check || true
- name: Test raven-hydro (conda)
if: ${{ matrix.conda }}
run: |
python -c "import raven_hydro; print(f'Description: {raven_hydro.__doc__}')"
python -c "import raven_hydro; print(f'Built with netcdf: {raven_hydro.__netcdf__}')"
python -c "import raven_hydro; print(f'RavenHydroFramework version: {raven_hydro.__raven_version__}')"
python -c "import raven_hydro; print(f'raven_hydro version: {raven_hydro.__version__}')"
- name: Test raven
run: |
raven -v