Skip to content

list -> static_list #1297

list -> static_list

list -> static_list #1297

Workflow file for this run

# Seeded from https://github.com/lukka/CppCMakeVcpkgTemplate
# Thank you Lucas Beyer for the template!
name: CI
env:
BUILD_TYPE: Debug Release
on: [push, pull_request, workflow_dispatch]
jobs:
job:
name: ${{ matrix.os }}-${{ matrix.compiler }}-${{ matrix.linkage }}-${{ matrix.config }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
config: [dbg, rel]
linkage: [static, shared]
include:
# - os: windows-latest
# triplet: x64-windows
# - os: ubuntu-latest
# triplet: x64-linux
# - os: ubuntu-latest
# triplet: i686-linux
# - os: macos-latest
# triplet: x64-osx
- os: windows-latest
config: dbg
linkage: shared
add_shared_path: $env:PATH += ";" + (Get-Item .).FullName + "\builds\ninja-cl-shared\src\Debug"
- os: windows-latest
config: rel
add_shared_path: $env:PATH += ";" + (Get-Item .).FullName + "\builds\ninja-cl-shared\src\Release"
- os: ubuntu-latest
gcc12: true
compiler: g++-12
- os: ubuntu-latest
clang18: true
compiler: clang++-18
pre_configure: dev/ci-pre-configure-clang 18
- os: macos-latest
compiler: c++
- os: windows-latest
compiler: cl
env:
# Indicates the location of the vcpkg as a Git submodule of the project
# repository. Not using "VCPKG_ROOT" because a variable with the same name
# is defined in the VS's Developer Command Prompt environment in VS 2022
# 17.6, which would override this one if it had the same name.
# ^^^ JLL: macos needs VCPKG_ROOT.
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
_VCPKG_: ${{ github.workspace }}/vcpkg
# Tells vcpkg where binary packages are stored.
VCPKG_DEFAULT_BINARY_CACHE: ${{ github.workspace }}/vcpkg/bincache
# Let's use GitHub Action cache as storage for the vcpkg Binary Caching feature.
VCPKG_BINARY_SOURCES: 'clear;x-gha,readwrite'
CXX: ${{ matrix.compiler }}
steps:
# - name: List compilers
# run: |
# apt list --installed | grep clang
# apt list --installed | grep g++
# 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
- name: "Create directory '${{ env.VCPKG_DEFAULT_BINARY_CACHE }}'"
run: mkdir -p $VCPKG_DEFAULT_BINARY_CACHE
shell: bash
# Setup 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
# Restore vcpkg from the GitHub Action cache service. Note that packages
# are restored by vcpkg's binary caching when it is being run afterwards
# by CMake.
- name: Restore vcpkg
uses: actions/cache@v4
with:
# The first path is the location of vcpkg: it contains the vcpkg
# executable and data files, as long as the built package archives
# (aka binary cache) which are located by VCPKG_DEFAULT_BINARY_CACHE
# env var. The other paths starting with '!' are exclusions: they
# contain termporary files generated during the build of the installed
# packages.
path: |
${{ env._VCPKG_ }}
!${{ env._VCPKG_ }}/buildtrees
!${{ env._VCPKG_ }}/packages
!${{ env._VCPKG_ }}/downloads
!${{ env._VCPKG_ }}/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' )}}
# On Windows runners, let's ensure to have the Developer Command Prompt
# environment setup correctly. As used here the Developer Command Prompt
# created is targeting x64 and using the default the Windows SDK.
- uses: ilammy/msvc-dev-cmd@v1
# Run CMake to generate Ninja project files, using the vcpkg's toolchain
# file to resolve and install the dependencies as specified in vcpkg.json.
# Note that the vcpkg's 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: |
${{ matrix.pre_configure }}
cmake --preset ninja-${{ matrix.compiler }}-${{ matrix.linkage }} -DCMAKE_CXX_COMPILER=${{ matrix.compiler }}
- name: Build
run: |
${{ matrix.add_shared_path }}
cmake --build --preset build-ninja-${{ matrix.compiler }}-${{ matrix.linkage}}-${{ matrix.config }}
- name: Test
run: |
${{ matrix.add_shared_path }}
ctest --preset test-ninja-${{ matrix.compiler }}-${{ matrix.linkage}}-${{ matrix.config }} --output-on-failure