chore(deps): update commitlint monorepo to v19.5.0 #568
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright (c) 2021-2022-2023 Luca Cappa | |
# Released under the term specified in file LICENSE.txt | |
# SPDX short identifier: MIT | |
# A "pure" GitHub workflow using CMake, Ninja and vcpkg to build a C/C++ codebase. | |
# It leverages both CMakePresets.json and vcpkg.json. | |
# It is called "pure workflow" because it is an example which minimizes the usage of | |
# custom GitHub Actions, but leverages directly the tools that could be easily run on | |
# your development machines (i.e. CMake, vcpkg, Ninja) to ensure a perfectly identical | |
# and reproducible local build (on your development machine) and a remote build on | |
# build agents. | |
name: Quality | |
on: | |
pull_request: | |
branches: | |
- main | |
- development | |
push: | |
branches: | |
- main | |
- development | |
workflow_dispatch: | |
inputs: | |
debug: | |
description: 'Set to true to enable debug mode' | |
required: false | |
default: 'false' | |
jobs: | |
build-ubuntu-macos: | |
name: Build ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ ubuntu-latest, macos-latest ] | |
include: | |
- os: ubuntu-latest | |
triplet: x64-linux | |
- os: macos-latest | |
triplet: x64-osx | |
env: | |
# Indicates the location of the vcpkg as a Git submodule of the project repository. | |
VCPKG_ROOT: ${{ github.workspace }}/deps/vcpkg | |
# Tells vcpkg where binary packages are stored. | |
VCPKG_DEFAULT_BINARY_CACHE: ${{ github.workspace }}/deps/vcpkg/bincache | |
# Let's use GitHub Action cache as storage for the vcpkg Binary Caching feature. | |
VCPKG_BINARY_SOURCES: 'clear;x-gha,readwrite' | |
steps: | |
# First free up some disk space to prevent running out of disk space. | |
- name: Free up disk space | |
shell: bash | |
run: | | |
if [[ "${{ matrix.os }}" == "ubuntu-latest" || "${{ matrix.os }}" == "macos-latest" ]]; then | |
sudo rm -rf /usr/local/share/boost /usr/share/dotnet /usr/local/lib/android /opt/ghc | |
df -h | |
fi | |
- name: Install dependencies (Ubuntu) | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
uses: awalsh128/cache-apt-pkgs-action@latest | |
with: | |
packages: libxi-dev libxmu-dev libxmu-headers libx11-dev mesa-common-dev libglu1-mesa-dev libfontconfig1-dev libfreetype6 libfreetype6-dev tcl tcl-dev tk tk-dev | |
version: 1.0 | |
# Set env vars needed for vcpkg to leverage the GitHub Action cache as a storage | |
# for Binary Caching. | |
- uses: actions/github-script@v7 | |
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@v4 | |
with: | |
submodules: true | |
########################################################################## | |
# Workaround for: | |
# - https://github.com/microsoft/vcpkg/issues/35332 | |
# - https://github.com/microsoft/vcpkg/pull/35348 | |
# | |
- name: Set up Python | |
if: ${{ matrix.os == 'macos-latest' }} | |
# This is the version of the action for setting up Python, not the Python version. | |
uses: actions/setup-python@v5 | |
with: | |
# Semantic version range syntax or exact version of a Python version | |
python-version: '3.11' | |
# Optional - x64 or x86 architecture, defaults to x64 | |
architecture: 'x64' | |
# You can test your matrix by printing the current Python version | |
- name: Display Python version | |
if: ${{ matrix.os == 'macos-latest' || matrix.os == 'windows-latest' }} | |
run: python -c "import sys; print(sys.version)" | |
# | |
########################################################################## | |
# Create the directory to store the vcpkg's binary cache. | |
- name: "Create directory '${{ env.VCPKG_DEFAULT_BINARY_CACHE }}'" | |
run: mkdir -p $VCPKG_DEFAULT_BINARY_CACHE | |
shell: bash | |
# Set up the build machine with the most recent versions of CMake and Ninja. Both are cached if not already: on subsequent runs both will be quickly restored from GitHub cache service. | |
- uses: lukka/get-cmake@latest | |
- name: List $RUNNER_WORKSPACE before vcpkg is setup | |
run: find $RUNNER_WORKSPACE | |
if: ${{ inputs.debug == 'true' }} | |
shell: bash | |
- name: Setup vcpkg | |
uses: lukka/run-vcpkg@v11 | |
id: runvcpkg | |
with: | |
vcpkgDirectory: '${{ env.VCPKG_ROOT }}' | |
vcpkgJsonGlob: '${{ github.workspace }}/vcpkg.json' | |
vcpkgConfigurationJsonGlob: '${{ github.workspace }}/vcpkg-configuration.json' | |
- name: List $RUNNER_WORKSPACE before build | |
run: find $RUNNER_WORKSPACE | |
if: ${{ inputs.debug == 'true' }} | |
shell: bash | |
- name: Prints output of run-vcpkg's action. | |
if: ${{ inputs.debug == 'true' }} | |
run: echo "root='${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_ROOT_OUT }}', triplet='${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_DEFAULT_TRIPLET_OUT }}' " | |
- name: Run CMake+vcpkg+Ninja | |
uses: lukka/run-cmake@v10 | |
id: runcmake | |
with: | |
cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt' | |
configurePreset: 'occutils-ninja-multiconfiguration-vcpkg' | |
buildPreset: 'occutils-ninja-multiconfiguration-vcpkg' | |
buildPresetAdditionalArgs: "['--config Release']" | |
# testPreset: 'occutils-ninja-multiconfiguration-vcpkg' # currently broken | |
# testPresetAdditionalArgs: "['--config Release']" # currently broken | |
# Test the whole project with CTest, again Release configuration only. | |
- name: Test (Release configuration) | |
shell: bash | |
run: | | |
ctest -C Release --preset occutils-ninja-multiconfiguration-vcpkg | |
- name: List $RUNNER_WORKSPACE after build | |
run: find $RUNNER_WORKSPACE | |
if: ${{ inputs.debug == 'true' }} | |
shell: bash | |
# Upload vcpkg's logs as artifacts. | |
- name: Upload vcpkg build log files | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: vcpkg-log-files-${{ matrix.os }} | |
path: deps/vcpkg/buildtrees/**/*.log | |
# Upload builds logs as artifacts. | |
- name: Upload builds log files | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: builds-log-files-${{ matrix.os }} | |
path: builds/**/*.log | |
build-windows: | |
if: false # Disable windows workflow for now, because 7zip permissions is restricted when cloning to C:\ drive because of limited disk space. | |
name: Build windows-latest | |
runs-on: windows-latest | |
env: | |
# Indicates the location of the vcpkg as a Git submodule of the project repository. | |
VCPKG_ROOT: C:/occutils/deps/vcpkg | |
# Tells vcpkg where binary packages are stored. | |
VCPKG_DEFAULT_BINARY_CACHE: C:/occutils/deps/vcpkg/bincache | |
# Let's use GitHub Action cache as storage for the vcpkg Binary Caching feature. | |
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@v7 | |
with: | |
script: | | |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); | |
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); | |
- name: Checkout Repository | |
shell: bash | |
run: | | |
git clone --no-single-branch "https://github.com/${{ github.repository }}" C:/occutils | |
cd C:/occutils | |
if [[ $GITHUB_REF == refs/pull/* ]]; then | |
# If it's a pull request, checkout the PR's merge reference | |
git fetch origin $GITHUB_REF | |
git checkout -qf FETCH_HEAD | |
else | |
# Otherwise, checkout the branch normally | |
BRANCH_NAME=${GITHUB_REF#refs/heads/} | |
echo "Branch name: $BRANCH_NAME" | |
git checkout $BRANCH_NAME | |
fi | |
git submodule update --init --recursive | |
# Create the directory to store the vcpkg's binary cache. | |
- name: "Create directory '${{ env.VCPKG_DEFAULT_BINARY_CACHE }}'" | |
run: mkdir -p $VCPKG_DEFAULT_BINARY_CACHE | |
shell: bash | |
# Set up the build machine with the most recent versions of CMake and Ninja. Both are cached if not already: on subsequent runs both will be quickly restored from GitHub cache service. | |
- uses: lukka/get-cmake@latest | |
- name: List $RUNNER_WORKSPACE before vcpkg is setup | |
run: find $RUNNER_WORKSPACE | |
if: ${{ inputs.debug == 'true' }} | |
shell: bash | |
- name: Setup vcpkg | |
uses: lukka/run-vcpkg@v11 | |
id: runvcpkg | |
with: | |
vcpkgDirectory: '${{ env.VCPKG_ROOT }}' | |
vcpkgJsonGlob: 'C:/occutils/vcpkg.json' | |
vcpkgConfigurationJsonGlob: 'C:/occutils/vcpkg-configuration.json' | |
- name: List $RUNNER_WORKSPACE before build | |
run: find $RUNNER_WORKSPACE | |
if: ${{ inputs.debug == 'true' }} | |
shell: bash | |
- name: Prints output of run-vcpkg's action. | |
if: ${{ inputs.debug == 'true' }} | |
run: echo "root='${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_ROOT_OUT }}', triplet='${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_DEFAULT_TRIPLET_OUT }}' " | |
- name: Run CMake+vcpkg+Ninja | |
uses: lukka/run-cmake@v10 | |
id: runcmake | |
with: | |
cmakeListsTxtPath: 'C:/occutils/CMakeLists.txt' | |
configurePreset: 'occutils-ninja-multiconfiguration-vcpkg' | |
buildPreset: 'occutils-ninja-multiconfiguration-vcpkg' | |
buildPresetAdditionalArgs: "['--config Release']" | |
# testPreset: 'occutils-ninja-multiconfiguration-vcpkg' # currently broken | |
# testPresetAdditionalArgs: "['--config Release']" # currently broken | |
timeout-minutes: 240 # Set timeout to 4 hours | |
# Test the whole project with CTest, again Release configuration only. | |
- name: Test (Release configuration) | |
shell: bash | |
run: | | |
ctest -C Release --preset occutils-ninja-multiconfiguration-vcpkg | |
- name: List $RUNNER_WORKSPACE after build | |
run: find $RUNNER_WORKSPACE | |
if: ${{ inputs.debug == 'true' }} | |
shell: bash | |
# Upload vcpkg's logs as artifacts. | |
- name: Upload vcpkg build log files | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: vcpkg-log-files-windows-latest | |
path: C:/occutils/deps/vcpkg/buildtrees/**/*.log | |
# Upload builds logs as artifacts. | |
- name: Upload builds log files | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: builds-log-files-windows-latest | |
path: C:/occutils/builds/**/*.log |