Skip to content

Commit dd4de94

Browse files
committed
use presets for testing, unify options
1 parent 652f11e commit dd4de94

15 files changed

Lines changed: 275 additions & 198 deletions

.github/workflows/ci.yml

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@ name: ci
22

33
env:
44
HOMEBREW_NO_INSTALL_CLEANUP: 1
5-
CMAKE_BUILD_PARALLEL_LEVEL: 4
6-
CTEST_PARALLEL_LEVEL: 0
7-
CTEST_NO_TESTS_ACTION: error
85
CMAKE_INSTALL_PREFIX: ~/libs
96
CMAKE_PREFIX_PATH: ~/libs
7+
CMAKE_GENERATOR: Ninja
108

119
on:
1210
push:
@@ -35,44 +33,59 @@ jobs:
3533
strategy:
3634
matrix:
3735
os: [ubuntu-latest, macos-latest]
38-
shared: [true, false]
3936

4037
steps:
41-
- uses: actions/checkout@v4
4238

43-
- name: install NetCDF system libs
39+
- &checkout
40+
uses: actions/checkout@v6
41+
42+
- &ncdf-linux
43+
name: install NetCDF (Linux)
4444
if: runner.os == 'Linux'
45-
run: sudo apt install --no-install-recommends libnetcdff-dev
45+
run: |
46+
sudo apt update
47+
sudo apt install --no-install-recommends libnetcdff-dev
4648
47-
- name: install NetCDF system libs
49+
- &ncdf-macos
50+
name: install NetCDF (macOS)
4851
if: runner.os == 'macOS'
4952
run: brew install netcdf-fortran
5053

51-
- run: >-
52-
cmake
53-
--preset multi
54-
-DBUILD_SHARED_LIBS:BOOL=${{ matrix.shared }}
54+
- run: cmake --workflow debug
55+
- run: cmake --workflow release
5556

56-
- run: cmake --build --preset debug
57-
- run: ctest --preset debug
57+
- run: cmake --install build
5858

59-
- run: cmake --build --preset release
60-
- run: ctest --preset release
59+
- &example
60+
name: Example workflow
61+
working-directory: example
62+
run: cmake --workflow default
6163

62-
- run: cmake --install build
64+
shared:
65+
runs-on: ${{ matrix.os }}
66+
timeout-minutes: 15
67+
68+
env:
69+
FC: gfortran-14
70+
71+
strategy:
72+
matrix:
73+
os: [ubuntu-latest, macos-latest]
74+
75+
steps:
76+
77+
- *checkout
78+
79+
- *ncdf-linux
80+
81+
- *ncdf-macos
82+
83+
- run: cmake --workflow shared
6384

64-
- name: configure examples
65-
run: >-
66-
cmake
67-
-S example
68-
-B example/build
69-
-DBUILD_SHARED_LIBS:BOOL=${{ matrix.shared }}
85+
- run: cmake --install build
7086

71-
- name: build examples
72-
run: cmake --build example/build
87+
- *example
7388

74-
- name: Test examples
75-
run: ctest --test-dir example/build -V
7689

7790
build:
7891
needs: base
@@ -81,51 +94,42 @@ jobs:
8194
timeout-minutes: 15
8295

8396
env:
97+
CC: gcc-14
8498
FC: gfortran-14
8599

86100
strategy:
87101
matrix:
88102
os: [ubuntu-latest, macos-latest]
89103

90104
steps:
91-
- uses: actions/checkout@v4
105+
- *checkout
92106

93107
- name: install HDF5 (macOS)
94108
if: runner.os == 'macOS'
95109
run: brew install hdf5
96110

97111
- name: install HDF5 (Linux)
98-
if: runner.os == 'Linux'
99-
run: sudo apt install --no-install-recommends libhdf5-dev
100-
101-
- name: GCC Linux
102112
if: runner.os == 'Linux'
103113
run: |
104-
echo "CC=gcc-14" >> $GITHUB_ENV
114+
sudo apt update
115+
sudo apt install --no-install-recommends libhdf5-dev
105116
106117
- run: cmake --workflow default
107118

108119
- run: cmake --install build
109120

110-
- name: configure examples
111-
run: cmake -S example -B example/build
112-
113-
- name: build examples
114-
run: cmake --build example/build
115-
116-
- name: Test examples
117-
run: ctest --test-dir example/build -V
121+
- *example
118122

119123

