|
2 | 2 | # SPDX-License-Identifier: Apache-2.0 |
3 | 3 |
|
4 | 4 | name: Build and Test |
| 5 | +permissions: read-all |
5 | 6 | on: |
6 | 7 | # By default this will run when the activity type is "opened", "synchronize", |
7 | 8 | # or "reopened". |
|
24 | 25 | # Define env vars # |
25 | 26 | ################### |
26 | 27 | env: |
27 | | - HEXL_VER: 1.2.5 |
| 28 | + HEXL_VER: 1.2.6 |
28 | 29 | HEXL_DIR: ${GITHUB_WORKSPACE}/lib/cmake/hexl-${HEXL_VER} |
29 | 30 | HEXL_HINT_DIR: > |
30 | 31 | -DHEXL_HINT_DIR=${GITHUB_WORKSPACE}/lib/cmake/hexl-${HEXL_VER} |
31 | 32 | COVERAGE_COMPILER_FLAGS: > |
32 | 33 | -DCMAKE_BUILD_TYPE=Debug |
33 | | - -DCMAKE_CXX_COMPILER=g++-9 |
34 | | - -DCMAKE_C_COMPILER=gcc-9 |
| 34 | + -DCMAKE_CXX_COMPILER=g++-11 |
| 35 | + -DCMAKE_C_COMPILER=gcc-11 |
35 | 36 | -DHEXL_BENCHMARK=ON |
36 | 37 | -DHEXL_TESTING=ON |
37 | 38 | -DHEXL_COVERAGE=ON |
|
42 | 43 | jobs: |
43 | 44 | format: |
44 | 45 | name: Format |
45 | | - runs-on: ubuntu-20.04 |
| 46 | + runs-on: ubuntu-22.04 |
46 | 47 | steps: |
47 | | - - uses: actions/checkout@v2 |
| 48 | + - uses: actions/checkout@v3 |
48 | 49 | # Required for pre-commit |
49 | 50 | - run: pip3 install cpplint==1.5.5 |
50 | 51 | # NOTE: This is deprecated in favor of pre-commit.ci |
51 | | - - uses: pre-commit/action@v2.0.2 |
| 52 | + - uses: pre-commit/action@v3.0.1 |
52 | 53 | with: |
53 | 54 | extra_args: --all-files |
54 | 55 |
|
55 | 56 | nix-build: |
56 | 57 | name: '${{ matrix.os }} ${{ matrix.build_type }} shared=${{ matrix.shared_lib }}' |
57 | 58 | runs-on: '${{ matrix.os }}' |
| 59 | + permissions: |
| 60 | + contents: write # required for actions/upload-artifacts@v2 |
58 | 61 | defaults: |
59 | 62 | run: |
60 | 63 | shell: bash |
61 | 64 | strategy: |
62 | 65 | matrix: |
63 | | - # os: [ice-lake, [self-hosted, ubuntu-18.04], macos-latest, ubuntu-20.04] |
64 | | - os: [ice-lake, macos-latest, ubuntu-20.04] |
| 66 | + # removed platforms not available on github hosted servers. |
| 67 | + os: [ubuntu-22.04] |
65 | 68 | build_type: [Release, Debug] |
66 | 69 | shared_lib: [ON, OFF] |
67 | 70 | include: |
|
70 | 73 | benchmark_min_time: "--benchmark_min_time=0.001" |
71 | 74 | - build_type: Release |
72 | 75 | benchmark_min_time: "" |
73 | | - exclude: # Skip debug on Mac. TODO: add Debug mode |
74 | | - - os: macos-latest |
75 | | - build_type: Debug |
76 | 76 | steps: |
77 | 77 | - uses: actions/checkout@v2 |
78 | 78 | - name: Setup cmake |
|
83 | 83 | run: | |
84 | 84 | set -x |
85 | 85 | if [ "$RUNNER_OS" == "Linux" ]; then |
86 | | - export CC=clang-10 |
87 | | - export CXX=clang++-10 |
| 86 | + export CC=clang-14 |
| 87 | + export CXX=clang++-14 |
88 | 88 | fi |
89 | 89 |
|
90 | 90 | # Print information useful for debugging |
@@ -136,9 +136,9 @@ jobs: |
136 | 136 | # set +x |
137 | 137 |
|
138 | 138 | - name: Archive benchmark results |
139 | | - uses: actions/upload-artifact@v2 |
| 139 | + uses: actions/upload-artifact@v4 |
140 | 140 | with: |
141 | | - name: bench_hexl_${{github.sha}}.csv |
| 141 | + name: bench_hexl_${{github.sha}}_${{github.run_id}}_${{github.job}}_${{matrix.os}}_${{matrix.build_type}}_Shared_${{matrix.shared_lib}} |
142 | 142 | path: ${{ github.workspace }}/${{ github.workflow }}_${{ github.sha }} |
143 | 143 | retention-days: 90 # Maximum for free version |
144 | 144 |
|
@@ -176,142 +176,3 @@ jobs: |
176 | 176 | build/${{ matrix.build_type}}/example.exe |
177 | 177 |
|
178 | 178 | # TODO: add pkgconfig and vcpkg examples |
179 | | -
|
180 | | -
|
181 | | -
|
182 | | - ubuntu-1804-build: |
183 | | - name: '${{ matrix.os }} ${{ matrix.build_type }} shared=${{ matrix.shared_lib }}' |
184 | | - runs-on: '${{ matrix.os }}' |
185 | | - defaults: |
186 | | - run: |
187 | | - shell: bash |
188 | | - strategy: |
189 | | - matrix: |
190 | | - os: [ubuntu-18.04] |
191 | | - build_type: [Release, Debug] |
192 | | - shared_lib: [ON, OFF] |
193 | | - include: |
194 | | - # Run benchmarks quickly in Debug mode |
195 | | - - build_type: Debug |
196 | | - benchmark_min_time: "--benchmark_min_time=0.001" |
197 | | - - build_type: Release |
198 | | - benchmark_min_time: "" |
199 | | - exclude: # Skip debug on Mac. TODO: add Debug mode |
200 | | - - os: macos-latest |
201 | | - build_type: Debug |
202 | | - steps: |
203 | | - - uses: actions/checkout@v2 |
204 | | - - name: Setup cmake |
205 | | - uses: jwlawson/actions-setup-cmake@v1.10 |
206 | | - with: |
207 | | - cmake-version: '3.13.x' |
208 | | - - name: Default build |
209 | | - run: | |
210 | | - set -x |
211 | | - if [ "$RUNNER_OS" == "Linux" ]; then |
212 | | - export CC=gcc |
213 | | - export CXX=g++ |
214 | | - fi |
215 | | -
|
216 | | - # Print information useful for debugging |
217 | | - gcc --version |
218 | | - g++ --version |
219 | | - whoami |
220 | | - echo $HOME |
221 | | - echo $GITHUB_WORKSPACE |
222 | | - echo "Testing from branch:" |
223 | | - echo $GITHUB_REFH |
224 | | - cmake --version |
225 | | - pwd |
226 | | -
|
227 | | - # Build library |
228 | | - cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ |
229 | | - -DHEXL_SHARED_LIB=${{ matrix.shared_lib }} \ |
230 | | - -DCMAKE_INSTALL_PREFIX=./ |
231 | | - cmake --build build -j |
232 | | - cmake --build build --target install |
233 | | - cmake --build build --target unittest |
234 | | - # Instead of calling cmake --build build --target bench, |
235 | | - # we run the executable directly to pass command-line arguments |
236 | | - ./build/benchmark/bench_hexl \ |
237 | | - --benchmark_out="${GITHUB_WORKFLOW}_${GITHUB_SHA}" \ |
238 | | - --benchmark_out_format=csv ${{ matrix.benchmark_min_time }} |
239 | | -
|
240 | | - # Build and run examples |
241 | | - cd $GITHUB_WORKSPACE/example/cmake |
242 | | - cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ |
243 | | - ${{ env.HEXL_HINT_DIR }} |
244 | | - cmake --build build |
245 | | - build/example |
246 | | -
|
247 | | - # Build example using pkgconfig |
248 | | - cd $GITHUB_WORKSPACE/example/pkgconfig |
249 | | - # Set PKG_CONFIG_PATH to locate hexl.pc |
250 | | - export PKG_CONFIG_PATH=$GITHUB_WORKSPACE/lib/pkgconfig |
251 | | - cmake -S . -B build |
252 | | - cmake --build build |
253 | | - build/example |
254 | | -
|
255 | | - # Build example using vcpkg |
256 | | - # TODO: fix vcpkg example CI |
257 | | - # vcpkg install hexl --overlay-ports=$GITHUB_WORKSPACE/port/hexl/ --head |
258 | | - # cd $GITHUB_WORKSPACE/example/vcpkg |
259 | | - # vcpkg_toolchain=$(locate vcpkg.cmake) |
260 | | - # echo $vcpkg_toolchain |
261 | | - # cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE=$vcpkg_toolchain |
262 | | - # cmake --build build |
263 | | - # build/example |
264 | | - # set +x |
265 | | -
|
266 | | - - name: Archive benchmark results |
267 | | - uses: actions/upload-artifact@v2 |
268 | | - with: |
269 | | - name: bench_hexl_${{github.sha}}.csv |
270 | | - path: ${{ github.workspace }}/${{ github.workflow }}_${{ github.sha }} |
271 | | - retention-days: 90 # Maximum for free version |
272 | | - |
273 | | - |
274 | | - |
275 | | - experimental-build: |
276 | | - name: 'experimental: ${{ matrix.os }} ${{ matrix.build_type }} shared=${{ matrix.shared_lib }}' |
277 | | - runs-on: '${{ matrix.os }}' |
278 | | - defaults: |
279 | | - run: |
280 | | - shell: bash |
281 | | - strategy: |
282 | | - matrix: |
283 | | - os: [ice-lake] |
284 | | - build_type: [Release] |
285 | | - shared_lib: [ON] |
286 | | - steps: |
287 | | - - uses: actions/checkout@v2 |
288 | | - - name: Default build |
289 | | - run: | |
290 | | - set -x |
291 | | - if [ "$RUNNER_OS" == "Linux" ]; then |
292 | | - export CC=clang-10 |
293 | | - export CXX=clang++-10 |
294 | | - fi |
295 | | -
|
296 | | - # Print information useful for debugging |
297 | | - whoami |
298 | | - echo $HOME |
299 | | - echo $GITHUB_WORKSPACE |
300 | | - echo "Testing from branch:" |
301 | | - echo $GITHUB_REFH |
302 | | - cmake --version |
303 | | - pwd |
304 | | -
|
305 | | - # Build library |
306 | | - cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ |
307 | | - -DHEXL_SHARED_LIB=${{ matrix.shared_lib }} \ |
308 | | - -DCMAKE_INSTALL_PREFIX=./ \ |
309 | | - -DHEXL_EXPERIMENTAL=ON |
310 | | - cmake --build build -j |
311 | | - cmake --build build --target install |
312 | | - cmake --build build --target unittest |
313 | | - # Instead of calling cmake --build build --target bench, |
314 | | - # we run the executable directly to pass command-line arguments |
315 | | - ./build/benchmark/bench_hexl \ |
316 | | - --benchmark_out="${GITHUB_WORKFLOW}_${GITHUB_SHA}" \ |
317 | | - --benchmark_out_format=csv |
0 commit comments