File: builds.yml

package info (click to toggle)
glvis 4.5-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 7,780 kB
  • sloc: cpp: 35,217; ansic: 5,695; sh: 340; makefile: 301; python: 193
file content (272 lines) | stat: -rw-r--r-- 9,321 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
# Copyright (c) 2010-2026, Lawrence Livermore National Security, LLC. Produced
# at the Lawrence Livermore National Laboratory. All Rights reserved. See files
# LICENSE and NOTICE for details. LLNL-CODE-443271.
#
# This file is part of the GLVis visualization tool and library. For more
# information and source code availability see https://glvis.org.
#
# GLVis is free software; you can redistribute it and/or modify it under the
# terms of the BSD-3 license. We welcome feedback and contributions, see file
# CONTRIBUTING.md for details.

name: builds

on:
  push:
    branches:
      - master
  pull_request:
  workflow_dispatch:

env:
  HYPRE_ARCHIVE: v2.19.0.tar.gz
  HYPRE_TOP_DIR: hypre-2.19.0
  METIS_ARCHIVE: metis-4.0.3.tar.gz
  METIS_TOP_DIR: metis-4.0.3
  MFEM_TOP_DIR: mfem
  MFEM_BRANCH: master

jobs:
  builds-and-tests:
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
        target: [dbg, opt]
        mpi: [seq]
        build-system: [cmake]
        include:
          - os: ubuntu-latest
            target: opt
            mpi: seq
            build-system: make
          - os: ubuntu-latest
            target: dbg
            mpi: par
            build-system: make
          - os: macos-latest
            target: opt
            mpi: seq
            build-system: make
          - os: macos-latest
            target: dbg
            mpi: par
            build-system: make
    name: ${{ matrix.os }}-${{ matrix.build-system }}-${{ matrix.target }}-${{ matrix.mpi }}

    runs-on: ${{ matrix.os }}

    steps:
    - name: get MPI (Linux)
      if: matrix.os == 'ubuntu-latest' && matrix.mpi == 'par'
      run: |
        sudo apt-get update
        sudo apt-get install mpich libmpich-dev
        export MAKE_CXX_FLAG="MPICXX=mpic++"

    # Keep the following section in case we need it again in the future,
    # see: https://github.com/mfem/mfem/pull/3385#discussion_r1058013032
    # - name: Set up Homebrew
    #   if: matrix.os == 'macos-latest' && matrix.mpi == 'par'
    #   uses: Homebrew/actions/setup-homebrew@master

    - name: get MPI (MacOS)
      if: matrix.os == 'macos-latest' && matrix.mpi == 'par'
      run: |
        export HOMEBREW_NO_INSTALL_CLEANUP=1
        brew install openmpi
        export MAKE_CXX_FLAG="MPICXX=mpic++"

    # Get Hypre through cache, or build it.
    # Install will only run on cache miss.
    - name: cache hypre
      if: matrix.mpi == 'par'
      id: hypre-cache
      uses: actions/cache@v4
      with:
        path: ${{ env.HYPRE_TOP_DIR }}
        key: ${{ runner.os }}-build-${{ env.HYPRE_TOP_DIR }}-v2.2

    - name: build hypre
      if: steps.hypre-cache.outputs.cache-hit != 'true' && matrix.mpi == 'par'
      uses: mfem/github-actions/build-hypre@v2.4
      with:
        archive: ${{ env.HYPRE_ARCHIVE }}
        dir: ${{ env.HYPRE_TOP_DIR }}
        build-system: make

    # Get Metis through cache, or build it.
    # Install will only run on cache miss.
    - name: cache metis
      if: matrix.mpi == 'par'
      id: metis-cache
      uses: actions/cache@v4
      with:
        path: ${{ env.METIS_TOP_DIR }}
        key: ${{ runner.os }}-build-${{ env.METIS_TOP_DIR }}-v2.2

    - name: build metis
      if: steps.metis-cache.outputs.cache-hit != 'true' && matrix.mpi == 'par'
      uses: mfem/github-actions/build-metis@v2.4
      with:
        archive: ${{ env.METIS_ARCHIVE }}
        dir: ${{ env.METIS_TOP_DIR }}

    # make generic links to libraries for MFEM install
    # Those links are already created by build-mfem action, but not when the cache is used...
    - name: configure links
      if: matrix.mpi == 'par'
      run: |
        echo "Hypre symlink:"
        ln -s $HYPRE_TOP_DIR hypre;
        echo "Metis symlink:"
        ln -s $METIS_TOP_DIR metis-4.0;

    - name: MFEM ${{ env.MFEM_BRANCH }} commit
      run: |
        echo "MFEM_COMMIT=$(git ls-remote --heads https://github.com/mfem/mfem.git ${MFEM_BRANCH} | awk '{print $1;}')" >> $GITHUB_ENV

    # Get MFEM through cache, or build it.
    # Install will only run on cache miss.
    - name: cache mfem
      id: cache-mfem
      uses: actions/cache@v4
      with:
        path: ${{ env.MFEM_TOP_DIR }}
        key: ${{ runner.os }}-build-${{ env.MFEM_TOP_DIR }}-${{ env.MFEM_COMMIT }}-${{ matrix.build-system }}-${{ matrix.target }}-${{ matrix.mpi }}-v2.4

    # We are using the defaults of the MFEM action here, which is to use master
    # branch. There is an implicit assumption here that mfem master hasn't
    # changed since the 'MFEM master commit' step.
    # Also, if we apply to MFEM build the same target as GLVis. This may be
    # superfluous.
    - name: build mfem
      if: steps.cache-mfem.outputs.cache-hit != 'true'
      uses: mfem/github-actions/build-mfem@v2.4
      with:
        os: ${{ matrix.os }}
        target: ${{ matrix.target }}
        hypre-dir: ${{ env.HYPRE_TOP_DIR }}
        metis-dir: ${{ env.METIS_TOP_DIR }}
        mfem-dir: ${{ env.MFEM_TOP_DIR }}
        mfem-branch: ${{ env.MFEM_BRANCH }}
        build-system: ${{ matrix.build-system }}
        mpi: ${{ matrix.mpi }}
        library-only: true

    # Install GLVis dependencies with package manager
    - name: get deps (Linux)
      if: matrix.os == 'ubuntu-latest'
      run: |
        # We need to add a PPA for SDL 2.0.14 - fixes some initialization
        # errors for X11
        sudo add-apt-repository -y ppa:savoury1/multimedia
        sudo apt-get update
        sudo apt-get install libfontconfig1-dev libfreetype6-dev libsdl2-dev libglew-dev libglm-dev libpng-dev

    # - name: Set up Homebrew
    #   if: matrix.os == 'macos-latest'
    #   uses: Homebrew/actions/setup-homebrew@master

    - name: get deps (MacOS)
      if: matrix.os == 'macos-latest'
      run: |
        export HOMEBREW_NO_INSTALL_CLEANUP=1
        brew install fontconfig freetype sdl2 glew glm libpng

    - name: cache deps (Windows)
      id: cache-deps
      uses: actions/cache@v4
      with:
        path: vcpkg_cache
        key: ${{ runner.os }}-vcpkg-v1

    - name: prepare binary cache location
      if: steps.cache-deps.outputs.cache-hit != 'true'
      run: |
        mkdir -p vcpkg_cache

    - name: checkout GLVis
      uses: actions/checkout@v4
      with:
        path: glvis
        submodules: recursive

    - name: build GLVis (make)
      if: matrix.build-system == 'make'
      run: |
        glvis_target="opt"
        [[ ${{ matrix.target }} == "dbg" ]] && glvis_target="debug";
        use_egl="NO"
        [[ ${{ matrix.os }} == "ubuntu-latest" ]] && use_egl="YES"
        use_cgl="NO"
        [[ ${{ matrix.os }} == "macos-latest" ]] && use_cgl="YES"
        cd glvis && make ${glvis_target} -j3 GLVIS_USE_EGL=${use_egl} GLVIS_USE_CGL=${use_cgl}

    - name: build GLVis (cmake)
      if: matrix.build-system == 'cmake'
      env:
        VCPKG_DEFAULT_BINARY_CACHE: ${{ github.workspace }}/vcpkg_cache
      run: |
        build_type="Release"
        [[ ${{ matrix.target }} == "dbg" ]] && build_type="Debug";
        [[ ${{ matrix.os }} == "windows-latest" ]] \
          && toolchain_file="${VCPKG_INSTALLATION_ROOT}\\scripts\\buildsystems\\vcpkg.cmake"
        use_egl="OFF"
        [[ ${{ matrix.os }} == "ubuntu-latest" ]] && use_egl="ON"
        use_cgl="NO"
        [[ ${{ matrix.os }} == "macos-latest" ]] && use_cgl="YES"
        cd glvis && mkdir build && cd build
        cmake \
          -D CMAKE_TOOLCHAIN_FILE:STRING=${toolchain_file} \
          -D CMAKE_BUILD_TYPE:STRING=${build_type} \
          -D ENABLE_TESTS:BOOL=TRUE \
          -D GLVIS_USE_EGL:BOOL=${use_egl} \
          -D GLVIS_USE_CGL:BOOL=${use_cgl} \
          -D mfem_DIR:PATH=${GITHUB_WORKSPACE}/${MFEM_TOP_DIR}/build \
          -D GLVIS_BASELINE_SYS=${{ matrix.os }} \
          ..
        cmake --build . --parallel 3 --config "${build_type}"
      shell: bash

    - name: setup Python
      if: matrix.build-system == 'cmake'
      uses: actions/setup-python@v5
      with:
        python-version: 3.9

    - name: setup Python packages for testing
      if: matrix.build-system == 'cmake'
      run: |
        python -m pip install --upgrade pip
        python -m pip install -r glvis/tests/requirements.txt

    - name: setup Linux testing dependencies
      if: matrix.build-system == 'cmake' && matrix.os == 'ubuntu-latest'
      run: |
        sudo apt-get install xvfb

    - name: test GLVis (cmake/linux)
      if: matrix.build-system == 'cmake' && matrix.os == 'ubuntu-latest'
      run: |
        cd glvis && cd build
        xvfb-run -a ctest --verbose

    - name: test GLVis (cmake/mac)
      if: matrix.build-system == 'cmake' && matrix.os == 'macos-latest'
      run: |
        cd glvis && cd build
        ctest --verbose

    - name: create screenshot tarball
      if: always() && matrix.build-system == 'cmake' && matrix.os != 'windows-latest'
      run: |
        cd glvis && cd build
        cd tests && tar czvf ../test_screenshots.tar.gz outputs

    - name: upload test screenshots
      if: always() && matrix.build-system == 'cmake' && matrix.os != 'windows-latest'
      uses: actions/upload-artifact@v4
      with:
        name: test-screenshots-${{ matrix.os }}-${{ matrix.target }}-${{ matrix.mpi }}
        path: glvis/build/test_screenshots.tar.gz