120124
linux-coverage:
121-
if: github.event_name == 'release'
125+
if: false
122126
needs: base
123127
runs-on: ubuntu-latest
124128
timeout-minutes: 10
125129

126130
steps:
127-
- uses: actions/checkout@v4
128-
- uses: actions/setup-python@v5
131+
- *checkout
132+
- uses: actions/setup-python@v6
129133
with:
130134
python-version: '3.x'
131135

@@ -137,13 +141,9 @@ jobs:
137141
- name: install Gcovr
138142
run: pip install gcovr
139143

140-
- run: cmake --preset coverage
141-
- run: cmake --build --preset coverage
142-
143-
- name: Code coverage
144-
run: cmake --build --preset run-coverage
144+
- run: cmake --workflow coverage
145145

146-
- uses: actions/upload-artifact@v4
146+
- uses: actions/upload-artifact@v7
147147
with:
148148
name: coverage-report-html
149149
path: build-coverage/coverage/

.github/workflows/ci_fpm.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919

2020
steps:
2121

22-
- uses: fortran-lang/setup-fpm@v7
22+
- uses: fortran-lang/setup-fpm@v9
2323
with:
2424
github-token: ${{ secrets.GITHUB_TOKEN }}
2525

@@ -28,7 +28,7 @@ jobs:
2828
sudo apt update
2929
sudo apt install --no-install-recommends libnetcdff-dev
3030
31-
- uses: actions/checkout@v4
31+
- uses: actions/checkout@v6
3232

3333
- run: fpm build
3434
- run: fpm test

.github/workflows/ci_windows.yml

Lines changed: 27 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,29 @@
11
name: ci_windows
22

3+
env:
4+
CMAKE_GENERATOR: Ninja
5+
36
on:
47
push:
58
paths:
9+
- "**.c"
10+
- "**.cpp"
11+
- "**.f90"
12+
- "**.F90"
613
- "**/CMakeLists.txt"
714
- "**.cmake"
8-
- "**.f90"
915
- ".github/workflows/ci_windows.yml"
16+
- "!memcheck.cmake"
17+
- "!coverage.cmake"
1018
- "!scripts/**"
11-
12-
env:
13-
CMAKE_BUILD_PARALLEL_LEVEL: 4
14-
CTEST_PARALLEL_LEVEL: 0
15-
CTEST_NO_TESTS_ACTION: error
1619
workflow_dispatch:
1720

1821
# avoid wasted runs
1922
concurrency:
2023
group: ${{ github.workflow }}-${{ github.ref }}
2124
cancel-in-progress: true
2225

26+
2327
jobs:
2428

2529
msys2:
@@ -41,33 +45,25 @@ jobs:
4145
- name: prefix path
4246
run: |
4347
echo "CMAKE_INSTALL_PREFIX=$HOME/libs" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
44-
echo "CMAKE_PREFIX_PATH=$HOME/libs" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
45-
46-
- uses: actions/checkout@v4
48+
echo "nc4fortran_ROOT=$HOME/libs" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
49+
echo "CMAKE_PREFIX_PATH=${{ steps.msys2.outputs.msys2-location }}/ucrt64/" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
4750
48-
# undefined reference to `ncpsharedlibfree'
49-
# - name: Debug workflow
50-
# run: cmake --workflow debug
51+
- uses: actions/checkout@v6
5152

52-
- name: config
53-
run: cmake -G "MinGW Makefiles" --preset default
54-
env:
55-
HDF5_ROOT: ${{ steps.msys2.outputs.msys2-location }}/ucrt64/
56-
NetCDF_ROOT: ${{ steps.msys2.outputs.msys2-location }}/ucrt64/
53+
- name: CMake workflow
54+
run: cmake --workflow default
5755

58-
- name: build
59-
run: cmake --build --preset default
60-
61-
- name: test
62-
run: ctest --preset default
56+
- name: Upload log failure
57+
if: failure()
58+
uses: actions/upload-artifact@v7
59+
with:
60+
archive: false
61+
name: ${{ runner.os }}-CMakeConfigureLog.yaml
62+
path: build/CMakeFiles/CMakeConfigureLog.yaml
6363

64-
# - run: cmake --install build
64+
- name: install package
65+
run: cmake --install build
6566

