Skip to content

STP-12 Use vcpkg with gh actions #102

STP-12 Use vcpkg with gh actions

STP-12 Use vcpkg with gh actions #102

Workflow file for this run

name: CMake
on:
push:
tags:
- v*
branches:
- master
- development
paths-ignore:
- README.md
pull_request:
branches:
- master
- development
env:
vcpkgCommitId: c9919121dde6f61c0436adda94624636e041226b
jobs:
build:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-22.04
compiler:
- { name: Clang 15, cc: /usr/bin/clang-15, cxx: /usr/bin/clang++-15 }
# - { name: GCC 10, cc: /usr/bin/gcc-10, cxx: /usr/bin/g++-10 }
- { name: GCC 11, cc: /usr/bin/gcc-11, cxx: /usr/bin/g++-11 }
- { name: GCC 12, cc: /usr/bin/gcc-12, cxx: /usr/bin/g++-12 }
- { name: GCC 13, cc: /usr/bin/gcc-13, cxx: /usr/bin/g++-13 }
generator:
- "Ninja Multi-Config"
build_type:
- Release
- Debug
include:
- os: windows-2022
compiler: msvc
generator: "Visual Studio 17 2022"
build_type: Debug
- os: windows-2022
compiler: msvc
generator: "Visual Studio 17 2022"
build_type: Release
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: seanmiddleditch/gha-setup-ninja@master
- name: Set CC & CXX env
if: ${{ matrix.os == 'ubuntu-22.04' }}
shell: bash
run: |
${{ matrix.compiler.cc }} --version
${{ matrix.compiler.cxx }} --version
echo "CC=${{ matrix.compiler.cc }}" >> $GITHUB_ENV
echo "CXX=${{ matrix.compiler.cxx }}" >> $GITHUB_ENV
- name: Restore from cache and setup vcpkg executable and data files.
uses: lukka/run-vcpkg@v11
with:
vcpkgJsonGlob: 'vcpkg.json'
vcpkgGitCommitId: '${{ env.vcpkgCommitId }}'
- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -G "${{matrix.generator}}" -DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} -DTEXT_PROCESSING_ENABLE_TESTS=ON -DDEVELOPER_BUILD=ON -DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{matrix.build_type}}
- name: Test
working-directory: ${{github.workspace}}/build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest --output-on-failure -C ${{matrix.build_type}}