Specify files instead of globbing, enable logging, add testing #6
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: pytests | |
| on: [push, pull_request] | |
| env: | |
| g2c_VERSION: 2.2.0 | |
| CC: gcc-14 | |
| jobs: | |
| cache-g2c: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: true | |
| name: Build and cache g2c library | |
| steps: | |
| - name: apt-get and install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libaec-dev libpng-dev zlib1g-dev libjpeg-dev libopenjp2-7-dev | |
| - name: Cache g2c installation | |
| id: cache-g2c | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| g2c-${{ env.g2c_VERSION }} | |
| key: g2c-${{ env.g2c_VERSION }} | |
| - name: Checkout, build and install g2c | |
| if: steps.cache-g2c.outputs.cache-hit != 'true' | |
| run: | | |
| wget https://github.com/NOAA-EMC/NCEPLIBS-g2c/archive/refs/tags/v${{ env.g2c_VERSION }}.tar.gz | |
| tar -xzvf v${{ env.g2c_VERSION }}.tar.gz | |
| cd NCEPLIBS-g2c-${{ env.g2c_VERSION }} | |
| mkdir build && cd build | |
| cmake -DUSE_Jasper=OFF -DUSE_OpenJPEG=ON -DBUILD_PNG=ON -DBUILD_AEC=ON -DBUILD_SHARED_LIBS=OFF \ | |
| -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/g2c-${{ env.g2c_VERSION }} .. | |
| make -j2 | |
| make install | |
| run_pytests: | |
| runs-on: ubuntu-latest | |
| name: Install and run tests with pytests | |
| needs: cache-g2c | |
| strategy: | |
| matrix: | |
| #python: ["3.11", "3.12", "3.13"] | |
| python: ["3.12"] # Temporarily only test with 3.12 for faster CI | |
| steps: | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python }} | |
| - name: Install (upgrade) python dependencies | |
| run: | | |
| pip install --upgrade pip | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install | |
| run: | | |
| export G2C_STATIC=True | |
| export G2C_DIR=${{ github.workspace }}/g2c-${{ env.g2c_VERSION }} | |
| cd $GITHUB_WORKSPACE | |
| pip install .[dev] | |
| - name: Run pytests | |
| run: | | |
| cd $GITHUB_WORKSPACE | |
| pytest -v |