Skip to content

Commit

Permalink
ci: Refactor and reformat configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
oboukli committed Mar 29, 2024
1 parent 8397b72 commit b3250ab
Showing 1 changed file with 26 additions and 17 deletions.
43 changes: 26 additions & 17 deletions .github/workflows/building-and-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ on:
- main

env:
build_dir: ${{ github.workspace }}/build
config: Debug
BUILD_DIR: ${{ github.workspace }}/build
CONFIG: Debug

permissions: {}

jobs:
windows_vcpp:
name: Build and test on Windows with VC++
env:
cmake_configure_preset_name: x64-debug
cmake_build_preset_name: windows-x64-debug
CMAKE_CONFIGURE_PRESET_NAME: x64-debug
CMAKE_BUILD_PRESET_NAME: windows-x64-debug
runs-on: windows-2022

steps:
Expand Down Expand Up @@ -47,33 +47,38 @@ jobs:
${{ github.workspace }}\vcpkg
key: >-
${{ runner.os }}-vcpkg-archives-cache-${{ hashFiles(
'vcpkg\ports\catch2\vcpkg.json',
'vcpkg\ports\fmt\vcpkg.json',
'vcpkg\ports\nameof\vcpkg.json',
'vcpkg\ports\nanobench\vcpkg.json'
'vcpkg\ports\catch2\vcpkg.json',
'vcpkg\ports\fmt\vcpkg.json',
'vcpkg\ports\nameof\vcpkg.json',
'vcpkg\ports\nanobench\vcpkg.json'
) }}
- name: Configure CMake
run: cmake --preset "${{ env.cmake_configure_preset_name }}"
run: >-
cmake
--preset "${{ env.CMAKE_CONFIGURE_PRESET_NAME }}"
- name: Build
run: cmake --build --preset "${{ env.cmake_build_preset_name }}"
run: >-
cmake
--build
--preset "${{ env.CMAKE_BUILD_PRESET_NAME }}"
- name: Run tests
run: >-
.\tests.exe
--reporter console::out=-::colour-mode=ansi
--rng-seed 1654047489
--success
working-directory: ${{github.workspace}}\out\build\${{ env.cmake_configure_preset_name }}\${{ env.config }}
working-directory: ${{ github.workspace }}\out\build\${{ env.CMAKE_CONFIGURE_PRESET_NAME }}\${{ env.CONFIG }}

- name: Run benchmarks
run: >-
.\benchmark.exe
--rng-seed 1654047489
--durations yes
--reporter console::out=-::colour-mode=ansi
working-directory: ${{github.workspace}}\out\build\${{ env.cmake_configure_preset_name }}\${{ env.config }}
working-directory: ${{ github.workspace }}\out\build\${{ env.CMAKE_CONFIGURE_PRESET_NAME }}\${{ env.CONFIG }}

linux:
name: Build and test on Ubuntu
Expand Down Expand Up @@ -112,25 +117,29 @@ jobs:
- name: Configure CMake
run: >-
cmake -B "${{ env.build_dir }}"
cmake
-B "${{ env.BUILD_DIR }}"
-DBUILD_SHARED_LIBS=TRUE
-DCMAKE_BUILD_TYPE="${{ env.config }}"
-DCMAKE_BUILD_TYPE="${{ env.CONFIG }}"
- name: Build
run: cmake --build "${{ env.build_dir }}" --config "${{ env.config }}"
run: >-
cmake
--build "${{ env.BUILD_DIR }}"
--config "${{ env.CONFIG }}"
- name: Run tests
run: >-
./tests
--reporter console::out=-::colour-mode=ansi
--rng-seed 1654047489
--success
working-directory: ${{ env.build_dir }}
working-directory: ${{ env.BUILD_DIR }}

- name: Run benchmarks
run: >-
./benchmark
--rng-seed 1654047489
--durations yes
--reporter console::out=-::colour-mode=ansi
working-directory: ${{ env.build_dir }}
working-directory: ${{ env.BUILD_DIR }}

0 comments on commit b3250ab

Please sign in to comment.