Skip to content

Commit

Permalink
Add clang cdash report and fix compression compile flags (#782)
Browse files Browse the repository at this point in the history
  • Loading branch information
byrnHDF authored Oct 9, 2024
1 parent d7915df commit db1836e
Show file tree
Hide file tree
Showing 10 changed files with 710 additions and 90 deletions.
404 changes: 404 additions & 0 deletions .github/workflows/cmake-analysis.yml

Large diffs are not rendered by default.

207 changes: 198 additions & 9 deletions .github/workflows/cmake-script.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ jobs:
- name: Run ctest script (Windows)
run: |
cd "${{ runner.workspace }}/hdf4"
ctest -S HDF4config.cmake,CTEST_SITE_EXT=GH,LOCAL_SUBMIT=ON,BUILD_GENERATOR=VS202264,CTEST_SOURCE_NAME=${{ steps.set-file-base.outputs.SOURCE_BASE }} -C Release -VV -O hdf4.log
ctest -S HDF4config.cmake,CTEST_SITE_EXT=GH,LOCAL_SUBMIT=ON,NINJA=TRUE,BUILD_GENERATOR=VS202264,CTEST_SOURCE_NAME=${{ steps.set-file-base.outputs.SOURCE_BASE }} -C Release -VV -O hdf4.log
shell: bash
continue-on-error: true

Expand Down Expand Up @@ -196,7 +196,7 @@ jobs:
- name: Run ctest (Linux)
run: |
cd "${{ runner.workspace }}/hdf4"
ctest -S HDF4config.cmake,CTEST_SITE_EXT=GH-GCC,LOCAL_SUBMIT=ON,BUILD_GENERATOR=Unix,CTEST_SOURCE_NAME=${{ steps.set-file-base.outputs.SOURCE_BASE }} -C Release -VV -O hdf4.log
ctest -S HDF4config.cmake,CTEST_SITE_EXT=GH-GCC,LOCAL_SUBMIT=ON,NINJA=TRUE,BUILD_GENERATOR=Unix,CTEST_SOURCE_NAME=${{ steps.set-file-base.outputs.SOURCE_BASE }} -C Release -VV -O hdf4.log
shell: bash
continue-on-error: true

Expand Down Expand Up @@ -297,7 +297,7 @@ jobs:
id: run-ctest
run: |
cd "${{ runner.workspace }}/hdf4"
ctest -S HDF4config.cmake,CTEST_SITE_EXT=GH-Clang,LOCAL_SUBMIT=ON,BUILD_GENERATOR=Unix,CTEST_SOURCE_NAME=${{ steps.set-file-base.outputs.SOURCE_BASE }} -C Release -VV -O hdf4.log
ctest -S HDF4config.cmake,CTEST_SITE_EXT=GH-Clang,LOCAL_SUBMIT=ON,NINJA=TRUE,BUILD_GENERATOR=Unix,CTEST_SOURCE_NAME=${{ steps.set-file-base.outputs.SOURCE_BASE }} -C Release -VV -O hdf4.log
shell: bash
continue-on-error: true

Expand Down Expand Up @@ -385,7 +385,7 @@ jobs:
set (SITE_BUILDNAME_SUFFIX "${{ steps.set-file-base.outputs.FILE_BASE }}")
#set (CMAKE_GENERATOR_TOOLSET "Intel C++ Compiler 2024,fortran=ifx")
set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} --log-level=VERBOSE")
set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_TOOLCHAIN_FILE:STRING=config/toolchain/intel.cmake")
#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_TOOLCHAIN_FILE:STRING=config/toolchain/intel.cmake")
set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF4_BUILD_JAVA:BOOL=ON")
set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF4_BUILD_FORTRAN:BOOL=OFF")
set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF4_ENABLE_SZIP_SUPPORT:BOOL=ON")
Expand All @@ -399,11 +399,9 @@ jobs:
FC: ${{ steps.setup-fortran.outputs.fc }}
CC: ${{ steps.setup-fortran.outputs.cc }}
CXX: ${{ steps.setup-fortran.outputs.cxx }}
BINSIGN: ${{ needs.check-secret.outputs.sign-state }}
SIGNTOOLDIR: ${{ github.workspace }}/Microsoft.Windows.SDK.BuildTools/bin/10.0.22621.0/x64
run: |
cd "${{ runner.workspace }}/hdf4"
ctest -S HDF4config.cmake,CTEST_SITE_EXT=GH-Intel,LOCAL_SUBMIT=ON,BUILD_GENERATOR=VS202264,CTEST_SOURCE_NAME=${{ steps.set-file-base.outputs.SOURCE_BASE }} -C Release -VV -O hdf4.log
ctest -S HDF4config.cmake,CTEST_SITE_EXT=GH-Intel,LOCAL_SUBMIT=ON,NINJA=TRUE,BUILD_GENERATOR=VS202264,CTEST_SOURCE_NAME=${{ steps.set-file-base.outputs.SOURCE_BASE }} -C Release -VV -O hdf4.log
shell: pwsh
continue-on-error: true

