Skip to content

Update ci build scripts #69

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
167 changes: 167 additions & 0 deletions .CMakeUserPresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
{
"version": 6,
"cmakeMinimumRequired": {
"major": 3,
"minor": 26,
"patch": 0
},
"configurePresets": [
{
"name": "default-config",
"hidden": true,
"generator": "Ninja",
"cacheVariables": {
"CMAKE_HOST_SYSTEM_PROCESSOR": "$penv{PROCESSOR_ARCHITECTURE}"
}
},
{
"name": "common-config",
"description": "Settings for all toolchains",
"hidden": true,
"inherits": "default-config",
"binaryDir": "${sourceDir}/out/build/${presetName}",
"installDir": "${sourceDir}/out/install/${presetName}",
"cacheVariables": {
"ENABLE_DOXYGEN": false,
"ENABLE_CPPCHECK": false,
"ENABLE_CLANG_TIDY": false
},
"vendor": {
"microsoft.com/VisualStudioRemoteSettings/CMake/1.0": {
"sourceDir": "$env{HOME}/.vs/$ms{projectDirName}"
}
}
},
{
"name": "debug",
"displayName": "Debug",
"description": "Debug build type",
"inherits": "conf-unixlike-common",
"cacheVariables": {
"CMAKE_SKIP_INSTALL_RULES": true,
"CMAKE_BUILD_TYPE": "Debug",
"myproject_ENABLE_COVERAGE": true
}
},
{
"name": "release",
"displayName": "Release",
"description": "Release build type",
"inherits": "conf-unixlike-common",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"ENABLE_DOXYGEN": true
}
}
],
"testPresets": [
{
"name": "common-test",
"description":
"Test CMake settings that apply to all configurations",
"hidden": true,
"output": {
"outputOnFailure": true
},
"execution": {
"noTestsAction": "error",
"stopOnFailure": true
}
},
{
"name": "debug",
"displayName": "Strict",
"description": "Enable output and stop on failure",
"inherits": "common-test",
"configuration": "Debug",
"configurePreset": "debug"
},
{
"name": "release",
"displayName": "Strict",
"description": "Enable output and stop on failure",
"inherits": "common-test",
"configuration": "Release",
"configurePreset": "release"
}
],
"buildPresets": [
{
"name": "release",
"configurePreset": "release"
},
{
"name": "install",
"configurePreset": "release",
"targets": [
"install"
]
},
{
"name": "doxygen-docs",
"configurePreset": "release",
"targets": [
"doxygen-docs"
]
},
{
"name": "debug",
"configurePreset": "debug"
}
],
"packagePresets": [
{
"name": "release",
"configurePreset": "release",
"generators": [
"TGZ"
]
}
],
"workflowPresets": [
{
"description": "Developer workflow without installation",
"name": "debug",
"steps": [
{
"type": "configure",
"name": "debug"
},
{
"type": "build",
"name": "debug"
},
{
"type": "test",
"name": "debug"
}
]
},
{
"description": "Release workflow without test",
"name": "release",
"steps": [
{
"name": "release",
"type": "configure"
},
{
"name": "release",
"type": "build"
},
{
"name": "release",
"type": "test"
},
{
"name": "install",
"type": "build"
},
{
"name": "release",
"type": "package"
}
]
}
]
}
2 changes: 1 addition & 1 deletion .github/workflows/auto-clang-format.yml
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ jobs:
extensions: 'h,cpp,hpp'
clangFormatVersion: 12
inplace: True
- uses: EndBug/add-and-commit@v4
- uses: EndBug/add-and-commit@v9
with:
author_name: Clang Robot
author_email: [email protected]
17 changes: 9 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -11,6 +11,7 @@ on:

env:
CLANG_TIDY_VERSION: "15.0.2"
CPM_SOURCE_CACHE: ~/.cache/CPM
VERBOSE: 1


@@ -29,9 +30,9 @@ jobs:
# and your own projects needs
matrix:
os:
- ubuntu-20.04
- macos-10.15
- windows-2019
- ubuntu-latest
- macos-latest
- windows-2022
compiler:
# you can specify the version after `-` like "llvm-15.0.2".
- llvm-15.0.2
@@ -49,21 +50,21 @@ jobs:

exclude:
# mingw is determined by this author to be too buggy to support
- os: windows-2019
- os: windows-2022
compiler: gcc-11

include:
# Add appropriate variables for gcov version required. This will intentionally break
# if you try to use a compiler that does not have gcov set
- compiler: gcc-11
gcov_executable: gcov
gcov_executable: gcov-11
enable_ipo: On

- compiler: llvm-15.0.2
enable_ipo: Off
gcov_executable: "llvm-cov gcov"

