CMake #386
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CMake | |
on: | |
push: | |
# branches: | |
# - master | |
# - develop | |
paths-ignore: | |
- 'doc/**' | |
- '!doc/CMakeLists.txt' | |
- '!doc/Makefile.am' | |
- 'HTMLversion/**' | |
- 'Version3/**' | |
- 'README.md' | |
pull_request: | |
branches: | |
- master | |
- develop | |
paths-ignore: | |
- 'doc/**' | |
- '!doc/CMakeLists.txt' | |
- '!doc/Makefile.am' | |
- 'HTMLversion/**' | |
- 'Version3/**' | |
- 'README.md' | |
schedule: | |
- cron: '1 2 * * 2' | |
workflow_dispatch: | |
inputs: | |
CMemCheck: | |
description: 'CMemCheck: Choose this option to include the CMake Valgrind tests.' | |
required: false | |
default: false | |
type: boolean | |
jobs: | |
# check_files: | |
# runs-on: ubuntu-latest | |
# steps: | |
# - uses: actions/checkout@v4 | |
# name: Check out repository | |
# - run: ./check_utf8.sh | |
# name: Run check_utf8.sh | |
build-numdiff: | |
runs-on: windows-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- { icon: '⚫', sys: mingw32 } | |
# - { icon: '🟦', sys: mingw64 } | |
# - { icon: '🟨', sys: ucrt64 } | |
# - { icon: '🟧', sys: clang64 } | |
name: 🚧${{ matrix.icon }} ${{ matrix.sys }} | |
defaults: | |
run: | |
shell: msys2 {0} | |
steps: | |
- name: '🧰 Checkout' | |
uses: actions/checkout@v4 | |
with: | |
repository: usgs-coupled/numdiff | |
- name: Cache numdiff | |
id: cache-numdiff | |
uses: actions/cache@v4 | |
with: | |
path: ${{ runner.workspace }}/${{ matrix.sys }} | |
key: ${{ runner.workspace }}-${{ matrix.sys }} | |
- name: '${{ matrix.icon }} Setup MSYS2' | |
if: steps.cache-numdiff.outputs.cache-hit != 'true' | |
uses: msys2/setup-msys2@v2 | |
with: | |
msystem: ${{ matrix.sys }} | |
update: true | |
install: >- | |
gcc | |
make | |
texinfo | |
texinfo-tex | |
# pacboy: >- | |
# texlive-bin:p | |
# texlive-core:p | |
# texlive-plain-generic:p | |
# texlive-fonts-recommended:p | |
# toolchain:p | |
- name: '🚧 Build numdiff' | |
if: steps.cache-numdiff.outputs.cache-hit != 'true' | |
run: | | |
mkdir _build | |
cd _build | |
../configure --disable-nls --prefix $(cygpath "${{ runner.workspace }}/${{ matrix.sys }}/${{ matrix.sys }}") | |
make -j2 | |
make install | |
# cp $(which libgmp-10.dll) $(cygpath "${{ runner.workspace }}/${{ matrix.sys }}/${{ matrix.sys }}")/bin/. | |
# cp $(which libiconv-2.dll) $(cygpath "${{ runner.workspace }}/${{ matrix.sys }}/${{ matrix.sys }}")/bin/. | |
# cp $(which libintl-8.dll) $(cygpath "${{ runner.workspace }}/${{ matrix.sys }}/${{ matrix.sys }}")/bin/. | |
ldd $(cygpath "${{ runner.workspace }}/${{ matrix.sys }}/${{ matrix.sys }}")/bin/numdiff.exe | |
cp $(which msys-2.0.dll) $(cygpath "${{ runner.workspace }}/${{ matrix.sys }}/${{ matrix.sys }}")/bin/. | |
ldd $(cygpath "${{ runner.workspace }}/${{ matrix.sys }}/${{ matrix.sys }}")/bin/msys-2.0.dll | |
- name: 'Upload artifact' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.sys }}-artifact | |
path: ${{ runner.workspace }}/${{ matrix.sys }} | |
build: | |
##needs: [check_files] | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macos-latest, ubuntu-latest, windows-latest] | |
# The CMake configure and build commands are platform agnostic and should work equally | |
# well on Windows or Mac. You can convert this to a matrix build if you need | |
# cross-platform coverage. | |
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix | |
runs-on: ${{ matrix.os }} | |
env: | |
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | |
BUILD_TYPE: Release | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Configure | |
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. | |
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type | |
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} | |
- name: Build | |
# Build your program with the given configuration | |
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} | |
ctest: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macos-latest, ubuntu-latest, windows-latest] | |
needs: [build, build-numdiff] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install ninja numdiff valgrind (Linux) | |
if: runner.os == 'Linux' | |
run: sudo apt-get update && sudo apt-get install -y ninja-build numdiff valgrind | |
- name: Install ninja numdiff (macOS) | |
if: runner.os == 'macOS' | |
run: brew install ninja numdiff | |
- name: Download numdiff (Windows) | |
if: runner.os == 'Windows' | |
uses: actions/download-artifact@v4 | |
with: | |
name: mingw32-artifact | |
- name: Set up Visual Studio shell (Windows) | |
if: runner.os == 'Windows' | |
uses: egor-tensin/vs-shell@v2 | |
with: | |
arch: x64 | |
- name: CTest | |
run: ctest -S ctest.cmake -DCTEST_TEST_TIMEOUT=900 | |
- name: CMemCheck (Linux) | |
if: runner.os == 'Linux' && (github.event_name == 'schedule' || inputs.CMemCheck) | |
run: ctest -S cmemcheck.cmake -DCTEST_TEST_TIMEOUT=900 | |
- name: Upload results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.os }}-results | |
path: ${{ github.workspace }}/_ctest/Testing/ |