Expand Down Expand Up @@ -478,8 +476,8 @@ jobs:
contents: |
set (CTEST_DROP_SITE_INIT "my.cdash.org")
# Change following line to submit to your CDash dashboard to a different CDash project
set (SITE_BUILDNAME_SUFFIX "${{ steps.set-file-base.outputs.FILE_BASE }}")
#set (CTEST_DROP_LOCATION_INIT "/submit.php?project=HDF4")
set (SITE_BUILDNAME_SUFFIX "${{ steps.set-file-base.outputs.FILE_BASE }}")
set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} --log-level=VERBOSE")
set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF4_BUILD_JAVA:BOOL=ON")
set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF4_BUILD_FORTRAN:BOOL=OFF")
Expand All @@ -496,7 +494,7 @@ jobs:
CXX: ${{ steps.setup-fortran.outputs.cxx }}
run: |
cd "${{ runner.workspace }}/hdf4"
ctest -S HDF4config.cmake,CTEST_SITE_EXT=GH-Intel,LOCAL_SUBMIT=ON,BUILD_GENERATOR=Unix,CTEST_SOURCE_NAME=${{ steps.set-file-base.outputs.SOURCE_BASE }} -C Release -VV -O hdf4.log
ctest -S HDF4config.cmake,CTEST_SITE_EXT=GH-Intel,LOCAL_SUBMIT=ON,NINJA=TRUE,BUILD_GENERATOR=Unix,CTEST_SOURCE_NAME=${{ steps.set-file-base.outputs.SOURCE_BASE }} -C Release -VV -O hdf4.log
shell: bash
continue-on-error: true

