Skip to content

ci: add actions that should pass #983

ci: add actions that should pass

ci: add actions that should pass #983

Workflow file for this run

name: hdf4 dev CI
# Controls when the action will run. Triggers the workflow on push or pull request
on:
workflow_dispatch:
push:
pull_request:
branches: [ master ]
paths-ignore:
- '.github/CODEOWNERS'
- 'release_notes/**'
- 'COPYING'
- '**.md'
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:
fail-fast: true
# The current matrix has three dimensions:
#
# * config name
# * netcdf 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 SysXDR Autotools"
- "MacOS Clang CMake"
- "Ubuntu mingw CMake"
- "Windows static MSVC CMake"
- "Ubuntu static gcc CMake"
- "Ubuntu static gcc Autotools"
- "MacOS static Clang CMake"
netcdf:
- enabled: enable
cmake: ON
text: " NC"
- enabled: disable
cmake: OFF
text: ""
build_mode:
- text: " REL"
cmake: "Release"
autotools: "enable-production"
- text: " DBG"
cmake: "Debug"
autotools: "disable-production"
# 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
#
- name: "Windows MSVC CMake"
os: windows-2022
toolchain: ""
shared: ON
xdr: ON
fortran: OFF
java: ON
jpegfc: ON
libaecfc: ON
zlibfc: ON
cacheinit: "-C $GITHUB_WORKSPACE/config/cmake/cacheinit.cmake"
generator: "-G \"Visual Studio 17 2022\" -A x64"
run_tests: true
use_mingw: false
# 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
shared: ON
xdr: ON
fortran: OFF
java: ON
jpegfc: ON
libaecfc: ON
zlibfc: ON
toolchain: "$GITHUB_WORKSPACE/config/toolchain/gcc.cmake"
cacheinit: "-C $GITHUB_WORKSPACE/config/cmake/cacheinit.cmake"
generator: "-G Ninja"
run_tests: true
use_mingw: false
# 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
shared: enable
xdr: enable
fortran: disable
java: enable
toolchain: ""
generator: "autogen"
flags: ""
run_tests: true
use_mingw: false
# Linux (Ubuntu) w/ gcc + system XDR + Autotools
#
# Keep this identical to the CMake configs. Note the difference in
# the values.
- name: "Ubuntu gcc SysXDR Autotools"
os: ubuntu-latest
shared: enable
xdr: disable
fortran: disable
java: enable
toolchain: ""
generator: "autogen"
flags: ""
run_tests: true
use_mingw: 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
shared: ON
xdr: ON
fortran: OFF
java: ON
jpegfc: ON
libaecfc: ON
zlibfc: ON
toolchain: "$GITHUB_WORKSPACE/config/toolchain/clang.cmake"
cacheinit: "-C $GITHUB_WORKSPACE/config/cmake/cacheinit.cmake"
generator: "-G Ninja"
run_tests: true
use_mingw: false
# Linux (Ubuntu) w/ mingw + CMake
#
- name: "Ubuntu mingw CMake"
os: ubuntu-latest
shared: ON
xdr: ON
fortran: OFF
java: OFF
jpegfc: ON
libaecfc: ON
zlibfc: ON
toolchain: "$GITHUB_WORKSPACE/config/toolchain/mingw64.cmake"
cacheinit: "-C $GITHUB_WORKSPACE/config/cmake/cacheinit.cmake"
generator: "-G Ninja"
run_tests: false
use_mingw: true
# Windows w/ MSVC + CMake
#
- name: "Windows static MSVC CMake"
os: windows-2022
toolchain: ""
shared: OFF
xdr: ON
fortran: OFF
java: OFF
jpegfc: ON
libaecfc: ON
zlibfc: ON
cacheinit: "-C $GITHUB_WORKSPACE/config/cmake/cacheinit.cmake"
generator: "-G \"Visual Studio 17 2022\" -A x64"
run_tests: true
use_mingw: false
# Linux (Ubuntu) w/ gcc + CMake
#
# We might think about adding Clang, but MacOS already tests that
# so it's not critical
- name: "Ubuntu static gcc CMake"
os: ubuntu-latest
shared: OFF
xdr: ON
fortran: ON
java: OFF
jpegfc: ON
libaecfc: ON
zlibfc: ON
toolchain: "$GITHUB_WORKSPACE/config/toolchain/gcc.cmake"
cacheinit: "-C $GITHUB_WORKSPACE/config/cmake/cacheinit.cmake"
generator: "-G Ninja"
run_tests: true
use_mingw: false
# Linux (Ubuntu) w/ gcc + Autotools
#
# Keep this identical to the CMake configs. Note the difference in
# the values.
- name: "Ubuntu static gcc Autotools"
os: ubuntu-latest
shared: disable
# NOTE: Fortran and HDF4 XDR have linking problems w/ Autotools
xdr: enable
fortran: disable
java: disable
toolchain: ""
generator: "autogen"
flags: ""
run_tests: true
use_mingw: false
# MacOS w/ Clang + CMake
#
# We could also build with the Autotools via brew installing them,
# but that seems unnecessary
- name: "MacOS static Clang CMake"
os: macos-13
shared: OFF
xdr: ON
fortran: OFF
java: OFF
jpegfc: ON
libaecfc: ON
zlibfc: ON
toolchain: "$GITHUB_WORKSPACE/config/toolchain/clang.cmake"
cacheinit: "-C $GITHUB_WORKSPACE/config/cmake/cacheinit.cmake"
generator: "-G Ninja"
run_tests: true
use_mingw: false
# Sets the job's name from the properties
name: "${{ matrix.name }}${{ matrix.build_mode.text }}${{ matrix.shared.text }}${{ matrix.netcdf.text }}"
# The type of runner that the job will run on
runs-on: ${{ matrix.os }}
# Don't run the action if the commit message says to skip CI
if: "!contains(github.event.head_commit.message, 'skip-ci')"
# 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 -y ninja-build libtirpc-dev
if: matrix.os == 'ubuntu-latest'
- name: Install MinGW Dependencies (Linux)
uses: egor-tensin/setup-mingw@v2
with:
platform: x64
if: (matrix.use_mingw)
- name: Install Autotools Dependencies (Linux)
run: |
sudo apt update
sudo apt install automake autoconf libtool libtool-bin
sudo apt install gcc-12 g++-12 gfortran-12
echo "CC=gcc-12" >> $GITHUB_ENV
echo "CXX=g++-12" >> $GITHUB_ENV
if: (matrix.generator == 'autogen')
- name: Install Dependencies (Windows)
run: |
choco install ninja
if: matrix.os == 'windows-2022'
- name: Install Dependencies (macOS)
run: brew install ninja
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-2022'
# 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 \
--${{ matrix.build_mode.autotools }} \
--${{ matrix.xdr }}-hdf4-xdr \
--${{ matrix.netcdf.enabled }}-netcdf \
--${{ matrix.fortran }}-fortran \
--${{ matrix.java }}-java \
--${{ matrix.shared }}-shared
echo
echo "*** h4config.h ***"
echo
cat ./hdf/src/h4config.h
shell: bash
if: (matrix.generator == 'autogen')
#
# CMAKE CONFIGURE
#
- name: CMake Configure
run: |
mkdir "${{ runner.workspace }}/build"
cd "${{ runner.workspace }}/build"
cmake ${{ matrix.cacheinit }} ${{ matrix.generator }} \
--log-level=VERBOSE \
-DCMAKE_BUILD_TYPE=${{ matrix.build_mode.cmake }} \
-DCMAKE_TOOLCHAIN_FILE=${{ matrix.toolchain }} \
-DBUILD_SHARED_LIBS:BOOL=${{ matrix.shared }} \
-DHDF4_BUILD_EXAMPLES=ON \
-DBUILD_JPEG_WITH_PIC:BOOL=ON \
-DHDF4_BUILD_XDR_LIB:BOOL=${{ matrix.xdr }} \
-DHDF4_ENABLE_NETCDF:BOOL=${{ matrix.netcdf.cmake }} \
-DHDF4_BUILD_FORTRAN=${{ matrix.fortran }} \
-DHDF4_BUILD_JAVA=${{ matrix.java }} \
-DBUILD_JPEG_WITH_FETCHCONTENT=${{ matrix.jpegfc }} \
-DBUILD_SZIP_WITH_FETCHCONTENT=${{ matrix.libaecfc }} \
-DBUILD_ZLIB_WITH_FETCHCONTENT=${{ matrix.zlibfc }} \
$GITHUB_WORKSPACE
echo
echo "*** h4config.h ***"
echo
cat ./h4config.h
shell: bash
if: (matrix.generator != 'autogen') && ! ((matrix.name == 'Ubuntu mingw CMake') && (matrix.build_mode.cmake == 'Debug'))
#
# BUILD
#
- name: Autotools Build
run: make
working-directory: ${{ runner.workspace }}/build
if: (matrix.generator == 'autogen')
- name: CMake Build
run: cmake --build . --config ${{ matrix.build_mode.cmake }}
working-directory: ${{ runner.workspace }}/build
if: (matrix.generator != 'autogen') && ! ((matrix.name == 'Ubuntu mingw CMake') && (matrix.build_mode.cmake == 'Debug'))
#
# RUN TESTS
#
- name: Autotools Run Tests
run: make check
working-directory: ${{ runner.workspace }}/build
if: (matrix.generator == 'autogen') && (matrix.run_tests)
- name: CMake Run Tests
run: ctest --build . -C ${{ matrix.build_mode.cmake }} -V
working-directory: ${{ runner.workspace }}/build
if: (matrix.generator != 'autogen') && (matrix.run_tests) && ! ((matrix.name == 'Ubuntu mingw CMake') && (matrix.build_mode.cmake == 'Debug'))
#
# 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')
# Commented out until autotools linking is fixed
# - name: Autotools Verify Install
# run: make installcheck
# working-directory: ${{ runner.workspace }}/build
# if: (matrix.generator == 'autogen')