Skip to content

Commit

Permalink
Merge pull request #433 from scivision/ci
Browse files Browse the repository at this point in the history
CI: use modern actions and cmake calls
  • Loading branch information
WardF authored Mar 11, 2024
2 parents 808e5ac + 8e85fb1 commit 54a3d84
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 62 deletions.
55 changes: 22 additions & 33 deletions .github/workflows/run_tests_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ name: Run netCDF-Fortran Linux tests

on: [pull_request, workflow_dispatch]

concurrency:
group: ${{ github.workflow}}-${{ github.head_ref }}
concurrency:
group: ${{ github.workflow}}-${{ github.head_ref }}
cancel-in-progress: true

jobs:
Expand All @@ -23,7 +23,7 @@ jobs:

steps:

- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Install System dependencies
shell: bash -l {0}
Expand All @@ -41,7 +41,7 @@ jobs:
###
- name: Cache libhdf5-${{ matrix.hdf5 }}-${{ matrix.netcdf }}
id: cache-hdf5
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ~/environments/${{ matrix.hdf5 }}-${{ matrix.netcdf }}
key: hdf5-${{ runner.os }}-${{ matrix.hdf5 }}-${{ matrix.netcdf }}
Expand Down Expand Up @@ -79,7 +79,7 @@ jobs:

steps:

- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Install System dependencies
shell: bash -l {0}
Expand All @@ -98,7 +98,7 @@ jobs:
###
- name: Cache libhdf5-${{ matrix.hdf5 }}-${{ matrix.netcdf }}-par
id: cache-hdf5-par
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ~/environments/${{ matrix.hdf5 }}-${{ matrix.netcdf }}
key: hdf5-${{ runner.os }}-${{ matrix.hdf5 }}-${{ matrix.netcdf }}-par
Expand Down Expand Up @@ -138,7 +138,7 @@ jobs:

steps:

- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Install System dependencies
shell: bash -l {0}
Expand All @@ -153,14 +153,14 @@ jobs:
- run: echo "LD_LIBRARY_PATH=${HOME}/environments/${{ matrix.hdf5 }}-${{ matrix.netcdf }}/lib" >> $GITHUB_ENV
- run: echo "HDF5_PLUGIN_PATH=${HOME}/environments/${{ matrix.hdf5 }}-${{ matrix.netcdf }}/lib" >> $GITHUB_ENV
- run: echo "HDF5_PLUGIN_DIR=${HOME}/environments/${{ matrix.hdf5 }}-${{ matrix.netcdf }}/lib" >> $GITHUB_ENV

###
# Fetch Cache
###

- name: Fetch HDF Cache
id: cache-hdf
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ~/environments/${{ matrix.hdf5 }}-${{ matrix.netcdf }}
key: hdf5-${{ runner.os }}-${{ matrix.hdf5 }}-${{ matrix.netcdf }}
Expand Down Expand Up @@ -225,7 +225,7 @@ jobs:

nf-autotools-par:

needs: build-deps-par
needs: build-deps-par
runs-on: ubuntu-latest

strategy:
Expand All @@ -235,7 +235,7 @@ jobs:

steps:

- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Install System dependencies
shell: bash -l {0}
Expand All @@ -258,7 +258,7 @@ jobs:

- name: Fetch HDF Cache
id: cache-hdf-par
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ~/environments/${{ matrix.hdf5 }}-${{ matrix.netcdf }}
key: hdf5-${{ runner.os }}-${{ matrix.hdf5 }}-${{ matrix.netcdf }}-par
Expand Down Expand Up @@ -320,7 +320,7 @@ jobs:
#- name: Make Distcheck
# shell: bash -l {0}
# run: CFLAGS=${CFLAGS} LDFLAGS=${LDFLAGS} LD_LIBRARY_PATH=${LD_LIBRARY_PATH} make distcheck -j

nf-cmake:

needs: build-deps
Expand All @@ -333,7 +333,7 @@ jobs:

steps:

- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Install System dependencies
shell: bash -l {0}
Expand All @@ -349,14 +349,14 @@ jobs:
- run: echo "CMAKE_PREFIX_PATH=${HOME}/environments/${{ matrix.hdf5 }}-${{ matrix.netcdf}}" >> $GITHUB_ENV
- run: echo "HDF5_PLUGIN_PATH=${HOME}/environments/${{ matrix.hdf5 }}-${{ matrix.netcdf }}/lib" >> $GITHUB_ENV
- run: echo "HDF5_PLUGIN_DIR=${HOME}/environments/${{ matrix.hdf5 }}-${{ matrix.netcdf }}/lib" >> $GITHUB_ENV

###
# Fetch Cache
###

- name: Fetch HDF Cache
id: cache-hdf5
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ~/environments/${{ matrix.hdf5 }}-${{ matrix.netcdf }}
key: hdf5-${{ runner.os }}-${{ matrix.hdf5 }}-${{ matrix.netcdf }}
Expand Down Expand Up @@ -385,36 +385,25 @@ jobs:

- name: Perform out-of-directory build
shell: bash -l {0}
run: |
mkdir build
cd build
LD_LIBRARY_PATH=${LD_LIBRARY_PATH} cmake .. -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}
run: LD_LIBRARY_PATH=${LD_LIBRARY_PATH} cmake -Bbuild -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}

- name: Print Summary
shell: bash -l {0}
run: |
cd build
cat libnetcdff.settings
run: cat build/libnetcdff.settings

- name: Build All
shell: bash -l {0}
run: |
cd build
LD_LIBRARY_PATH=${LD_LIBRARY_PATH} make -j 12
run: LD_LIBRARY_PATH=${LD_LIBRARY_PATH} cmake --build build --parallel
if: ${{ success() }}

- name: Run Tests
shell: bash -l {0}
run: |
cd build
LD_LIBRARY_PATH=${LD_LIBRARY_PATH} ctest -j 1 .
run: LD_LIBRARY_PATH=${LD_LIBRARY_PATH} ctest --test-dir build
if: ${{ success() }}

- name: Look at LastTest.log if error
shell: bash -l {0}
run: |
cat /home/runner/work/netcdf-fortran/netcdf-fortran/build/Testing/Temporary/LastTest.log
cd build
LD_LIBRARY_PATH=${LD_LIBRARY_PATH} ctest --rerun-failed --output-on-failure
cat build/Testing/Temporary/LastTest.log
LD_LIBRARY_PATH=${LD_LIBRARY_PATH} ctest --test-dir build --rerun-failed --output-on-failure
if: ${{ failure() }}
48 changes: 19 additions & 29 deletions .github/workflows/run_tests_macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ name: Run netCDF-Fortran MacOS tests

on: [ workflow_dispatch ]

concurrency:
group: ${{ github.workflow}}-${{ github.head_ref }}
concurrency:
group: ${{ github.workflow}}-${{ github.head_ref }}
cancel-in-progress: true

jobs:
Expand All @@ -23,7 +23,7 @@ jobs:

steps:

- uses: actions/checkout@v2
- uses: actions/checkout@v4

###
# Set Environmental Variables
Expand All @@ -38,13 +38,13 @@ jobs:
- run: echo "DYLD_LIBRARY_PATH=${HOME}/environments/${{ matrix.hdf5 }}-${{ matrix.netcdf }}/lib" >> $GITHUB_ENV
- run: echo "PATH=${HOME}/environments/${{ matrix.hdf5 }}-${{ matrix.netcdf }}/bin:${PATH}" >> $GITHUB_ENV

- run: brew install automake libaec
- run: brew install automake libaec
###
# Installing libhdf4 and libhdf5
###
- name: Cache libhdf5-${{ matrix.hdf5 }}-${{ matrix.netcdf }}
id: cache-hdf5
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ~/environments/${{ matrix.hdf5 }}-${{ matrix.netcdf }}
key: hdf5-${{ runner.os }}-${{ matrix.hdf5 }}-${{ matrix.netcdf }}
Expand Down Expand Up @@ -83,7 +83,7 @@ jobs:

steps:

- uses: actions/checkout@v2
- uses: actions/checkout@v4
###
# Set Environmental Variables
###
Expand All @@ -92,22 +92,22 @@ jobs:
- run: echo "FFLAGS=-I${HOME}/environments/${{ matrix.hdf5 }}-${{ matrix.netcdf }}/include" >> $GITHUB_ENV
- run: echo "CFLAGS=-I${HOME}/environments/${{ matrix.hdf5 }}-${{ matrix.netcdf }}/include" >> $GITHUB_ENV