Expand All @@ -507,3 +505,194 @@ jobs:
name: intel-ubuntu-log
path: ${{ runner.workspace }}/hdf4/hdf4.log
if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn`

####### clang builds
build_and_test_win_clang:
# Windows w/ clang + CMake
#
name: "Windows ClangCL CTest"
runs-on: windows-latest
steps:
- name: Install Dependencies (Windows_clang)
run: choco install ninja

- name: add clang to env
uses: KyleMayes/install-llvm-action@v2.0.5
id: setup-clang
with:
env: true
version: '18'

- name: Set file base name (Windows_clang)
id: set-file-base
run: |
FILE_NAME_BASE=$(echo "${{ inputs.file_base }}")
echo "FILE_BASE=$FILE_NAME_BASE" >> $GITHUB_OUTPUT
if [[ '${{ inputs.use_environ }}' == 'release' ]]
then
SOURCE_NAME_BASE=$(echo "${{ inputs.snap_name }}")
else
SOURCE_NAME_BASE=$(echo "hdfsrc")
fi
echo "SOURCE_BASE=$SOURCE_NAME_BASE" >> $GITHUB_OUTPUT
shell: bash

# Get files created by release script
- name: Get zip-tarball (Windows_clang)
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: zip-tarball
path: ${{ github.workspace }}

- name: using powershell
shell: pwsh
run: Get-Location

- name: List files for the space (Windows_clang)
run: |
Get-ChildItem -Path ${{ github.workspace }}
Get-ChildItem -Path ${{ runner.workspace }}
shell: pwsh

- name: Uncompress source (Windows_clang)
working-directory: ${{ github.workspace }}
run: 7z x ${{ steps.set-file-base.outputs.FILE_BASE }}.zip
shell: bash

- name: Copy script files for the space (Windows_clang)
run: |
Copy-Item -Path ${{ runner.workspace }}/hdf4/${{ steps.set-file-base.outputs.SOURCE_BASE }}/config/cmake/scripts/CTestScript.cmake -Destination ${{ runner.workspace }}/hdf4/
Copy-Item -Path ${{ runner.workspace }}/hdf4/${{ steps.set-file-base.outputs.SOURCE_BASE }}/config/cmake/scripts/HDF4config.cmake -Destination ${{ runner.workspace }}/hdf4/
shell: pwsh

- name: List files for the hdf4 (Windows_clang)
run: |
Get-ChildItem -Path ${{ runner.workspace }}/hdf4
shell: pwsh

- name: Create options file (Windows_clang)
uses: "DamianReeves/write-file-action@master"
with:
path: ${{ runner.workspace }}/hdf4/HDF4options.cmake
write-mode: overwrite
contents: |
set (CTEST_DROP_SITE_INIT "my.cdash.org")
# Change following line to submit to your CDash dashboard to a different CDash project
#set (CTEST_DROP_LOCATION_INIT "/submit.php?project=HDF4")
set (SITE_BUILDNAME_SUFFIX "${{ steps.set-file-base.outputs.FILE_BASE }}")
#set (CMAKE_GENERATOR_TOOLSET "ClangCL")
set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} --log-level=VERBOSE")
#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_TOOLCHAIN_FILE:STRING=config/toolchain/clang.cmake")
set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF4_BUILD_JAVA:BOOL=ON")
set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF4_BUILD_FORTRAN:BOOL=OFF")
set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF4_ENABLE_SZIP_SUPPORT:BOOL=ON")
set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF4_ENABLE_SZIP_ENCODING:BOOL=ON")
set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DJPEG_USE_LOCALCONTENT:BOOL=OFF")
set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DLIBAEC_USE_LOCALCONTENT:BOOL=OFF")
set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DZLIB_USE_LOCALCONTENT:BOOL=OFF")
- name: Run ctest (Windows_clang) with clang
run: |
cd "${{ runner.workspace }}/hdf4"
ctest -S HDF4config.cmake,CTEST_SITE_EXT=GH-Clang,LOCAL_SUBMIT=ON,NINJA=TRUE,BUILD_GENERATOR=VS202264,CTEST_SOURCE_NAME=${{ steps.set-file-base.outputs.SOURCE_BASE }} -C Release -VV -O hdf4.log
shell: pwsh
continue-on-error: true

# Save log files created by ctest script
- name: Save log (Windows_clang)
uses: actions/upload-artifact@v4
with:
name: clang-win-log
path: ${{ runner.workspace }}/hdf4/hdf4.log
if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn`

build_and_test_linux_clang:
# Linux (Ubuntu) w/ clang + CMake
#
name: "Ubuntu Clang CMake"
runs-on: ubuntu-latest
steps:
- name: Install CMake Dependencies (Linux_clang)
run: |
sudo apt-get update
sudo apt-get install ninja-build doxygen graphviz curl libncurses5
- name: add clang to env
uses: KyleMayes/install-llvm-action@v2.0.5
id: setup-clang
with:
env: true
version: '18'

- name: Set file base name (Linux_clang)
id: set-file-base
run: |
FILE_NAME_BASE=$(echo "${{ inputs.file_base }}")
echo "FILE_BASE=$FILE_NAME_BASE" >> $GITHUB_OUTPUT
if [[ '${{ inputs.use_environ }}' == 'release' ]]
then
SOURCE_NAME_BASE=$(echo "${{ inputs.snap_name }}")
else
SOURCE_NAME_BASE=$(echo "hdfsrc")
fi
echo "SOURCE_BASE=$SOURCE_NAME_BASE" >> $GITHUB_OUTPUT
# Get files created by release script
- name: Get tgz-tarball (Linux_clang)
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: tgz-tarball
path: ${{ github.workspace }}

- name: List files for the space (Linux_clang)
run: |
ls -l ${{ github.workspace }}
ls ${{ runner.workspace }}
- name: Uncompress source (Linux_clang)
run: tar -zxvf ${{ github.workspace }}/${{ steps.set-file-base.outputs.FILE_BASE }}.tar.gz

