update paths #46
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: CI | ||
| on: | ||
| push: | ||
| branches: [ main ] | ||
| pull_request: | ||
| branches: [ main ] | ||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
| jobs: | ||
| lint: | ||
| name: pre-commit | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.13' | ||
| cache: 'pip' | ||
| - name: Install Poetry | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| python -m pip install pipx | ||
| pipx install poetry | ||
| poetry --version | ||
| - name: Enable in-project venv for better caching | ||
| run: poetry config virtualenvs.in-project true | ||
| - name: Cache virtualenv | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: .venv | ||
| key: venv-${{ runner.os }}-py${{ hashFiles('**/poetry.lock') }} | ||
| restore-keys: | | ||
| venv-${{ runner.os }}- | ||
| - name: Install deps (incl. dev) | ||
| run: poetry install --no-interaction --no-ansi | ||
| - name: Run pre-commit on all files | ||
| run: poetry run pre-commit run --all-files | ||
| tests: | ||
| name: pytest (matrix) | ||
| runs-on: ubuntu-latest | ||
| needs: lint | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| python-version: ['3.10', '3.x'] | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| - name: Set up Python ${{ matrix.python-version }} | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
| 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: Install Poetry | ||
| run: | | ||
| python -m pip install --upgrade pip pipx | ||
| pipx install poetry | ||
| poetry --version | ||
| poetry config virtualenvs.in-project true | ||
| poetry install --no-interaction --no-ansi | ||
| # Install esmpy into Poetry’s venv, pointing it at ESMF | ||
| - name: Install esmpy (From ESMF repo) | ||
| env: | ||
| ESMFMKFILE: ${{ env.ESMFMKFILE }} | ||
| ESMF_ROOT: ${{ env.ESMF_ROOT }} | ||
| LD_LIBRARY_PATH: ${{ env.ESMF_INSTALL_PREFIX }}/lib:${{ env.LD_LIBRARY_PATH }} | ||
| run: | | ||
| poetry run python -m pip --no-build-isolation --no-deps \ | ||
| "git+https://github.com/esmf-org/[email protected]#subdirectory=src/addon/ESMPy" | ||
| poetry run python -m pip install xesmf dask | ||
| - name: Cache virtualenv | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: .venv | ||
| key: venv-${{ runner.os }}-py${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }} | ||
| restore-keys: | | ||
| venv-${{ runner.os }}-py${{ matrix.python-version }}- | ||
| 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 | ||