merge to latest main #57
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 build-essential libnetcdf-dev libnetcdff-dev libudunits2-dev \ | |
| libjson-c-dev uuid-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: true | |
| cache: true | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Cache CMOR build | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| /home/runner/cmor | |
| /home/runner/cmor3-source | |
| /home/runner/.cache/pip | |
| key: cmor-${{ runner.os }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('**/cmor_version.txt') }} | |
| restore-keys: | | |
| cmor-${{ runner.os }}- | |
| - name: build and install cmor | |
| run: | | |
| if [ ! -d "$HOME/cmor" ]; then | |
| git clone https://github.com/PCMDI/cmor.git $HOME/cmor3-source | |
| cd $HOME/cmor3-source | |
| ./configure --prefix=$HOME/cmor --with-netcdf=/usr/local --with-udunits2=/usr/local | |
| make | |
| make install | |
| pip install . | |
| else | |
| cd /home/runner/cmor3-source | |
| pip install . | |
| fi | |
| - name: Run pytest | |
| env: | |
| PYTHONPATH: ${{ github.workspace }} | |
| ESMFMKFILE: ${{ env.ESMFMKFILE }} | |
| LD_LIBRARY_PATH: ${{ env.ESMF_INSTALL_PREFIX }}/lib:${{ env.LD_LIBRARY_PATH }} | |
| run: | | |
| #pip uninstall -y cmip7-prep || true | |
| #pip install . | |
| pytest -q --doctest-modules --cov=cmip7_prep --cov-report=xml | |
| - name: Upload coverage report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-xml | |
| path: coverage.xml |