66-
# NetCDF-C packaging issue with HDF5--ignores CMAKE_MODULE_PATH and uses broken factory FindHDF5
67-
# and can't seem to override
68-
# - name: configure examples
69-
# run: cmake -S example -B example/build
70-
# - name: build Examples
71-
# run: cmake --build example/build
72-
# - name: Test Examples
73-
# run: ctest --test-dir example/build -V
67+
- name: example workflow
68+
working-directory: example
69+
run: cmake --workflow default

.github/workflows/oneapi-linux.yml

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,29 @@ name: oneapi-linux
22

33
env:
44
CC: icx
5+
CXX: icpx
56
FC: ifx
67
# https://github.com/oneapi-src/oneapi-ci/blob/master/.github/workflows/build_all.yml
7-
CTEST_NO_TESTS_ACTION: error
8-
CMAKE_BUILD_PARALLEL_LEVEL: 4
9-
CTEST_PARALLEL_LEVEL: 0
8+
CMAKE_GENERATOR: Ninja
109
CMAKE_INSTALL_PREFIX: ~/libs
1110
CMAKE_PREFIX_PATH: ~/libs
1211

1312
on:
1413
push:
1514
paths:
15+
- "**.c"
16+
- "**.h"
17+
- "**.cpp"
1618
- "**.f90"
1719
- "**.F90"
1820
- "**.cmake"
1921
- "**/CMakeLists.txt"
2022
- ".github/workflows/oneapi-linux.yml"
23+
- ".github/workflows/oneapi*.sh"
2124
- "!scripts/**"
25+
- "!memcheck.cmake"
26+
- "!coverage.cmake"
27+
- "!example/*"
2228
workflow_dispatch:
2329

2430
# avoid wasted runs
@@ -34,43 +40,45 @@ jobs:
3440
timeout-minutes: 10
3541

3642
steps:
37-
- uses: actions/checkout@v4
43+
- uses: actions/checkout@v6
3844

3945
- name: cache install oneAPI
4046
id: cache-install
41-
uses: actions/cache@v4
47+
uses: actions/cache@v5
4248
with:
4349
path: |
4450
/opt/intel/oneapi
45-
key: install-oneapi-compiler
51+
key: oneapi-apt
4652

4753
- name: non-cache install oneAPI
4854
if: steps.cache-install.outputs.cache-hit != 'true'
4955
timeout-minutes: 5
5056
run: |
5157
.github/workflows/oneapi_setup_apt_repo_linux.sh
52-
sudo apt install intel-oneapi-compiler-dpcpp-cpp intel-oneapi-compiler-fortran
58+
sudo apt install --no-install-recommends intel-oneapi-compiler-dpcpp-cpp intel-oneapi-compiler-fortran
5359
5460
- name: Setup Intel oneAPI environment
5561
run: |
5662
source /opt/intel/oneapi/setvars.sh
5763
printenv >> $GITHUB_ENV
5864
59-
- name: Configure nc4fortran
65+
- name: CMake workflow
6066
run: cmake --workflow default
6167

62-
- name: print config log
63-
if: ${{ failure() }}
64-
run: cat build/CMakeFiles/CMakeConfigureLog.yaml
68+
- name: Upload log failure
69+
if: failure()
70+
uses: actions/upload-artifact@v7
71+
with:
72+
archive: false
73+
name: oneapi-${{ runner.os }}-CMakeConfigureLog.yaml
74+
path: build/CMakeFiles/CMakeConfigureLog.yaml
6575

6676
- name: install package
6777
run: cmake --install build
6878

69-
- name: configure examples
70-
run: >-
71-
cmake
72-
-S example
73-
-B example/build
79+
- name: example workflow
80+
working-directory: example
81+
run: cmake --workflow default
7482

7583
# BUILD_SHARED_LIBS=false since as with any C++ / Fortran program with Intel compiler,
7684
# need to have GCC environment carefully set
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
#!/bin/bash
2+
# This script sets up the Intel oneAPI apt repository on a Linux system.
3+
# https://www.intel.com/content/www/us/en/docs/oneapi/installation-guide-linux/2025-1/base-apt.html#BASE-APT
24

3-
# SPDX-FileCopyrightText: 2020 Intel Corporation
4-
#
5-
# SPDX-License-Identifier: MIT
5+
curl -sS -L https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \
6+
| gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null
67

7-
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
8-
sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
9-
echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
8+
echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
109
sudo apt-get update -o Dir::Etc::sourcelist="sources.list.d/oneAPI.list" -o APT::Get::List-Cleanup="0"

0 commit comments

Comments
 (0)