fix pytest #14
Workflow file for this run
This file contains hidden or 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: pytest | ||
| on: | ||
| push: | ||
| branches: [ main ] | ||
| pull_request: | ||
| branches: [ main ] | ||
| jobs: | ||
| tests: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.12' | ||
| cache: 'pip' | ||
| - name: Install NetCDF | ||
| run: sudo apt-get update && sudo apt-get install -y libnetcdf-dev libnetcdff-dev | ||
| - name: Install ESMF | ||
| uses: esmf-org/install-esmf-action@v1 | ||
| env: | ||
| ESMF_NETCDF: nc-config | ||
| ESMF_INSTALL_PREFIX: $HOME/ESMF | ||
| with: | ||
| version: latest | ||
| esmpy: false | ||
| - name: Pin esmpy to ESMF tag | ||
| run: | | ||
| set -euo pipefail | ||
| # VER=$(awk -F= '/^ESMF_VERSION_STRING[[:space:]]*=/{gsub(/[[:space:]]*/,"",$2); print $2}' "$MK") | ||
| # # Normalize to plain semver if needed (drop anything after first non-semver char) | ||
| # VER_CLEAN=$(python - "$VER" <<'PY' | ||
| #import re, sys | ||
| ## | ||
| #print(m.group(1) if m else v) | ||
| #PY | ||
| #) | ||
| TAG="v8.9.0" | ||
| echo "using ESMPy tag ${TAG}" | ||
| # remove any existing esmpy dep and add the exact git subdir tag | ||
| poetry remove esmpy || true | ||
| poetry add --lock --no-interaction \ | ||
| "esmpy@git+https://github.com/esmf-org/esmf.git@${TAG}#subdirectory=src/addon/esmpy" | ||
| - name: Install Poetry | ||
| run: | | ||
| python -m pip install --upgrade pip pipx | ||
| pipx install poetry | ||
| poetry --version | ||
| poetry config virtualenvs.in-project true | ||
| poetry env use "$(python -c 'import sys; print(sys.executable)')" | ||
| poetry install --no-interaction --no-ansi | ||
| poetry run python -c "import esmpy; print('ESMPy:', esmpy.__version__)" | ||
| - name: Cache virtualenv | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: .venv | ||
| key: venv-${{ runner.os }}-py${{ hashFiles('**/poetry.lock') }} | ||
| restore-keys: | | ||
| venv-${{ runner.os }}- | ||
| - name: Run pytest | ||
| env: | ||
| ESMFMKFILE: ${{ env.ESMFMKFILE }} | ||
| LD_LIBRARY_PATH: ${{ env.ESMF_INSTALL_PREFIX }}/lib:${{ env.LD_LIBRARY_PATH }} | ||
| run: poetry run pytest -q | ||