[pre-commit.ci] pre-commit autoupdate (#22) #112
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: raven-hydro Testing Suite | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
black: | |
name: Code linting | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- name: Cancel previous runs | |
uses: styfle/[email protected] | |
with: | |
access_token: ${{ github.token }} | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.9" | |
- name: Install pre-commit | |
run: | | |
pip install pre-commit | |
- name: Run linting suite | |
run: | | |
pre-commit run --all-files | |
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"] | |
os: ["ubuntu-latest", "macos-latest"] | |
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" | |
os: macos-latest | |
conda: true | |
- python-version: "3.11" | |
os: ubuntu-latest | |
conda: false | |
install_args: "-Ccmake.define.USE_NETCDF=false" | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python${{ matrix.python-version }} | |
if: ${{ !matrix.conda }} | |
id: pyinstalled | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Set up Python${{ matrix.python-version }} with NetCDF4 (conda) | |
if: ${{ matrix.conda }} | |
uses: mamba-org/setup-micromamba@v1 | |
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@v1 | |
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: Test raven-hydro | |
if: ${{ !matrix.conda }} | |
run: | | |
${{ 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: Test raven-hydro (conda) | |
if: ${{ matrix.conda }} | |
run: | | |
python -c "import raven_hydro; print(f'raven_hydro version: {raven_hydro.__version__}')" | |
- name: Test raven | |
run: | | |
raven -v |