- run: echo "CPPFLAGS=-I${HOME}/environments/${{ matrix.hdf5 }}-${{ matrix.netcdf }}/include" >> $GITHUB_ENV
- run: echo "CPPFLAGS=-I${HOME}/environments/${{ matrix.hdf5 }}-${{ matrix.netcdf }}/include" >> $GITHUB_ENV
- run: echo "LDFLAGS=-L${HOME}/environments/${{ matrix.hdf5 }}-${{ matrix.netcdf }}/lib" >> $GITHUB_ENV
- run: echo "LD_LIBRARY_PATH=${HOME}/environments/${{ matrix.hdf5 }}-${{ matrix.netcdf }}/lib" >> $GITHUB_ENV
- run: echo "DYLD_LIBRARY_PATH=${HOME}/environments/${{ matrix.hdf5 }}-${{ matrix.netcdf }}/lib" >> $GITHUB_ENV
- run: echo "PATH=${HOME}/environments/${{ matrix.hdf5 }}-${{ matrix.netcdf }}/bin:${PATH}" >> $GITHUB_ENV

- run: brew install automake
- run: brew install automake


###
# Fetch Cache
###

- name: Fetch HDF Cache
id: cache-hdf
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ~/environments/${{ matrix.hdf5 }}-${{ matrix.netcdf }}
key: hdf5-${{ runner.os }}-${{ matrix.hdf5 }}-${{ matrix.netcdf }}
Expand Down Expand Up @@ -169,7 +169,7 @@ jobs:

steps:

- uses: actions/checkout@v2
- uses: actions/checkout@v4

###
# Set Environmental Variables
Expand All @@ -182,15 +182,15 @@ jobs:
- run: echo "LD_LIBRARY_PATH=${HOME}/environments/${{ matrix.hdf5 }}-${{ matrix.netcdf }}/lib" >> $GITHUB_ENV
- run: echo "CMAKE_PREFIX_PATH=${HOME}/environments/${{ matrix.hdf5 }}-${{ matrix.netcdf}}" >> $GITHUB_ENV

- run: brew install automake
- run: brew install automake

###
# Fetch Cache
###

- name: Fetch HDF Cache
id: cache-hdf5
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ~/environments/${{ matrix.hdf5 }}-${{ matrix.netcdf }}
key: hdf5-${{ runner.os }}-${{ matrix.hdf5 }}-${{ matrix.netcdf }}
Expand All @@ -205,36 +205,26 @@ jobs:

- name: Perform out-of-directory build
shell: bash -l {0}
run: |
mkdir build
cd build
LD_LIBRARY_PATH=${LD_LIBRARY_PATH} cmake .. -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}
run: LD_LIBRARY_PATH=${LD_LIBRARY_PATH} cmake -B build -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}

- name: Print Summary
shell: bash -l {0}
run: |
cd build
cat libnetcdff.settings
run: cat build/libnetcdff.settings

- name: Build All
shell: bash -l {0}
run: |
cd build
LD_LIBRARY_PATH=${LD_LIBRARY_PATH} make -j 12
run: LD_LIBRARY_PATH=${LD_LIBRARY_PATH} cmake --build build --parallel
if: ${{ success() }}

- name: Run Tests
shell: bash -l {0}
run: |
cd build
LD_LIBRARY_PATH=${LD_LIBRARY_PATH} ctest -j 1 .
run: LD_LIBRARY_PATH=${LD_LIBRARY_PATH} ctest --test-dir build
if: ${{ success() }}

- name: Look at LastTest.log if error
shell: bash -l {0}
run: |
cat /home/runner/work/netcdf-fortran/netcdf-fortran/build/Testing/Temporary/LastTest.log
cd build
LD_LIBRARY_PATH=${LD_LIBRARY_PATH} ctest --rerun-failed --output-on-failure
cat build/Testing/Temporary/LastTest.log
LD_LIBRARY_PATH=${LD_LIBRARY_PATH} ctest --test-dir build --rerun-failed --output-on-failure
if: ${{ failure() }}

0 comments on commit 54a3d84

Please sign in to comment.