|
| 1 | +# Run the uPSP project build system and unit tests. |
| 2 | +# Artifacts are installed into the runner's system Python 3 environment. |
| 3 | +# |
| 4 | +# Notes: |
| 5 | +# |
| 6 | +# - Initially considered installing all dependencies via system |
| 7 | +# package manager, but encountered some GH-specific "pain points" |
| 8 | +# (e.g., HDF5 v1.12 is not supported out-of-box by ubuntu-latest). |
| 9 | +# Simpler and more robust to manage with third-party C/C++ package |
| 10 | +# manager like vcpkg. |
| 11 | +# |
| 12 | +# - Some system dependencies may not be needed... accidentally tried |
| 13 | +# vcpkg install without explicitly disabling default opencv4 features |
| 14 | +# which include a LOT of extras with frontend library deps like x11. |
| 15 | +# TODO consider pruning at a later date. |
| 16 | +# |
| 17 | +# - Making use of third-party actions for improved caching + invocation |
| 18 | +# of CMake and vcpkg. Ref: https://github.com/marketplace/actions/run-vcpkg |
| 19 | +# Recommendations from author highlight using vcpkg as a Git submodule... |
| 20 | +# this is NOT desirable in our case because for native deployment to |
| 21 | +# HPC clusters, oftentimes the user-supplied /home folder has quite limited |
| 22 | +# storage and is not appropriate for caching lots of external submodules. |
| 23 | +# Instead, we pin the vcpkg release here (vcpkgGitCommitId) and maintain |
| 24 | +# consistency manually. |
| 25 | +# |
| 26 | +# - On NAS HECC systems, we build the C/C++ code with dynamic linkage due |
| 27 | +# to the available system dependencies. This is *not* a default |
| 28 | +# target supported by vcpkg, but it has a lot of community interest and |
| 29 | +# "unofficial" testing support. Ref: https://github.com/microsoft/vcpkg/issues/15006 |
| 30 | +# We patch up some of the RPATH quirks using 'patchelf'. |
| 31 | +# |
| 32 | +name: unit-tests |
| 33 | +on: |
| 34 | + push: |
| 35 | + workflow_dispatch: |
| 36 | + |
| 37 | +jobs: |
| 38 | + job: |
| 39 | + name: ${{ matrix.os }}-${{ github.workflow }} |
| 40 | + runs-on: ${{ matrix.os }} |
| 41 | + strategy: |
| 42 | + fail-fast: false |
| 43 | + matrix: |
| 44 | + os: [ubuntu-latest] |
| 45 | + # Python v3.9 is latest version supported by NAS HECC systems |
| 46 | + # Main obstacle to upgrading is "pinned" opencv 4.5.12 dependency |
| 47 | + python-version: ['3.9.16'] |
| 48 | + env: |
| 49 | + VCPKG_INSTALLED_DIR: ${{ github.workspace }}/vcpkg/installed |
| 50 | + VCPKG_DEFAULT_TRIPLET: x64-linux-dynamic |
| 51 | + |
| 52 | + steps: |
| 53 | + - uses: actions/checkout@v3 |
| 54 | + - uses: lukka/get-cmake@latest |
| 55 | + - name: Install dependencies (Linux) |
| 56 | + run: | |
| 57 | + sudo apt-get update -y |
| 58 | + sudo apt-get install -y \ |
| 59 | + autoconf \ |
| 60 | + bison \ |
| 61 | + gperf \ |
| 62 | + nasm \ |
| 63 | + patchelf \ |
| 64 | + libdbus-1-dev \ |
| 65 | + libgles2-mesa-dev \ |
| 66 | + libopenmpi-dev \ |
| 67 | + libtool \ |
| 68 | + libx11-dev \ |
| 69 | + libxcursor-dev \ |
| 70 | + libxdamage-dev \ |
| 71 | + libxext-dev \ |
| 72 | + libxft-dev \ |
| 73 | + libxi-dev \ |
| 74 | + libxinerama-dev \ |
| 75 | + libxrandr-dev \ |
| 76 | + libxtst-dev |
| 77 | + if: matrix.os == 'ubuntu-latest' |
| 78 | + - name: Restore from cache and setup vcpkg executable and data files. |
| 79 | + uses: lukka/run-vcpkg@v11 |
| 80 | + with: |
| 81 | + vcpkgJsonGlob: '.github/workflows/vcpkg.json' |
| 82 | + runVcpkgInstall: true |
| 83 | + # Release 2023.04.15 |
| 84 | + vcpkgGitCommitId: '501db0f17ef6df184fcdbfbe0f87cde2313b6ab1' |
| 85 | + - name: Patch vcpkg library headers with patchelf |
| 86 | + run: | |
| 87 | + cd vcpkg |
| 88 | + ${{ github.workspace }}/.github/workflows/vcpkg-fix-rpaths |
| 89 | + cd .. |
| 90 | + - uses: actions/setup-python@v4 |
| 91 | + with: |
| 92 | + python-version: ${{ matrix.python-version }} |
| 93 | + cache: 'pip' |
| 94 | + - name: Upgrade pip to v23+ |
| 95 | + run: | |
| 96 | + pip install --upgrade pip |
| 97 | + pip --version |
| 98 | + python --version |
| 99 | + - name: Run build+install with pip |
| 100 | + run: | |
| 101 | + SKBUILD_CONFIGURE_OPTIONS=\ |
| 102 | + " -DCMAKE_TOOLCHAIN_FILE=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"\ |
| 103 | + " -DVCPKG_TARGET_TRIPLET=x64-linux-dynamic" pip install -v . |
| 104 | + # - name: Setup upterm session |
| 105 | + # uses: lhotari/action-upterm@v1 |
| 106 | + - name: Run C/C++ unit tests |
| 107 | + # TODO this should be made cross-platform. Currently works only for ubuntu-latest |
| 108 | + # TODO fix RUNPATH of built executables to avoid use of LD_LIBRARY_PATH |
| 109 | + run: | |
| 110 | + export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${{ env.VCPKG_INSTALLED_DIR }}/${{ env.VCPKG_DEFAULT_TRIPLET }}/lib" |
| 111 | + echo "LD_LIBRARY_PATH: $LD_LIBRARY_PATH" |
| 112 | + cd cpp/test |
| 113 | + ../../_skbuild/linux-x86_64-3.9/cmake-build/run_tests |
| 114 | +
|
0 commit comments