summaryrefslogtreecommitdiffstats
path: root/.github/workflows/main.yml
blob: 925ea895a2c2ae9346ab266aeaa5dac674557c37 (plain)
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
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
name: hdf5 dev CI

# Controls when the action will run. Triggers the workflow on push or pull request
on:
  workflow_dispatch:
  push:
  pull_request:
    branches: [ develop ]
    paths-ignore:
      - '.github/CODEOWNERS'
      - '.github/FUNDING.yml'
      - 'doc/**'
      - 'release_docs/**'
      - 'ACKNOWLEDGEMENTS'
      - 'COPYING**'
      - '**.md'

# Using concurrency to cancel any in-progress job or run
concurrency:
  group: ${{ github.workflow }}-${{ github.sha || github.event.pull_request.number }}
  cancel-in-progress: true

permissions:
  contents: read

# A workflow run is made up of one or more jobs that can run sequentially or
# in parallel. We just have one job, but the matrix items defined below will
# run in parallel.
jobs:

  # A workflow that builds the library and runs all the tests
  build_and_test:

    strategy:

      # The current matrix has three dimensions:
      #
      # * config name
      # * thread-safety on/off
      # * release vs. debug build
      #
      # Most configuration information is added via the 'include' mechanism,
      # which will append the key-value pairs in the configuration where the
      # names match.

      matrix:

        name:
          - "Windows MSVC CMake"
          - "Ubuntu gcc CMake"
          - "Ubuntu gcc Autotools"
          - "Ubuntu gcc Autotools parallel (build only)"
          - "MacOS Clang CMake"

        thread_safety:
          - enabled: true
            text: " TS"
          - enabled: false
            text: ""

        build_mode:
          - text: " REL"
            cmake: "Release"
            autotools: "production"
          - text: " DBG"
            cmake: "Debug"
            autotools: "debug"

        # This is where we list the bulk of the options for each configuration.
        # The key-value pair values are usually appropriate for being CMake or
        # Autotools configure values, so be aware of that.

        include:

          # Windows w/ MSVC + CMake
          #
          # No Fortran, parallel, or VFDs that rely on POSIX things
          - name: "Windows MSVC CMake"
            os: windows-2022
            toolchain: ""
            cpp: ON
            fortran: OFF
            java: ON
            docs: OFF
            libaecfc: ON
            localaec: OFF
            zlibfc: ON
            localzlib: OFF
            parallel: OFF
            mirror_vfd: OFF
            direct_vfd: OFF
            ros3_vfd: OFF
            generator: "-G \"Visual Studio 17 2022\" -A x64"
            run_tests: true

          # Linux (Ubuntu) w/ gcc + CMake
          #
          # We might think about adding Clang, but MacOS already tests that
          # so it's not critical
          - name: "Ubuntu gcc CMake"
            os: ubuntu-latest
            cpp: ON
            fortran: ON
            java: ON
            docs: ON
            libaecfc: ON
            localaec: OFF
            zlibfc: ON
            localzlib: OFF
            parallel: OFF
            mirror_vfd: ON
            direct_vfd: ON
            ros3_vfd: OFF
            toolchain: "config/toolchain/gcc.cmake"
            generator: "-G Ninja"
            run_tests: true

          # Linux (Ubuntu) w/ gcc + Autotools
          #
          # Keep this identical to the CMake configs. Note the difference in
          # the values.
          - name: "Ubuntu gcc Autotools"
            os: ubuntu-latest
            cpp: enable
            fortran: enable
            java: enable
            docs: disable
            parallel: disable
            mirror_vfd: enable
            direct_vfd: enable
            ros3_vfd: enable
            deprec_sym: enable
            default_api: v114
            szip: yes
            toolchain: ""
            generator: "autogen"
            flags: ""
            run_tests: true

          # Parallel Linux (Ubuntu) w/ gcc + Autotools
          #
          # The GitHub runners are inadequate for running parallel HDF5 tests,
          # so we catch most issues in daily testing. What we have here is just
          # a compile check to make sure nothing obvious is broken.
          - name: "Ubuntu gcc Autotools parallel (build only)"
            os: ubuntu-latest
            cpp: disable
            fortran: enable
            java: disable
            docs: disable
            parallel: enable
            mirror_vfd: disable
            direct_vfd: disable
            ros3_vfd: disable
            deprec_sym: enable
            default_api: v114
            szip: yes
            toolchain: ""
            generator: "autogen"
            flags: "CC=mpicc"
            run_tests: false

          # MacOS w/ Clang + CMake
          #
          # We could also build with the Autotools via brew installing them,
          # but that seems unnecessary
          - name: "MacOS Clang CMake"
            os: macos-13
            cpp: ON
            fortran: OFF
            java: ON
            docs: OFF
            libaecfc: ON
            localaec: OFF
            zlibfc: ON
            localzlib: OFF
            parallel: OFF
            mirror_vfd: ON
            direct_vfd: OFF
            ros3_vfd: OFF
            toolchain: "config/toolchain/clang.cmake"
            generator: "-G Ninja"
            run_tests: true


          #
          # SPECIAL AUTOTOOLS BUILDS
          #
          # These do not run tests and are not built into the matrix and instead
          # become NEW configs as their name would clobber one of the matrix
          # names (so make sure the names are UNIQUE).
          #

          - name: "Ubuntu gcc Autotools v1.6 default API (build only)"
            os: ubuntu-latest
            cpp: enable
            fortran: enable
            java: enable
            docs: disable
            parallel: disable
            mirror_vfd: enable
            direct_vfd: enable
            ros3_vfd: enable
            deprec_sym: enable
            default_api: v16
            szip: yes
            toolchain: ""
            generator: "autogen"
            flags: ""
            run_tests: false
            thread_safety:
              enabled: false
              text: ""
            build_mode:
              text: " DBG"
              cmake: "Debug"
              autotools: "debug"

          - name: "Ubuntu gcc Autotools v1.8 default API (build only)"
            os: ubuntu-latest
            cpp: enable
            fortran: enable
            java: enable
            docs: disable
            parallel: disable
            mirror_vfd: enable
            direct_vfd: enable
            ros3_vfd: enable
            deprec_sym: enable
            default_api: v18
            szip: yes
            toolchain: ""
            generator: "autogen"
            flags: ""
            run_tests: false
            thread_safety:
              enabled: false
              text: ""
            build_mode:
              text: " DBG"
              cmake: "Debug"
              autotools: "debug"

          - name: "Ubuntu gcc Autotools v1.10 default API (build only)"
            os: ubuntu-latest
            cpp: enable
            fortran: enable
            java: enable
            docs: disable
            parallel: disable
            mirror_vfd: enable
            direct_vfd: enable
            ros3_vfd: enable
            deprec_sym: enable
            default_api: v110
            szip: yes
            toolchain: ""
            generator: "autogen"
            flags: ""
            run_tests: false
            thread_safety:
              enabled: false
              text: ""
            build_mode:
              text: " DBG"
              cmake: "Debug"
              autotools: "debug"

          - name: "Ubuntu gcc Autotools v1.12 default API (build only)"
            os: ubuntu-latest
            cpp: enable
            fortran: enable
            java: enable
            docs: disable
            parallel: disable
            mirror_vfd: enable
            direct_vfd: enable
            ros3_vfd: enable
            deprec_sym: enable
            default_api: v112
            szip: yes
            toolchain: ""
            generator: "autogen"
            flags: ""
            run_tests: false
            thread_safety:
              enabled: false
              text: ""
            build_mode:
              text: " DBG"
              cmake: "Debug"
              autotools: "debug"

          - name: "Ubuntu gcc Autotools v1.14 default API (build only)"
            os: ubuntu-latest
            cpp: enable
            fortran: enable
            java: enable
            docs: disable
            parallel: disable
            mirror_vfd: enable
            direct_vfd: enable
            ros3_vfd: enable
            deprec_sym: enable
            default_api: v114
            szip: yes
            toolchain: ""
            generator: "autogen"
            flags: ""
            run_tests: false
            thread_safety:
              enabled: false
              text: ""
            build_mode:
              text: " DBG"
              cmake: "Debug"
              autotools: "debug"

          - name: "Ubuntu gcc Autotools no deprecated symbols (build only)"
            os: ubuntu-latest
            cpp: enable
            fortran: enable
            java: enable
            docs: disable
            parallel: disable
            mirror_vfd: enable
            direct_vfd: enable
            ros3_vfd: enable
            deprec_sym: disable
            default_api: default
            szip: yes
            toolchain: ""
            generator: "autogen"
            flags: ""
            run_tests: false
            thread_safety:
              enabled: false
              text: ""
            build_mode:
              text: " DBG"
              cmake: "Debug"
              autotools: "debug"

          # Debug -Werror
          - name: "Ubuntu gcc Autotools -Werror (build only)"
            os: ubuntu-latest
            cpp: enable
            fortran: disable
            java: enable
            docs: disable
            parallel: disable
            mirror_vfd: disable
            direct_vfd: enable
            ros3_vfd: disable
            deprec_sym: enable
            default_api: v114
            szip: yes
            toolchain: ""
            generator: "autogen"
            flags: "CFLAGS=-Werror"
            run_tests: false
            thread_safety:
              enabled: false
              text: ""
            build_mode:
              text: " DBG"
              cmake: "Debug"
              autotools: "debug"

          # Production/Release -Werror
          - name: "Ubuntu gcc Autotools -Werror (build only)"
            os: ubuntu-latest
            cpp: enable
            fortran: disable
            java: enable
            docs: disable
            parallel: disable
            mirror_vfd: disable
            direct_vfd: enable
            ros3_vfd: disable
            deprec_sym: enable
            default_api: v114
            szip: yes
            toolchain: ""
            generator: "autogen"
            flags: "CFLAGS=-Werror"
            run_tests: false
            thread_safety:
              enabled: false
              text: ""
            build_mode:
              text: " REL"
              cmake: "Release"
              autotools: "production"

          # Parallel Debug -Werror
          - name: "Ubuntu gcc Autotools parallel -Werror (build only)"
            os: ubuntu-latest
            cpp: disable
            fortran: disable
            java: disable
            docs: disable
            parallel: enable
            mirror_vfd: disable
            direct_vfd: enable
            ros3_vfd: disable
            deprec_sym: enable
            default_api: v114
            toolchain: ""
            generator: "autogen"
            flags: "CFLAGS=-Werror"
            run_tests: false
            thread_safety:
              enabled: false
              text: ""
            build_mode:
              text: " DBG"
              cmake: "Debug"
              autotools: "debug"

          # Parallel production/release -Werror
          - name: "Ubuntu gcc Autotools parallel -Werror (build only)"
            os: ubuntu-latest
            cpp: disable
            fortran: disable
            java: disable
            docs: disable
            parallel: enable
            mirror_vfd: disable
            direct_vfd: enable
            ros3_vfd: disable
            deprec_sym: enable
            default_api: v114
            toolchain: ""
            generator: "autogen"
            flags: "CFLAGS=-Werror"
            run_tests: false
            thread_safety:
              enabled: false
              text: ""
            build_mode:
              text: " REL"
              cmake: "Release"
              autotools: "production"

    # Sets the job's name from the properties
    name: "${{ matrix.name }}${{ matrix.build_mode.text }}${{ matrix.thread_safety.text }}"

    # Don't run the action if the commit message says to skip CI
    if: "!contains(github.event.head_commit.message, 'skip-ci')"

    # The type of runner that the job will run on
    runs-on: ${{ matrix.os }}

    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:

      #
      # SETUP
      #

      #Useful for debugging
      - name: Dump matrix context
        run: echo '${{ toJSON(matrix) }}'

      - name: Install CMake Dependencies (Linux)
        run: sudo apt-get install ninja-build doxygen graphviz
        if: matrix.os == 'ubuntu-latest'

      - name: Install Autotools Dependencies (Linux, serial)
        run: |
           sudo apt update
           sudo apt install automake autoconf libtool libtool-bin
           sudo apt install gcc-12 g++-12 gfortran-12
           sudo apt install libssl3 libssl-dev libcurl4 libcurl4-openssl-dev
           echo "CC=gcc-12" >> $GITHUB_ENV
           echo "CXX=g++-12" >> $GITHUB_ENV
           echo "FC=gfortran-12" >> $GITHUB_ENV
           sudo apt install libaec0 libaec-dev
        if: (matrix.generator == 'autogen') && (matrix.parallel != 'enable')

      - name: Install Autotools Dependencies (Linux, parallel)
        run: |
           sudo apt update
           sudo apt install automake autoconf libtool libtool-bin
           sudo apt install openmpi-bin openmpi-common mpi-default-dev
           echo "CC=mpicc" >> $GITHUB_ENV
           echo "FC=mpif90" >> $GITHUB_ENV
           sudo apt install libaec0 libaec-dev
        if: (matrix.generator == 'autogen') && (matrix.parallel == 'enable')

      - name: Install Dependencies (Windows)
        run: choco install ninja
        if: matrix.os == 'windows-latest'

      - name: Install Dependencies (macOS)
        run: brew install ninja doxygen
        if: matrix.os == 'macos-13'

      - name: Set environment for MSVC (Windows)
        run: |
          # Set these environment variables so CMake picks the correct compiler
          echo "CXX=cl.exe" >> $GITHUB_ENV
          echo "CC=cl.exe" >> $GITHUB_ENV
        if:  matrix.os == 'windows-latest'
    
      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
      - name: Get Sources
        uses: actions/checkout@v3

      #
      # AUTOTOOLS CONFIGURE
      #

      - name: Autotools Configure
        run: |
          sh ./autogen.sh
          mkdir "${{ runner.workspace }}/build"
          cd "${{ runner.workspace }}/build"
          ${{ matrix.flags }} $GITHUB_WORKSPACE/configure --enable-build-mode=${{ matrix.build_mode.autotools }} --${{ matrix.deprec_sym }}-deprecated-symbols --with-default-api-version=${{ matrix.default_api }} --enable-shared --${{ matrix.parallel }}-parallel --${{ matrix.cpp }}-cxx --${{ matrix.fortran }}-fortran --${{ matrix.java }}-java --${{ matrix.mirror_vfd }}-mirror-vfd --${{ matrix.direct_vfd }}-direct-vfd --${{ matrix.ros3_vfd }}-ros3-vfd --with-szlib=${{ matrix.szip }}
        shell: bash
        if: (matrix.generator == 'autogen') && ! (matrix.thread_safety.enabled)

      - name: Autotools Configure (Thread-Safe)
        run: |
          sh ./autogen.sh
          mkdir "${{ runner.workspace }}/build"
          cd "${{ runner.workspace }}/build"
          ${{ matrix.flags }} $GITHUB_WORKSPACE/configure --enable-build-mode=${{ matrix.build_mode.autotools }} --enable-shared --enable-threadsafe --disable-hl --${{ matrix.parallel }}-parallel --${{ matrix.mirror_vfd }}-mirror-vfd --${{ matrix.direct_vfd }}-direct-vfd --${{ matrix.ros3_vfd }}-ros3-vfd --with-szlib=${{ matrix.szip }}
        shell: bash
        if: (matrix.generator == 'autogen') && (matrix.thread_safety.enabled)

      #
      # CMAKE CONFIGURE
      #

      - name: CMake Configure
        run: |
          mkdir "${{ runner.workspace }}/build"
          cd "${{ runner.workspace }}/build"
          cmake -C $GITHUB_WORKSPACE/config/cmake/cacheinit.cmake ${{ matrix.generator }} -DCMAKE_BUILD_TYPE=${{ matrix.build_mode.cmake }} -DCMAKE_TOOLCHAIN_FILE=${{ matrix.toolchain }} -DBUILD_SHARED_LIBS=ON -DHDF5_ENABLE_ALL_WARNINGS=ON -DHDF5_ENABLE_PARALLEL:BOOL=${{ matrix.parallel }} -DHDF5_BUILD_CPP_LIB:BOOL=${{ matrix.cpp }} -DHDF5_BUILD_FORTRAN=${{ matrix.fortran }} -DHDF5_BUILD_JAVA=${{ matrix.java }} -DHDF5_BUILD_DOC=${{ matrix.docs }} -DBUILD_SZIP_WITH_FETCHCONTENT=${{ matrix.libaecfc }} -DLIBAEC_USE_LOCALCONTENT=${{ matrix.localaec }} -DBUILD_ZLIB_WITH_FETCHCONTENT=${{ matrix.zlibfc }} -DZLIB_USE_LOCALCONTENT=${{ matrix.localzlib }} -DHDF5_ENABLE_MIRROR_VFD:BOOL=${{ matrix.mirror_vfd }} -DHDF5_ENABLE_DIRECT_VFD:BOOL=${{ matrix.direct_vfd }} -DHDF5_ENABLE_ROS3_VFD:BOOL=${{ matrix.ros3_vfd }} $GITHUB_WORKSPACE
        shell: bash
        if: (matrix.generator != 'autogen') && ! (matrix.thread_safety.enabled)


      - name: CMake Configure (Thread-Safe)
        run: |
          mkdir "${{ runner.workspace }}/build"
          cd "${{ runner.workspace }}/build"
          cmake -C $GITHUB_WORKSPACE/config/cmake/cacheinit.cmake ${{ matrix.generator }} -DCMAKE_BUILD_TYPE=${{ matrix.build_mode.cmake }} -DCMAKE_TOOLCHAIN_FILE=${{ matrix.toolchain }} -DBUILD_SHARED_LIBS=ON -DHDF5_ENABLE_ALL_WARNINGS=ON -DHDF5_ENABLE_THREADSAFE:BOOL=ON -DHDF5_ENABLE_PARALLEL:BOOL=${{ matrix.parallel }} -DHDF5_BUILD_CPP_LIB:BOOL=OFF -DHDF5_BUILD_FORTRAN:BOOL=OFF -DHDF5_BUILD_JAVA:BOOL=OFF -DHDF5_BUILD_HL_LIB:BOOL=OFF -DHDF5_BUILD_DOC=OFF -DBUILD_SZIP_WITH_FETCHCONTENT=${{ matrix.libaecfc }} -DLIBAEC_USE_LOCALCONTENT=${{ matrix.localaec }} -DBUILD_ZLIB_WITH_FETCHCONTENT=${{ matrix.zlibfc }} -DZLIB_USE_LOCALCONTENT=${{ matrix.localzlib }} -DHDF5_ENABLE_MIRROR_VFD:BOOL=${{ matrix.mirror_vfd }} -DHDF5_ENABLE_DIRECT_VFD:BOOL=${{ matrix.direct_vfd }} -DHDF5_ENABLE_ROS3_VFD:BOOL=${{ matrix.ros3_vfd }} $GITHUB_WORKSPACE
        shell: bash
        if: (matrix.generator != 'autogen') && (matrix.thread_safety.enabled)

      #
      # BUILD
      #

      - name: Autotools Build
        run: make -j3
        working-directory: ${{ runner.workspace }}/build
        if: matrix.generator == 'autogen'

      - name: CMake Build
        run: cmake --build . --parallel 3 --config ${{ matrix.build_mode.cmake }}
        working-directory: ${{ runner.workspace }}/build
        if: (matrix.generator != 'autogen')

      #
      # RUN TESTS
      #

      # NORMAL

      - name: Autotools Run Tests
        run: make check -j2
        working-directory: ${{ runner.workspace }}/build
        if: (matrix.generator == 'autogen') && (matrix.run_tests) && ! (matrix.thread_safety.enabled)

      - name: CMake Run Tests
        run: ctest . --parallel 2 -C ${{ matrix.build_mode.cmake }} -V
        working-directory: ${{ runner.workspace }}/build
        if: (matrix.generator != 'autogen') && (matrix.run_tests) && ! (matrix.thread_safety.enabled)

      # THREAD-SAFE

      - name: Autotools Run Thread-Safe Tests
        run: |
          cd test
          ./ttsafe
        working-directory: ${{ runner.workspace }}/build
        if: (matrix.generator == 'autogen') && (matrix.run_tests) && (matrix.thread_safety.enabled)

      - name: CMake Run Thread-Safe Tests
        run: ctest . --parallel 2 -C ${{ matrix.build_mode.cmake }} -V -R ttsafe
        working-directory: ${{ runner.workspace }}/build
        if: (matrix.generator != 'autogen') && (matrix.run_tests) && (matrix.thread_safety.enabled)

      #
      # INSTALL (note that this runs even when we don't run the tests)
      #

      - name: Autotools Install
        run: make install
        working-directory: ${{ runner.workspace }}/build
        if: (matrix.generator == 'autogen')

      - name: Autotools Verify Install
        run: make check-install
        working-directory: ${{ runner.workspace }}/build
        if: (matrix.generator == 'autogen')