Skip to content

Commit

Permalink
ci:cmake: use hdf5 autobuild for all
Browse files Browse the repository at this point in the history
  • Loading branch information
scivision committed Oct 8, 2020
1 parent 64596dd commit d6b1c16
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 60 deletions.
31 changes: 11 additions & 20 deletions .github/workflows/ci_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,23 @@ on:

jobs:

cmake:
runs-on: ubuntu-20.04
default:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- run: |
sudo apt update -yq
sudo apt install -yq --no-install-recommends gfortran libhdf5-dev
- run: ctest -S setup.cmake -VV
env:
FC: gfortran-9
CC: gcc-9

- name: build examples
run: |
cmake -B Examples/build -S Examples
cmake --build Examples/build
- name: test examples
run: ctest -V
working-directory: Examples/build

build_hdf5:
examples:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- run: ctest -S setup.cmake -VV
env:
FC: gfortran-9
CC: gcc-9
- run: cmake -B Examples/build -S Examples
- run: cmake --build Examples/build

- run: ctest -V
working-directory: Examples/build
30 changes: 17 additions & 13 deletions .github/workflows/ci_mac.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
name: ci_mac

env:
FC: gfortran-9
CC: gcc-9
CXX: g++-9

on:
push:
paths:
Expand All @@ -9,23 +14,22 @@ on:

jobs:

cmake:
default:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2

- run: brew install pkg-config hdf5 ninja
- run: ctest -S setup.cmake -VV

- run: ctest -S setup.cmake -V
env:
FC: gfortran-9
CC: gcc-9
# examples:
# works but saving CI time
# runs-on: macos-latest
# steps:
# - uses: actions/checkout@v2

- name: build examples
run: |
cmake -B Examples/build -S Examples
cmake --build Examples/build
# - run: cmake -B Examples/build -S Examples
# - run: cmake --build Examples/build

- name: test examples
run: ctest -V
working-directory: Examples/build
# - name: test examples
# run: ctest -V
# working-directory: Examples/build
55 changes: 33 additions & 22 deletions .github/workflows/ci_windows.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: ci_windows

env:
CMAKE_GENERATOR: Ninja
FC: gfortran
CC: gcc
CXX: g++

on:
push:
Expand All @@ -11,30 +14,38 @@ on:

jobs:

cmake:
default:
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
steps:
- uses: msys2/setup-msys2@v2
with:
update: true
install: 'git mingw-w64-x86_64-cmake mingw-w64-x86_64-ninja mingw-w64-x86_64-gcc-fortran mingw-w64-x86_64-hdf5'

- uses: actions/checkout@v2

# - run: ctest -S setup.cmake -VV # avoids missing environment variable weird bugs
- run: cmake -B build
- run: cmake --build build
- run: ctest -V
working-directory: build
- run: ctest -S setup.cmake -VV

# examples:
# works but saving CI time
# runs-on: windows-latest
# steps:
# - uses: actions/checkout@v2

# - run: pip install ninja

# - run: cmake -BExamples/build -SExamples -GNinja
# - run: cmake --build Examples/build

# - run: ctest -V
# working-directory: Examples/build

- name: build examples
run: |
cmake -B Examples/build -S Examples
cmake --build Examples/build
# msys2:
# works but saving CI time
# runs-on: windows-latest
# defaults:
# run:
# shell: msys2 {0}
# steps:
# - uses: msys2/setup-msys2@v2
# with:
# update: true
# install: 'git mingw-w64-x86_64-cmake mingw-w64-x86_64-ninja mingw-w64-x86_64-gcc-fortran mingw-w64-x86_64-hdf5'
# - uses: actions/checkout@v2

- name: test examples
run: ctest -V
working-directory: Examples/build
# - run: ctest -S setup.cmake -VV
6 changes: 1 addition & 5 deletions Examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,10 @@ else()
include(FetchContent)
FetchContent_Declare(h5fortran_proj
GIT_REPOSITORY https://github.com/geospace-code/h5fortran.git
GIT_TAG v3.2.3)
GIT_TAG master)
FetchContent_MakeAvailable(h5fortran_proj)
endif()

if(NOT HDF5OK)
message(FATAL_ERROR "HDF5 is not working on your system, so h5fortran cannot work.")
endif()

# this helps linters e.g. Visual Studio Intellicode work properly
set(CMAKE_EXPORT_COMPILE_COMMANDS on)

Expand Down

0 comments on commit d6b1c16

Please sign in to comment.