Skip to content

Commit

Permalink
Add GitHub workflows
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Stump <11492152+globberwops@users.noreply.github.com>
  • Loading branch information
globberwops committed Dec 27, 2023
1 parent b21a289 commit 208ae2b
Show file tree
Hide file tree
Showing 10 changed files with 412 additions and 43 deletions.
2 changes: 2 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ RUN apt-get update && apt-get install -y \
cppcheck \
cpplint \
curl \
doxygen \
gdb \
git \
gnupg \
graphviz \
iwyu \
libbenchmark-dev \
libgmock-dev \
Expand Down
82 changes: 41 additions & 41 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
{
"name": "CppInterfaceTechniques",
"dockerFile": "Dockerfile",
"capAdd": [
"SYS_PTRACE"
],
"securityOpt": [
"seccomp=unconfined"
],
"remoteUser": "ubuntu",
"customizations": {
"vscode": {
"extensions": [
"cheshirekow.cmake-format",
"llvm-vs-code-extensions.vscode-clangd",
"ms-azuretools.vscode-docker",
"ms-vscode.cmake-tools",
"ms-vscode.cpptools",
"redhat.vscode-yaml",
"twxs.cmake"
],
"settings": {
"C_Cpp.intelliSenseEngine": "disabled",
"clangd.path": "clangd-18",
"cmake.exportCompileCommandsFile": true,
"cmake.generator": "Ninja Multi-Config",
"cmake.installPrefix": "${workspaceFolder}/build/prefix",
"files.associations": {
".clang-format": "yaml",
".clang-tidy": "yaml",
".clangd": "yaml",
".cmake-format": "yaml",
"*.cmake.in": "cmake"
},
"files.exclude": {
"**/.cache": true
},
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true,
"files.trimTrailingWhitespace": true
}
}
"name": "CppInterfaceTechniques",
"dockerFile": "Dockerfile",
"capAdd": [
"SYS_PTRACE"
],
"securityOpt": [
"seccomp=unconfined"
],
"remoteUser": "ubuntu",
"customizations": {
"vscode": {
"extensions": [
"cheshirekow.cmake-format",
"llvm-vs-code-extensions.vscode-clangd",
"ms-azuretools.vscode-docker",
"ms-vscode.cmake-tools",
"ms-vscode.cpptools",
"redhat.vscode-yaml",
"twxs.cmake"
],
"settings": {
"C_Cpp.intelliSenseEngine": "disabled",
"clangd.path": "clangd-18",
"cmake.exportCompileCommandsFile": true,
"cmake.generator": "Ninja Multi-Config",
"cmake.installPrefix": "${workspaceFolder}/build/prefix",
"files.associations": {
".clang-format": "yaml",
".clang-tidy": "yaml",
".clangd": "yaml",
".cmake-format": "yaml",
"*.cmake.in": "cmake"
},
"files.exclude": {
"**/.cache": true
},
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true,
"files.trimTrailingWhitespace": true
}
}
}
}
84 changes: 84 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ "main" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "main" ]
schedule:
- cron: '39 12 * * 0'

jobs:
analyze:
name: Analyze
# Runner size impacts CodeQL analysis time. To learn more, please see:
# - https://gh.io/recommended-hardware-resources-for-running-codeql
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners
# Consider using larger runners for possible analysis time improvements.
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'c-cpp' ]
# CodeQL supports [ 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' ]
# Use only 'java-kotlin' to analyze code written in Java, Kotlin or both
# Use only 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v4

# 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.

# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality


# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
env:
CXX: g++-13

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
41 changes: 41 additions & 0 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: "Linux"

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set reusable strings
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
echo "build-type=Release" >> "$GITHUB_OUTPUT"
- name: Configure CMake
run: >
cmake
-B ${{ steps.strings.outputs.build-output-dir }}
-DCMAKE_CXX_COMPILER=g++-13
-DCMAKE_C_COMPILER=gcc-13
-DCMAKE_BUILD_TYPE=${{ steps.strings.outputs.build-type }}
-S ${{ github.workspace }}
- name: Build
run: >
cmake
--build ${{ steps.strings.outputs.build-output-dir }}
--config ${{ steps.strings.outputs.build-type }}
- name: Test
working-directory: ${{ steps.strings.outputs.build-output-dir }}
run: ctest --build-config ${{ steps.strings.outputs.build-type }}
41 changes: 41 additions & 0 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: "macOS"

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:

jobs:
build:
runs-on: macos-latest

steps:
- uses: actions/checkout@v4

- name: Set reusable strings
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
echo "build-type=Release" >> "$GITHUB_OUTPUT"
- name: Configure CMake
run: >
cmake
-B ${{ steps.strings.outputs.build-output-dir }}
-DCMAKE_CXX_COMPILER=g++-12
-DCMAKE_C_COMPILER=gcc-12
-DCMAKE_BUILD_TYPE=${{ steps.strings.outputs.build-type }}
-S ${{ github.workspace }}
- name: Build
run: >
cmake
--build ${{ steps.strings.outputs.build-output-dir }}
--config ${{ steps.strings.outputs.build-type }}
- name: Test
working-directory: ${{ steps.strings.outputs.build-output-dir }}
run: ctest --build-config ${{ steps.strings.outputs.build-type }}
46 changes: 46 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: "Pages"

on:
push:
branches: [ "main" ]

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Install Doxygen
run: sudo apt-get -y install doxygen graphviz
- name: Checkout
uses: actions/checkout@v4
- name: Setup Pages
id: pages
uses: actions/configure-pages@v4
- name: Configure with CMake
run: cmake -B build -S ${{ github.workspace }}
- name: Build with CMake
run: cmake --build build --target gw_docs
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
name: github-pages
path: build/docs/html

deploy:
environment:
name: github-pages
url: ${{steps.deployment.outputs.page_url}}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v3
41 changes: 41 additions & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: "Windows"

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:

jobs:
build:
runs-on: windows-latest

steps:
- uses: actions/checkout@v4

- name: Set reusable strings
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
echo "build-type=Release" >> "$GITHUB_OUTPUT"
- name: Configure CMake
run: >
cmake
-B ${{ steps.strings.outputs.build-output-dir }}
-DCMAKE_CXX_COMPILER=cl
-DCMAKE_C_COMPILER=cl
-DCMAKE_BUILD_TYPE=${{ steps.strings.outputs.build-type }}
-S ${{ github.workspace }}
- name: Build
run: >
cmake
--build ${{ steps.strings.outputs.build-output-dir }}
--config ${{ steps.strings.outputs.build-type }}
- name: Test
working-directory: ${{ steps.strings.outputs.build-output-dir }}
run: ctest --build-config ${{ steps.strings.outputs.build-type }}
8 changes: 6 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ cmake_minimum_required(VERSION 3.24)

list(PREPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")

project(CppInterfaceTechniques CXX)
project(
CppInterfaceTechniques
VERSION 1.0.0
DESCRIPTION "A review of C++ Interface Techniques"
HOMEPAGE_URL "https://github.com/globberwops/cpp-interface-techniques"
LANGUAGES CXX)

include(FetchDeps)
include(CompilerWarnings)
Expand All @@ -23,7 +28,6 @@ if(CPP_INTERFACE_TECHNIQUES_BUILD_DOCS)
endif()

if(CPP_INTERFACE_TECHNIQUES_BUILD_TESTS)
include(CTest)
enable_testing()
add_subdirectory(tests)
endif()
Loading

0 comments on commit 208ae2b

Please # to comment.