- os: macos-10.15
- os: macos-latest
enable_ipo: Off

# Set up preferred package generators, for given build configurations
@@ -72,11 +73,11 @@ jobs:
package_generator: TBZ2

# This exists solely to make sure a non-multiconfig build works
- os: ubuntu-20.04
- os: ubuntu-latest
compiler: gcc-11
generator: "Unix Makefiles"
build_type: Debug
gcov_executable: gcov
gcov_executable: gcov-11
packaging_maintainer_mode: On
enable_ipo: Off

114 changes: 57 additions & 57 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -48,60 +48,60 @@ jobs:


steps:
- uses: actions/checkout@v3

- name: Setup Cache
uses: ./.github/actions/setup_cache
with:
compiler: ${{ matrix.compiler }}
build_type: ${{ matrix.build_type }}
packaging_maintainer_mode: ${{ matrix.packaging_maintainer_mode }}
generator: ${{ matrix.generator }}

- name: Project Name
uses: cardinalby/export-env-action@v2
with:
envFile: '.github/constants.env'


- name: Setup Cpp
uses: aminya/setup-cpp@v1
with:
compiler: ${{ matrix.compiler }}
vcvarsall: ${{ contains(matrix.os, 'windows' )}}

cmake: true
ninja: true
vcpkg: false
ccache: true
clangtidy: false

cppcheck: false

gcovr: false
opencppcoverage: false

# make sure coverage is only enabled for Debug builds, since it sets -O0 to make sure coverage
# has meaningful results
- name: Configure CMake
run: |
cmake -S . -B ./build -G "${{matrix.generator}}" -DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} -D${{ env.PROJECT_NAME }}_PACKAGING_MAINTAINER_MODE:BOOL=${{matrix.packaging_maintainer_mode}} -D${{ env.PROJECT_NAME }}_ENABLE_COVERAGE:BOOL=${{ matrix.build_type == 'Debug' }}

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main


- name: Build
# Execute the build. You can specify a specific target with "--target <NAME>"
run: |
cmake --build ./build --config ${{matrix.build_type}}

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
- uses: actions/checkout@v3

- name: Setup Cache
uses: ./.github/actions/setup_cache
with:
compiler: ${{ matrix.compiler }}
build_type: ${{ matrix.build_type }}
packaging_maintainer_mode: ${{ matrix.packaging_maintainer_mode }}
generator: ${{ matrix.generator }}

- name: Project Name
uses: cardinalby/export-env-action@v2
with:
envFile: '.github/constants.env'


- name: Setup Cpp
uses: aminya/setup-cpp@v1
with:
compiler: ${{ matrix.compiler }}
vcvarsall: ${{ contains(matrix.os, 'windows' )}}

cmake: true
ninja: true
vcpkg: false
ccache: true
clangtidy: false

cppcheck: false

gcovr: false
opencppcoverage: false

# make sure coverage is only enabled for Debug builds, since it sets -O0 to make sure coverage
# has meaningful results
- name: Configure CMake
run: |
cmake -S . -B ./build -G "${{matrix.generator}}" -DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} -D${{ env.PROJECT_NAME }}_PACKAGING_MAINTAINER_MODE:BOOL=${{matrix.packaging_maintainer_mode}} -D${{ env.PROJECT_NAME }}_ENABLE_COVERAGE:BOOL=${{ matrix.build_type == 'Debug' }}

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main


- name: Build
# Execute the build. You can specify a specific target with "--target <NAME>"
run: |
cmake --build ./build --config ${{matrix.build_type}}

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
12 changes: 5 additions & 7 deletions .github/workflows/template-janitor.yml
Original file line number Diff line number Diff line change
@@ -44,7 +44,7 @@ jobs:
developer_mode: ${{ matrix.developer_mode }}
generator: ${{ matrix.generator }}

- name: Get organization and project name
- name: Get organization and project name
run: |
echo "NEW_ORG=${{ github.repository_owner }}" >> $GITHUB_ENV
echo "NEW_PROJECT=${{ github.event.repository.name }}" >> $GITHUB_ENV
@@ -69,9 +69,9 @@ jobs:
run: |
# hyphens and dots in c++ identifiers are forbidden. Use underscores instead.
NEW_SAFE_PROJECT=$(echo ${{ env.NEW_PROJECT }} | sed "s/-/_/g" | sed "s/\./_/g" )
echo "NEW_SAFE_PROJECT=$NEW_SAFE_PROJECT" >> $GITHUB_ENV
echo "NEW_SAFE_PROJECT=$NEW_SAFE_PROJECT" >> $GITHUB_ENV
# Rename all cpp_starter_project occurences to current repository and remove this workflow
# Rename all cpp_starter_project occurrences to current repository and remove this workflow
- name: Insert new org and project
run: |
# rename the CMake project to match the github project
@@ -129,7 +129,6 @@ jobs:
envFile: '.github/constants.env'