- name: Copy script files for the space (Linux_clang)
run: |
cp ${{ github.workspace }}/${{ steps.set-file-base.outputs.SOURCE_BASE }}/config/cmake/scripts/CTestScript.cmake ${{ runner.workspace }}/hdf4
cp ${{ github.workspace }}/${{ steps.set-file-base.outputs.SOURCE_BASE }}/config/cmake/scripts/HDF4config.cmake ${{ runner.workspace }}/hdf4
- name: List files for the hdf4 (Linux_clang)
run: |
ls ${{ runner.workspace }}/hdf4
- name: Create options file (Linux_clang)
uses: "DamianReeves/write-file-action@master"
with:
path: ${{ runner.workspace }}/hdf4/HDF4options.cmake
write-mode: overwrite
contents: |
set (CTEST_DROP_SITE_INIT "my.cdash.org")
# Change following line to submit to your CDash dashboard to a different CDash project
set (SITE_BUILDNAME_SUFFIX "${{ steps.set-file-base.outputs.FILE_BASE }}")
#set (CTEST_DROP_LOCATION_INIT "/submit.php?project=HDF4")
set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} --log-level=VERBOSE")
#set (CMAKE_GENERATOR_TOOLSET "clang")
#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_TOOLCHAIN_FILE:STRING=config/toolchain/clang.cmake")
set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF4_BUILD_JAVA:BOOL=ON")
set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF4_BUILD_FORTRAN:BOOL=OFF")
set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF4_ENABLE_SZIP_SUPPORT:BOOL=ON")
set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF4_ENABLE_SZIP_ENCODING:BOOL=ON")
set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DJPEG_USE_LOCALCONTENT:BOOL=OFF")
set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DLIBAEC_USE_LOCALCONTENT:BOOL=OFF")
set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DZLIB_USE_LOCALCONTENT:BOOL=OFF")
- name: Run ctest (Linux_clang)
run: |
cd "${{ runner.workspace }}/hdf4"
ctest -S HDF4config.cmake,CTEST_SITE_EXT=GH-Clang,LOCAL_SUBMIT=ON,NINJA=TRUE,BUILD_GENERATOR=Unix,CTEST_SOURCE_NAME=${{ steps.set-file-base.outputs.SOURCE_BASE }} -C Release -VV -O hdf4.log
shell: bash
continue-on-error: true

