Skip to content

retake work on fabko #28

retake work on fabko

retake work on fabko #28

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 Linux"
on:
pull_request:
push:
jobs:
build:
name: ${{ matrix.os }}-${{ github.workflow }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
include:
- os: ubuntu-latest
triplet: x64-linux
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
# Unix specifics
- name: Set up GCC / Clang tools
run: |
echo g++ --version && g++ --version
sudo apt-get install build-essential clang clang-tools
sudo apt -y install g++-12
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 10
sudo update-alternatives --config g++
echo g++ --version && g++ --version
- 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
- name: Clang-Tidy
run: |
run-clang-tidy -p ${{ github.workspace }}/build/.cmake/x64-Debug-Linux -checks='-*,modernize-use-override' || echo ignore
- name: Clang-Format
run: |
find fabko -regex '.*\.\(cpp\|hpp\|cc\|cxx\)' | xargs clang-format --dry-run -style=file -i
- name: Build
run: |
cmake --build --preset x64-Debug-Linux
- name: Test
run: |
ctest --preset x64-Debug-Linux