- name: Test simple configuration to make sure nothing broke
run: |
cmake -S . -B ./build -G "${{ matrix.generator }}" -DCMAKE_BUILD_TYPE:STRING=${{ matrix.build_type }} -D${{ env.NEW_SAFE_PROJECT }}_PACKAGING_MAINTAINER_MODE:BOOL=ON
@@ -149,7 +148,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}



template-rename:
name: Renames template when a new name is detected
runs-on: ubuntu-latest
@@ -175,7 +173,7 @@ jobs:
developer_mode: ${{ matrix.developer_mode }}
generator: ${{ matrix.generator }}

- name: Get organization and project name
- name: Get organization and project name
run: |
echo "TEST_RUN=false" >> $GITHUB_ENV
echo "NEW_ORG=${{ github.repository_owner }}" >> $GITHUB_ENV
@@ -205,7 +203,7 @@ jobs:
# Rename all cpp_starter_project occurrences to current repository and remove this workflow
- name: Update repository to match new template information
run: |
# Update the README and template files to match the new org / repository names
# Update the README and template files to match the new org / repository names
sed -i "s|${{ env.TEMPLATE_REPOSITORY }}|${{ env.NEW_REPOSITORY }}|g" README.md ${{ env.TEMPLATES_PATH }}/template_repository
sed -i "s|${{ env.TEMPLATE_NAME }}|${{ env.NEW_PROJECT }}|g" README.md ${{ env.TEMPLATES_PATH }}/template_name
53 changes: 32 additions & 21 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -6,44 +6,55 @@ stages:
.setup_linux: &setup_linux |
DEBIAN_FRONTEND=noninteractive

# set time-zone
TZ=Canada/Pacific
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

# for downloading
apt-get update -qq
apt-get install -y --no-install-recommends curl gnupg ca-certificates
apt-get install -y --no-install-recommends git make curl gnupg ca-certificates python3-pip

# keys used by apt
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3B4FE6ACC0B21F32
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 40976EAF437D05B5
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 1E9377A2BA9EF27F

# with foldable multi-line commands
.setup_cpp: &setup_cpp |
curl -LJO "https://github.com/aminya/setup-cpp/releases/download/v0.10.0/setup_cpp_linux"
chmod +x setup_cpp_linux
./setup_cpp_linux --compiler $compiler --cmake true --ninja true --conan true --ccache true --clangtidy true --clangformat true --cppcheck true
source ~/.profile

.test: &test |
# Build and Test
cmake -S . -B ./build -DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo
cmake --build ./build --config RelWithDebInfo
curl -LJO "https://github.com/aminya/setup-cpp/releases/download/v0.35.3/setup-cpp-x64-linux"
chmod +x setup-cpp-x64-linux
echo -e "section_end:"`date +%s`":.setup_cpp\r\e[0Ksection_start:"`date +%s`":hidden_section\r\e[0K setup cpp"
# export PATH="$HOME/.local/bin:$PATH"
./setup-cpp-x64-linux --compiler $compiler --cmake true --ninja true --ccache true \
--clangtidy true --clangformat true --cppcheck true --gcovr true
source ~/.cpprc
echo -e "section_end:"`date +%s`":hidden_section\r\e[0Ksection_start:"`date +%s`":.setup_cpp\r\e[0K"
clang-tidy --version
cmake --version
ninja --version
gcc --version
which gcovr && gcovr --version

# with foldable multi-line commands
.build:
script:
- *setup_cpp
- echo -e "section_end:"`date +%s`":.build\r\e[0Ksection_start:"`date +%s`":hidden_section\r\e[0K configure"
- cmake -S . -B ./build -G Ninja -D CMAKE_BUILD_TYPE=Debug -D CMAKE_UNITY_BUILD=YES -D CMAKE_SKIP_INSTALL_RULES=YES
- echo -e "section_end:"`date +%s`":hidden_section\r\e[0Ksection_start:"`date +%s`":.build\r\e[0K"
- cmake --build ./build --config Debug
- cmake --build ./build --config Debug --target test
- gcovr .

default:
before_script:
- *setup_linux

test_linux_llvm:
stage: test
variables:
compiler: llvm
script:
- *setup_linux
- *setup_cpp
- *test
extends: .build

test_linux_gcc:
stage: test
variables:
compiler: gcc
script:
- *setup_linux
- *setup_cpp
- *test
extends: .build