Skip to content

Commit

Permalink
Merge pull request #117 from imperialCHEPI/consolidate_ci_configs
Browse files Browse the repository at this point in the history
Consolidate Windows and Linux CI config files
  • Loading branch information
alexdewar authored Jun 16, 2023
2 parents 3aaa10a + 8f5c4ec commit d53866c
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 239 deletions.
93 changes: 93 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: CI

on:
push:
branches: [ main ]
release:
types: [published]
branches: [ main ]
pull_request:
workflow_dispatch:

jobs:
build:
name: Build and test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-22.04, windows-2022 ]
include:
- os: ubuntu-22.04
platform: linux
- os: windows-2022
platform: windows

env:
VCPKG_ROOT: 'vcpkg'
VCPKG_BINARY_SOURCES: 'clear;nuget,GitHub,readwrite'

steps:
- uses: actions/checkout@v3

- name: Set up MSVC (Windows)
if: matrix.os == 'windows-2022'
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64

- name: Install dependencies (Linux)
if: matrix.os == 'ubuntu-22.04'
run: |
sudo apt update
sudo apt upgrade -y
sudo apt install --no-install-recommends build-essential libtbb-dev ninja-build doxygen graphviz
- name: Install VCPKG
run: |
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.sh -disableMetrics
- name: Build HealthGPS (debug)
run: |
cmake --preset=${{ matrix.platform }}-debug -DBUILD_BENCHMARKS=ON
cmake --build --preset=debug-build-${{ matrix.platform }} --target=install
- name: Build HealthGPS (release)
run: |
cmake --preset=${{ matrix.platform }}-release -DBUILD_BENCHMARKS=ON
cmake --build --preset=release-build-${{ matrix.platform }} --target=install
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: health-gps-${{ matrix.platform }}
path: |
${{ github.workspace }}/out/install/${{ matrix.platform }}-*/*
- name: Run tests
run: ctest --preset=core-test-${{ matrix.platform }}

- name: Zip output folder
if: startsWith(github.ref, 'refs/tags/')
working-directory: ${{github.workspace}}/out/install/${{ matrix.platform }}-release/bin/
run: |
mkdir ${{github.workspace}}/artifact
7z a -tzip ${{github.workspace}}/artifact/health_gps_${{ matrix.platform }}.zip *.dll *.Console*
- name: Upload release artifacts
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
files: artifact/health_gps_${{ matrix.platform }}.zip

- name: Doxygen release API deploy
if: matrix.platform == 'linux' && startsWith(github.ref, 'refs/tags/')
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ${{github.workspace}}/out/build/${{env.RELEASE_PRESET}}/src/html
destination_dir: html
enable_jekyll: true
commit_message: ${{ github.ref_name }} - ${{ github.event.head_commit.message }}
120 changes: 0 additions & 120 deletions .github/workflows/linux.yml

This file was deleted.

102 changes: 0 additions & 102 deletions .github/workflows/windows.yml

This file was deleted.

25 changes: 12 additions & 13 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@
{
"name": "linux-debug",
"displayName": "Linux Debug",
"description": "Target the Windows Subsystem for Linux (WSL).",
"description": "Build on Linux (debug).",
"inherits": "base",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_CXX_COMPILER": "g++",
"CMAKE_TOOLCHAIN_FILE": {
"value": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
"type": "FILEPATH"
Expand All @@ -32,16 +31,16 @@
{
"name": "linux-release",
"displayName": "Linux Release",
"description": "Sets the Windows build type to release",
"description": "Build on Linux (release).",
"inherits": "linux-debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"name": "x64-debug",
"displayName": "Windows x64 Debug",
"description": "Target Windows with the Visual Studio development environment.",
"name": "windows-debug",
"displayName": "Windows Debug",
"description": "Build on Windows with Visual Studio (debug).",
"inherits": "base",
"architecture": {
"value": "x64",
Expand All @@ -58,10 +57,10 @@
"vendor": { "microsoft.com/VisualStudioSettings/CMake/1.0": { "hostOS": [ "Windows" ] } }
},
{
"name": "x64-release",
"displayName": "Windows x64 Release",
"description": "Sets the Windows build type to release",
"inherits": "x64-debug",
"name": "windows-release",
"displayName": "Windows Release",
"description": "Build on Windows with Visual Studio (release).",
"inherits": "windows-debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
}
Expand All @@ -77,7 +76,7 @@
{
"name": "debug-build-windows",
"displayName": "Default",
"configurePreset": "x64-debug",
"configurePreset": "windows-debug",
"description": "Vanilla build"
},
{
Expand All @@ -89,7 +88,7 @@
{
"name": "release-build-windows",
"displayName": "Release",
"configurePreset": "x64-release",
"configurePreset": "windows-release",
"description": "Windows release build"
}
],
Expand All @@ -105,7 +104,7 @@
{
"name": "core-test-windows",
"inherits": "core-test-linux",
"configurePreset": "x64-debug"
"configurePreset": "windows-debug"
}
]
}
Loading

0 comments on commit d53866c

Please sign in to comment.