# Save log files created by ctest script
- name: Save log (Linux_clang)
uses: actions/upload-artifact@v4
with:
name: clang-ubuntu-log
path: ${{ runner.workspace }}/hdf4/hdf4.log
if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn`
20 changes: 17 additions & 3 deletions .github/workflows/daily-build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: hdf4 dev daily build

# Triggers the workflow on a schedule or on demand
# Triggers the workflow on demand or on a call from another workflow
# NOTE: inputs must be duplicated between triggers
on:
workflow_dispatch:
inputs:
Expand All @@ -9,8 +10,13 @@ on:
type: string
required: false
default: check
schedule:
- cron: "6 0 * * *"
workflow_call:
inputs:
use_ignore:
description: 'Ignore has_changes check'
type: string
required: false
default: check

permissions:
contents: read
Expand Down Expand Up @@ -60,6 +66,14 @@ jobs:
use_environ: snapshots
if: ${{ ((needs.call-workflow-tarball.outputs.has_changes == 'true') || (needs.get-old-names.outputs.run-ignore == 'ignore')) }}

call-workflow-sanitizers:
needs: [get-old-names, call-workflow-tarball]
uses: ./.github/workflows/cmake-analysis.yml
with:
file_base: ${{ needs.call-workflow-tarball.outputs.file_base }}
use_environ: snapshots
if: ${{ ((needs.call-workflow-tarball.outputs.has_changes == 'true') || (needs.get-old-names.outputs.run-ignore == 'ignore')) }}

call-workflow-ctest:
needs: [get-old-names, call-workflow-tarball]
uses: ./.github/workflows/cmake-ctest.yml
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/daily-schedule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: hdf4 dev daily build on schedule

# Triggers the workflow on a schedule or on demand
on:
workflow_dispatch:
schedule:
- cron: "6 0 * * *"

permissions:
contents: read

jobs:
daily-build:
uses: ./.github/workflows/daily-build.yml
with:
use_ignore: check
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -471,8 +471,10 @@ option (HDF4_ENABLE_COVERAGE "Enable code coverage for Libraries and Programs" O
if (HDF4_ENABLE_COVERAGE)
include (${HDF4_SOURCE_DIR}/config/sanitizer/code-coverage.cmake)
if(CODE_COVERAGE AND CODE_COVERAGE_ADDED)
message(VERBOSE "Add instrumentation to all targets")
add_code_coverage () # Adds instrumentation to all targets
else ()
message(VERBOSE "Use --coverage option")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 --coverage -fprofile-arcs -ftest-coverage")
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
set (LDFLAGS "${LDFLAGS} -fprofile-arcs -ftest-coverage")
Expand Down
34 changes: 14 additions & 20 deletions config/cmake/JPEG/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ CHECK_INCLUDE_FILE_CONCAT ("stddef.h" HAVE_STDDEF_H)
#----------------------------------------------------------------
# JPEG special check
#----------------------------------------------------------------
CHECK_TYPE_SIZE ("unsigned char" UNSIGNED_CHAR)
CHECK_TYPE_SIZE ("unsigned short" UNSIGNED_SHORT)
CHECK_TYPE_SIZE ("unsigned char" HAVE_UNSIGNED_CHAR)
CHECK_TYPE_SIZE ("unsigned short" HAVE_UNSIGNED_SHORT)

CHECK_INCLUDE_FILE_CONCAT ("string.h" HAVE_STRING_H)
CHECK_INCLUDE_FILE_CONCAT ("strings.h" HAVE_STRINGS_H)
Expand Down Expand Up @@ -134,24 +134,6 @@ if (MSVC)
set (CMAKE_MFC_FLAG 0)
endif ()

#-----------------------------------------------------------------------------
# Compiler specific flags : Shouldn't there be compiler tests for these
#-----------------------------------------------------------------------------
if (CMAKE_COMPILER_IS_GNUCC)
set (CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS} -Wno-strict-prototypes")
endif ()
if (CMAKE_C_COMPILER_ID MATCHES "IntelLLVM" OR CMAKE_C_COMPILER_ID MATCHES "[Cc]lang")
set (CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS} -Wno-deprecated-non-prototype -Wno-strict-prototypes")
endif ()

#-----------------------------------------------------------------------------
# This is in here to help some of the GCC based IDES like Eclipse
# and code blocks parse the compiler errors and warnings better.
#-----------------------------------------------------------------------------
if (CMAKE_COMPILER_IS_GNUCC)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fmessage-length=0")
endif ()

#-----------------------------------------------------------------------------
set (MEMORYMGR jmemnobs)
option (ENABLE_MEMORYMGR "Select memory manager" OFF)
Expand Down Expand Up @@ -231,6 +213,18 @@ set (JPEG_PUBLIC_HEADERS

add_library (${JPEG_LIB_TARGET} STATIC ${JPEG_SRCS} ${JPEG_HDRS} ${JPEG_PUBLIC_HEADERS})
target_include_directories(${JPEG_LIB_TARGET} PRIVATE "${JPEG_SRC_DIR};${CMAKE_BINARY_DIR}")
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
target_compile_options(${JPEG_LIB_TARGET} PRIVATE -Wno-strict-prototypes)
endif ()
if (CMAKE_C_COMPILER_ID MATCHES "IntelLLVM" OR CMAKE_C_COMPILER_ID MATCHES "[Cc]lang")
target_compile_options(${JPEG_LIB_TARGET} PRIVATE -Wno-deprecated-non-prototype -Wno-strict-prototypes)
endif ()
if (WIN32 AND CMAKE_C_COMPILER_ID MATCHES "[Cc]lang")
target_compile_options(${JPEG_LIB_TARGET} PRIVATE -Wno-implicit-function-declaration -Wno-typedef-redefinition)
endif ()
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
target_compile_options(${JPEG_LIB_TARGET} PRIVATE -fmessage-length=0)
endif ()
TARGET_C_PROPERTIES (${JPEG_LIB_TARGET} STATIC)
target_link_libraries (${JPEG_LIB_TARGET} PRIVATE ${LINK_LIBS})
H4_SET_LIB_OPTIONS (${JPEG_LIB_TARGET} ${JPEG_LIB_NAME} STATIC 0)
Expand Down
Loading

0 comments on commit db1836e

Please sign in to comment.