Skip to content

wanted api

wanted api #31

Workflow file for this run

# https://github.com/marketplace/actions/run-vcpkg#use-vcpkg-as-a-submodule-of-your-repository
# https://github.com/lukka/CppCMakeVcpkgTemplate/blob/v11/.github/workflows/hosted-pure-workflow.yml
name: "Build MacOS"
on:
pull_request:
push:
jobs:
build:
name: ${{ matrix.os }}-${{ github.workflow }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ macos-latest ]
include:
- os: macos-latest
triplet: x64-osx
env:
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
VCPKG_DEFAULT_BINARY_CACHE: ${{ github.workspace }}/vcpkg/bincache
VCPKG_BINARY_SOURCES: 'clear;x-gha,readwrite'
steps:
# Set env vars needed for vcpkg to leverage the GitHub Action cache as a storage
# for Binary Caching.
- uses: actions/github-script@v6
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- uses: actions/checkout@v3
with:
submodules: true
- name: "Create directory '${{ env.VCPKG_DEFAULT_BINARY_CACHE }}'"
run: mkdir -p $VCPKG_DEFAULT_BINARY_CACHE
shell: bash
- name: Set up Clang
uses: egor-tensin/setup-clang@v1
with:
version: latest
platform: x64
- uses: lukka/get-cmake@latest
# Restore vcpkg from the GitHub Action cache service. Note that packages are restored by vcpkg binary caching
# when it is being run afterward by CMake.
- name: Restore vcpkg
uses: actions/cache@v3
with:
path: |
${{ env.VCPKG_ROOT }}
!${{ env.VCPKG_ROOT }}/buildtrees
!${{ env.VCPKG_ROOT }}/packages
!${{ env.VCPKG_ROOT }}/downloads
!${{ env.VCPKG_ROOT }}/installed
# The key is composed in a way that it gets properly invalidated whenever a different version of vcpkg is being used.
key: |
${{ hashFiles( '.git/modules/vcpkg/HEAD' )}}
# Run CMake to generate Ninja project files, using the vcpkg toolchain file to resolve and install
# the dependencies as specified in vcpkg.json. Note that the vcpkg toolchain is specified
# in the CMakePresets.json file.
# This step also runs vcpkg with Binary Caching leveraging GitHub Action cache to
# store the built packages artifacts.
- name: Restore from cache the dependencies and generate project files
run: |
cmake --preset x64-Debug-Linux -D CMAKE_C_COMPILER=clang -D CMAKE_CXX_COMPILER=clang++
- name: Build
run: |
cmake --build --preset x64-Debug-Linux -D CMAKE_C_COMPILER=clang -D CMAKE_CXX_COMPILER=clang++
- name: Test
run: |
ctest --preset x64-Debug-Linux -D CMAKE_C_COMPILER=clang -D CMAKE_CXX_COMPILER=clang++