@@ -23,43 +23,30 @@ jobs:
2323 build_type : [Release]
2424 c_compiler : [gcc, clang, cl]
2525 include :
26- # Windows MSVC (latest)
2726 - os : windows-latest
2827 c_compiler : cl
2928 cpp_compiler : cl
30-
31- # Windows MSVC (2022)
3229 - os : windows-2022
3330 c_compiler : cl
3431 cpp_compiler : cl
35-
36- # Windows MinGW (latest)
3732 - os : windows-latest
3833 c_compiler : gcc
3934 cpp_compiler : g++
40-
41- # Windows MinGW (2022)
4235 - os : windows-2022
4336 c_compiler : gcc
4437 cpp_compiler : g++
45-
46- # Ubuntu GCC
4738 - os : ubuntu-22.04
4839 c_compiler : gcc
4940 cpp_compiler : g++
5041 - os : ubuntu-24.04
5142 c_compiler : gcc
5243 cpp_compiler : g++
53-
54- # Ubuntu Clang
5544 - os : ubuntu-22.04
5645 c_compiler : clang
5746 cpp_compiler : clang++
5847 - os : ubuntu-24.04
5948 c_compiler : clang
6049 cpp_compiler : clang++
61-
62- # macOS
6350 - os : macos-latest
6451 c_compiler : clang
6552 cpp_compiler : clang++
8168 steps :
8269 - uses : actions/checkout@v4
8370
84- # ------------------------
71+ # ---------------------------------------------------------
72+ # CACHE: APT (Ubuntu)
73+ # ---------------------------------------------------------
74+ - name : Cache APT packages
75+ if : startsWith(matrix.os, 'ubuntu')
76+ uses : actions/cache@v4
77+ with :
78+ path : /var/cache/apt
79+ key : apt-${{ matrix.os }}-${{ hashFiles('**/CMakeLists.txt') }}
80+ restore-keys : apt-${{ matrix.os }}-
81+
82+ # ---------------------------------------------------------
83+ # CACHE: Homebrew (macOS)
84+ # ---------------------------------------------------------
85+ - name : Cache Homebrew
86+ if : matrix.os == 'macos-latest'
87+ uses : actions/cache@v4
88+ with :
89+ path : |
90+ ~/Library/Caches/Homebrew
91+ /usr/local/Homebrew
92+ /opt/homebrew
93+ key : brew-${{ matrix.os }}-${{ hashFiles('**/CMakeLists.txt') }}
94+ restore-keys : brew-${{ matrix.os }}-
95+
96+ # ---------------------------------------------------------
97+ # CACHE: vcpkg (Windows MSVC)
98+ # ---------------------------------------------------------
99+ - name : Cache vcpkg
100+ if : (matrix.os == 'windows-latest' || matrix.os == 'windows-2022') && matrix.c_compiler == 'cl'
101+ uses : actions/cache@v4
102+ with :
103+ path : C:/vcpkg
104+ key : vcpkg-${{ matrix.os }}-${{ hashFiles('**/CMakeLists.txt') }}
105+ restore-keys : vcpkg-${{ matrix.os }}-
106+
107+ # ---------------------------------------------------------
108+ # CACHE: CMake build directory
109+ # ---------------------------------------------------------
110+ - name : Cache CMake build
111+ uses : actions/cache@v4
112+ with :
113+ path : build
114+ key : cmake-${{ matrix.os }}-${{ matrix.c_compiler }}-${{ hashFiles('**/*.cpp', '**/*.h', '**/CMakeLists.txt') }}
115+ restore-keys : |
116+ cmake-${{ matrix.os }}-${{ matrix.c_compiler }}-
117+
118+ # ---------------------------------------------------------
85119 # Install dependencies
86- # ------------------------
120+ # ---------------------------------------------------------
87121 - name : Install OpenMP + HDF5 (Ubuntu)
88122 if : startsWith(matrix.os, 'ubuntu')
89123 run : |
@@ -108,22 +142,23 @@ jobs:
108142 if : (matrix.os == 'windows-latest' || matrix.os == 'windows-2022') && matrix.c_compiler == 'cl'
109143 shell : powershell
110144 run : |
111- git clone https://github.com/microsoft/vcpkg.git C:/vcpkg
112- C:/vcpkg/bootstrap-vcpkg.bat
145+ if (!(Test-Path "C:/vcpkg")) {
146+ git clone https://github.com/microsoft/vcpkg.git C:/vcpkg
147+ C:/vcpkg/bootstrap-vcpkg.bat
148+ }
113149 C:/vcpkg/vcpkg install hdf5[hl]:x64-windows
114150
115- # ------------------------
151+ # ---------------------------------------------------------
116152 # Set build directory
117- # ------------------------
153+ # ---------------------------------------------------------
118154 - name : Set reusable strings
119155 id : strings
120156 shell : bash
121- run : |
122- echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
157+ run : echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
123158
124- # ------------------------
159+ # ---------------------------------------------------------
125160 # Configure CMake
126- # ------------------------
161+ # ---------------------------------------------------------
127162 - name : Configure CMake (macOS)
128163 if : matrix.os == 'macos-latest'
129164 run : >
@@ -163,24 +198,24 @@ jobs:
163198 -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
164199 -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
165200
166- # ------------------------
201+ # ---------------------------------------------------------
167202 # Build
168- # ------------------------
203+ # ---------------------------------------------------------
169204 - name : Build
170205 run : cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}
171206
172- # ------------------------
207+ # ---------------------------------------------------------
173208 # Test
174- # ------------------------
209+ # ---------------------------------------------------------
175210 - name : Test
176211 working-directory : ${{ steps.strings.outputs.build-output-dir }}
177212 run : ctest --output-on-failure --build-config ${{ matrix.build_type }}
178213
179- # ------------------------
214+ # ---------------------------------------------------------
180215 # Upload artifacts
181- # ------------------------
216+ # ---------------------------------------------------------
182217 - name : Upload binaries
183218 uses : actions/upload-artifact@v4
184219 with :
185220 name : next-${{ matrix.os }}-${{ matrix.c_compiler }}
186- path : ${{ github.workspace }}/next*
221+ path : ${{ github.workspace }}/next*
0 commit comments