Prepare version 0.3.2 (#63) #261
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: Testing | |
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' }} | |
permissions: | |
contents: read | |
jobs: | |
black: | |
name: Code linting | |
runs-on: ubuntu-latest | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 | |
with: | |
disable-sudo: true | |
egress-policy: block | |
allowed-endpoints: > | |
files.pythonhosted.org:443 | |
github.com:443 | |
proxy.golang.org:443 | |
pypi.org:443 | |
storage.googleapis.com:443 | |
sum.golang.org:443 | |
- name: Checkout Repository | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Setup Python3 | |
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 | |
with: | |
python-version: "3.x" | |
cache: "pip" | |
- name: Run pre-commit hooks | |
uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1 | |
build-windows: | |
name: Python${{ matrix.python-version }} (Windows, conda=${{ matrix.conda }}) | |
needs: black | |
runs-on: 'windows-latest' | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: [ "3.9", "3.13" ] | |
conda: [ true, false ] | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
# Harden Runner does not support Windows virtual environments | |
- name: Checkout Repository | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
fetch-depth: 0 | |
submodules: true | |
- name: Setup Python${{ matrix.python-version }} | |
if: ${{ !matrix.conda }} | |
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: "pip" | |
- name: Set up Python${{ matrix.python-version }} with NetCDF4 (conda) | |
if: ${{ matrix.conda }} | |
uses: mamba-org/setup-micromamba@617811f69075e3fd3ae68ca64220ad065877f246 # v2.0.0 | |
with: | |
cache-downloads: true | |
cache-environment: true | |
environment-file: environment.yml | |
create-args: >- | |
python=${{ matrix.python-version }} | |
post-cleanup: 'all' | |
- name: Install raven-hydro | |
if: ${{ !matrix.conda }} | |
run: | | |
python -m pip install --editable . -C cmake.define.USE_NETCDF=false | |
- name: Install raven-hydro | |
if: ${{ matrix.conda }} | |
run: | | |
python -m pip install --editable . | |
- name: Check versions | |
run: | | |
python -m pip list | |
python -m pip check | |
- name: Test raven-hydro | |
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 | |
build-unix: | |
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.9", "3.10", "3.11", "3.12", "3.13"] | |
os: | |
- ubuntu-latest | |
# - macos-latest # macOS with Apple Silicon is not supported yet | |
conda: [ true, false ] | |
install_args: [ "" ] | |
include: | |
- python-version: "3.12" | |
os: ubuntu-latest | |
conda: false | |
install_args: "-C cmake.define.USE_NETCDF=false" | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 | |
with: | |
egress-policy: block | |
allowed-endpoints: > | |
api.github.com:443 | |
azure.archive.ubuntu.com:80 | |
conda.anaconda.org:443 | |
esm.ubuntu.com:443 | |
files.pythonhosted.org:443 | |
github.com:443 | |
motd.ubuntu.com:443 | |
objects.githubusercontent.com:443 | |
packages.microsoft.com:443 | |
pypi.org:443 | |
repo.anaconda.com:443 | |
- name: Checkout Repository | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
fetch-depth: 0 | |
submodules: true | |
- name: Setup Python${{ matrix.python-version }} | |
if: ${{ !matrix.conda }} | |
id: pyinstalled | |
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: "pip" | |
- name: Set up Python${{ matrix.python-version }} with NetCDF4 (conda) | |
if: ${{ matrix.conda }} | |
uses: mamba-org/setup-micromamba@617811f69075e3fd3ae68ca64220ad065877f246 # v2.0.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@b9c066b79607fa3d71e0be05d7003bb75fd9ff34 # v1.3.0 | |
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 |