|
| 1 | +name: YAC Optional CI |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + paths: |
| 6 | + - ".github/workflows/yac-optional.yml" |
| 7 | + - "uxarray/remap/**" |
| 8 | + - "test/test_remap_yac.py" |
| 9 | + workflow_dispatch: |
| 10 | + |
| 11 | +jobs: |
| 12 | + yac-optional: |
| 13 | + name: YAC core v3.14.0_p1 (Ubuntu) |
| 14 | + runs-on: ubuntu-latest |
| 15 | + defaults: |
| 16 | + run: |
| 17 | + shell: bash -l {0} |
| 18 | + env: |
| 19 | + YAC_VERSION: v3.14.0_p1 |
| 20 | + YAXT_VERSION: v0.11.5.1 |
| 21 | + MPIEXEC: /usr/bin/mpirun |
| 22 | + MPIRUN: /usr/bin/mpirun |
| 23 | + MPICC: /usr/bin/mpicc |
| 24 | + MPIFC: /usr/bin/mpif90 |
| 25 | + MPIF90: /usr/bin/mpif90 |
| 26 | + OMPI_ALLOW_RUN_AS_ROOT: 1 |
| 27 | + OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1 |
| 28 | + steps: |
| 29 | + - name: checkout |
| 30 | + uses: actions/checkout@v6 |
| 31 | + with: |
| 32 | + token: ${{ github.token }} |
| 33 | + |
| 34 | + - name: conda_setup |
| 35 | + uses: conda-incubator/setup-miniconda@v4 |
| 36 | + with: |
| 37 | + activate-environment: uxarray_build |
| 38 | + channel-priority: strict |
| 39 | + python-version: "3.11" |
| 40 | + channels: conda-forge |
| 41 | + environment-file: ci/environment.yml |
| 42 | + miniforge-variant: Miniforge3 |
| 43 | + miniforge-version: latest |
| 44 | + |
| 45 | + - name: Install build dependencies (apt) |
| 46 | + run: | |
| 47 | + sudo apt-get update |
| 48 | + sudo apt-get install -y \ |
| 49 | + autoconf \ |
| 50 | + automake \ |
| 51 | + gawk \ |
| 52 | + gfortran \ |
| 53 | + libopenmpi-dev \ |
| 54 | + libtool \ |
| 55 | + make \ |
| 56 | + openmpi-bin \ |
| 57 | + pkg-config |
| 58 | + - name: Verify MPI tools |
| 59 | + run: | |
| 60 | + which mpirun |
| 61 | + which mpicc |
| 62 | + which mpif90 |
| 63 | + mpirun --version |
| 64 | + mpicc --version |
| 65 | + mpif90 --version |
| 66 | + - name: Install Python build dependencies |
| 67 | + run: | |
| 68 | + python -m pip install --upgrade pip |
| 69 | + python -m pip install cython wheel |
| 70 | + - name: Build and install YAXT |
| 71 | + run: | |
| 72 | + set -euxo pipefail |
| 73 | + YAC_PREFIX="${GITHUB_WORKSPACE}/yac_prefix" |
| 74 | + echo "YAC_PREFIX=${YAC_PREFIX}" >> "${GITHUB_ENV}" |
| 75 | + git clone --depth 1 --branch "${YAXT_VERSION}" https://gitlab.dkrz.de/dkrz-sw/yaxt.git |
| 76 | + if [ ! -x yaxt/configure ]; then |
| 77 | + if [ -x yaxt/autogen.sh ]; then |
| 78 | + (cd yaxt && ./autogen.sh) |
| 79 | + else |
| 80 | + (cd yaxt && autoreconf -i) |
| 81 | + fi |
| 82 | + fi |
| 83 | + mkdir -p yaxt/build |
| 84 | + cd yaxt/build |
| 85 | + ../configure \ |
| 86 | + --prefix="${YAC_PREFIX}" \ |
| 87 | + --without-regard-for-quality \ |
| 88 | + CC="${MPICC}" \ |
| 89 | + FC="${MPIF90}" |
| 90 | + make -j2 |
| 91 | + make install |
| 92 | + - name: Build and install YAC |
| 93 | + run: | |
| 94 | + set -euxo pipefail |
| 95 | + git clone --depth 1 --branch "${YAC_VERSION}" https://gitlab.dkrz.de/dkrz-sw/yac.git |
| 96 | + if [ ! -x yac/configure ]; then |
| 97 | + if [ -x yac/autogen.sh ]; then |
| 98 | + (cd yac && ./autogen.sh) |
| 99 | + else |
| 100 | + (cd yac && autoreconf -i) |
| 101 | + fi |
| 102 | + fi |
| 103 | + mkdir -p yac/build |
| 104 | + cd yac/build |
| 105 | + ../configure \ |
| 106 | + --prefix="${YAC_PREFIX}" \ |
| 107 | + --with-yaxt-root="${YAC_PREFIX}" \ |
| 108 | + --disable-mci \ |
| 109 | + --disable-utils \ |
| 110 | + --disable-examples \ |
| 111 | + --disable-tools \ |
| 112 | + --disable-netcdf \ |
| 113 | + --enable-python-bindings \ |
| 114 | + CC="${MPICC}" \ |
| 115 | + FC="${MPIF90}" |
| 116 | + make -j2 |
| 117 | + make install |
| 118 | + - name: Configure YAC runtime paths |
| 119 | + run: | |
| 120 | + set -euxo pipefail |
| 121 | + PY_VER="$(python -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")')" |
| 122 | + echo "LD_LIBRARY_PATH=${YAC_PREFIX}/lib:${LD_LIBRARY_PATH:-}" >> "${GITHUB_ENV}" |
| 123 | + echo "PYTHONPATH=${YAC_PREFIX}/lib/python${PY_VER}/site-packages:${YAC_PREFIX}/lib/python${PY_VER}/dist-packages:${PYTHONPATH:-}" >> "${GITHUB_ENV}" |
| 124 | + - name: Verify YAC core Python bindings |
| 125 | + run: | |
| 126 | + python - <<'PY' |
| 127 | + from pathlib import Path |
| 128 | + import sys |
| 129 | + candidates = [] |
| 130 | + for entry in sys.path: |
| 131 | + pkg = Path(entry) / "yac" |
| 132 | + candidates.extend(pkg.glob("core*.so")) |
| 133 | + candidates.extend(pkg.glob("core*.pyd")) |
| 134 | + assert candidates, "yac.core extension not found on sys.path" |
| 135 | + print("Found yac.core extension:", candidates[0]) |
| 136 | + PY |
| 137 | + - name: Install uxarray |
| 138 | + run: | |
| 139 | + python -m pip install . --no-deps |
| 140 | + - name: Run tests (uxarray with YAC) |
| 141 | + run: | |
| 142 | + python -m pytest test/test_remap_yac.py |
0 commit comments