Skip to content

Add support for macOS #149

Add support for macOS

Add support for macOS #149

Workflow file for this run

name: CI
on:
push:
branches: [main]
release:
types: [published]
branches: [main]
pull_request:
workflow_dispatch:
jobs:
qa:
name: Run pre-commit hooks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pre-commit/[email protected]
build:
name: Build and test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# - platform: linux
# os: ubuntu-22.04
# compiler: gcc-default
# is_main: true
# - platform: linux
# os: ubuntu-22.04
# compiler: gcc-latest
# is_main: false
# - platform: linux
# os: ubuntu-22.04
# compiler: clang
# is_main: false
# - platform: windows
# os: windows-2022
# compiler: msvc
# is_main: true
- platform: macos-x86
os: macos-12
compiler: gcc
is_main: true
- platform: macos-arm
os: macos-12
compiler: gcc
is_main: true
env:
VCPKG_ROOT: "vcpkg"
VCPKG_BINARY_SOURCES: "clear;nuget,GitHub,readwrite"
# Update when there is a new version of gcc available
LATEST_GCC_VERSION: 13
steps:
- uses: actions/checkout@v3
- name: Set up MSVC (Windows)
if: matrix.platform == 'windows'
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
- name: Install dependencies (Linux)
if: matrix.platform == 'linux'
run: |
sudo apt update
sudo apt upgrade -y
sudo apt install --no-install-recommends build-essential ninja-build doxygen graphviz
- name: Install latest gcc (Linux)
if: matrix.compiler == 'gcc-latest'
run: |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install g++-$LATEST_GCC_VERSION
# Use environment variable to tell CMake to compile with this version of gcc
echo CXX=g++-$LATEST_GCC_VERSION >> "$GITHUB_ENV"
- name: Install clang (Linux)
if: matrix.platform == 'linux' && matrix.compiler == 'clang'
run: |
sudo apt install --no-install-recommends clang
# Use environment variable to tell CMake to compile with clang
echo CXX=clang++ >> "$GITHUB_ENV"
- name: Install dependencies (macOS)
if: startsWith(matrix.platform, 'macos')
run: |
export HOMEBREW_NO_INSTALL_CLEANUP=1
brew install ninja
which ninja
# Build using gcc as Apple clang doesn't support parallel algorithms
echo CXX=g++-12 >> "$GITHUB_ENV"
- name: Install VCPKG
run: |
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.sh -disableMetrics
# - uses: ammaraskar/gcc-problem-matcher@master
- name: Build HealthGPS (debug)
run: |
cmake --preset=${{ matrix.platform }}-debug -DWARNINGS_AS_ERRORS=ON -DCMAKE_MAKE_PROGRAM=`which ninja` -DCMAKE_CXX_COMPILER=`which g++-12`|| cat /Users/runner/work/healthgps/healthgps/out/build/macos-x86-debug/vcpkg-manifest-install.log
cmake --build --preset=debug-build-${{ matrix.platform }} --target=install
# - name: Build HealthGPS (release)
# if: "!cancelled()" # Run this step, even if the previous one fails
# run: |
# cmake --preset=${{ matrix.platform }}-release -DWARNINGS_AS_ERRORS=ON
# cmake --build --preset=release-build-${{ matrix.platform }} --target=install
- name: Upload artifacts
if: matrix.is_main
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/') && matrix.is_main
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/') && matrix.is_main
uses: softprops/action-gh-release@v1
with:
files: artifact/health_gps_${{ matrix.platform }}.zip
- name: Doxygen release API deploy
if: matrix.compiler == 'gcc-default' && startsWith(github.ref, 'refs/tags/')
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ${{github.workspace}}/out/build/linux-release/src/html
destination_dir: html
enable_jekyll: true
commit_message: ${{ github.ref_name }} - ${{ github.event.head_commit.message }}