Skip to content

chore: tidy up unhandled exceptions #1329

chore: tidy up unhandled exceptions

chore: tidy up unhandled exceptions #1329

Workflow file for this run

name: Continuous Integration
on:
push:
branches:
- develop
- master
- '*'
tags:
- "v*.*.*"
pull_request:
branches:
- develop
concurrency:
group: ${{format('{0}:{1}', github.repository, github.ref)}}
cancel-in-progress: true
jobs:
cpp-matrix:
runs-on: ubuntu-latest
name: Generate Test Matrix
outputs:
matrix: ${{ steps.cpp-matrix.outputs.matrix }}
steps:
- name: Clone cpp-actions
uses: actions/checkout@v3
- name: Generate Test Matrix
uses: alandefreitas/cpp-actions/[email protected]
id: cpp-matrix
with:
compilers: |
gcc 13
clang 16
msvc 14.34
standards: '>=20'
max-standards: 1
latest-factors: gcc
factors: clang # Don't include Asan because `clang/AST/Decl.h` fails
build:
needs: cpp-matrix
strategy:
fail-fast: false
matrix:
include: ${{ fromJSON(needs.cpp-matrix.outputs.matrix) }}
defaults:
run:
shell: bash
name: ${{ matrix.name }}
runs-on: ${{ matrix.runs-on }}
container: ${{ ( !startsWith( matrix.runs-on , 'windows' ) && 'cppalliance/droneubuntu2204:llvm-731264b' ) || null }}
permissions:
contents: write
steps:
- name: Clone mrdox
uses: actions/checkout@v3
- name: Install LLVM
id: llvm-install
if: ${{ startsWith( matrix.runs-on , 'windows' ) }}
shell: bash
run: |
set -xe
curl -L -o "RelWithDebInfo-731264b0.7z" "https://github.com/cppalliance/mrdox/releases/download/llvm-package-release/RelWithDebInfo-731264b0.7z"
llvm_dir="${{runner.tool_cache}}/llvm-install"
llvm_dir=$(echo "$llvm_dir" | sed 's/\\/\//g')
7z x RelWithDebInfo-731264b0.7z -o"${llvm_dir}"
echo "llvm-dir=$llvm_dir/RelWithDebInfo" >> $GITHUB_OUTPUT
substring="C:/Program Files/Microsoft Visual Studio/2022/Community/DIA SDK/lib/amd64/diaguids.lib;"
sed -i "s|$substring||g" "$llvm_dir/RelWithDebInfo/lib/cmake/llvm/LLVMExports.cmake"
echo "llvm_dir=$llvm_dir"
find "$llvm_dir" -type f
- name: Setup C++
uses: alandefreitas/cpp-actions/[email protected]
id: setup-cpp
with:
compiler: ${{ matrix.compiler }}
version: ${{ matrix.version }}
check-latest: ${{ matrix.compiler == 'clang' }}
- name: Install packages
uses: alandefreitas/cpp-actions/[email protected]
id: package-install
with:
apt-get: ${{ matrix.install }} openjdk-11-jdk ninja-build ${{ matrix.compiler == 'clang' && 'libstdc++-12-dev' || '' }}
vcpkg: fmt libxml2[tools]
cc: ${{ steps.setup-cpp.outputs.cc || matrix.cc }}
ccflags: ${{ matrix.ccflags }}
cxx: ${{ steps.setup-cpp.outputs.cxx || matrix.cxx }}
cxxflags: ${{ matrix.cxxflags }}
- name: CMake Workflow
uses: alandefreitas/cpp-actions/[email protected]
with:
cmake-version: '>=3.20'
generator: Ninja
toolchain: ${{ steps.package-install.outputs.vcpkg-toolchain }}
build-type: ${{ matrix.build-type }}
cxxstd: ${{ matrix.cxxstd }}
cc: ${{ steps.setup-cpp.outputs.cc || matrix.cc }}
ccflags: ${{ matrix.ccflags }}
cxx: ${{ steps.setup-cpp.outputs.cxx || matrix.cxx }}
cxxflags: ${{ matrix.cxxflags }}${{ ( matrix.compiler == 'gcc' && ' -static-libstdc++') || '' }}${{ ( matrix.asan && ' -static-libasan') || '' }}${{ ( matrix.tsan && ' -static-libtsan') || '' }}
install-prefix: .local
extra-args: ${{ format('-D LLVM_ROOT="{0}" -D Clang_ROOT="{0}" -D CMAKE_EXPORT_COMPILE_COMMANDS=ON', steps.llvm-install.outputs.llvm-dir || '/usr/local') }}
export-compile-commands: ${{ matrix.time-trace }}
package: ${{ matrix.is-main }}
package-dir: packages
- name: Upload GitHub Release Artifacts
if: ${{ matrix.is-main && github.event_name == 'push' && (contains(fromJSON('["master", "develop"]'), github.ref_name) || startsWith(github.ref, 'refs/tags/')) }}
uses: actions/upload-artifact@v3
with:
name: release-packages-${{ runner.os }}
path: build/packages
retention-days: 1
- name: FlameGraph
uses: alandefreitas/cpp-actions/[email protected]
if: matrix.time-trace
with:
build-dir: build
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Codecov
if: ${{ matrix.coverage }}
run: |
set -x
# Find gcov
gcov_tool="gcov"
if command -v "gcov-${{ steps.setup-cpp.outputs.version-major }}.${{ steps.setup-cpp.outputs.version-minor }}" &> /dev/null; then
gcov_tool="gcov"
elif command -v "gcov-${{ steps.setup-cpp.outputs.version-major }}" &> /dev/null; then
gcov_tool="gcov-${{ steps.setup-cpp.outputs.version-major }}"
fi
lcov -c -q -o "./build/coverage.info" -d "./build" --include "$(pwd)/*" --gcov-tool "$gcov_tool"
# Upload to codecov
bash <(curl -s https://codecov.io/bash) -f "./build/coverage.info"
# Update summary
echo "# Coverage" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "[![codecov](https://codecov.io/github/$GITHUB_REPOSITORY/commit/$GITHUB_SHA/graphs/sunburst.svg)](https://codecov.io/github/$GITHUB_REPOSITORY/commit/$GITHUB_SHA)" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "$GITHUB_REF_NAME: [![codecov](https://codecov.io/github/$GITHUB_REPOSITORY/branch/$GITHUB_REF_NAME/graph/badge.svg)](https://codecov.io/github/$GITHUB_REPOSITORY/commit/$GITHUB_SHA)" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
docs:
needs: build
if: ${{ github.event_name == 'push' && (contains(fromJSON('["master", "develop"]'), github.ref_name) || startsWith(github.ref, 'refs/tags/')) }}
defaults:
run:
shell: bash
name: Publish docs
timeout-minutes: 30
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- name: Clone mrdox
uses: actions/checkout@v3
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Generate Site
working-directory: docs
run: |
npm install
master_antora_exists=$(curl --silent --fail --head https://github.com/cppalliance/mrdox/blob/master/docs/antora.yml >/dev/null && echo "true" || echo "false")
develop_antora_exists=$(curl --silent --fail --head https://github.com/cppalliance/mrdox/blob/develop/docs/antora.yml >/dev/null && echo "true" || echo "false")
if [ "$master_antora_exists" == "true" ] && [ "$develop_antora_exists" == "true" ]; then
# Antora is set up in both master and develop: render complete playbook
npx antora antora-playbook.yml
else
# Antora is not set up in master and develop yet: render local playbook while integration is not complete
# The local playbook is used for local development and for the documentation included in the release
npx antora local-antora-playbook.yml
fi
- name: Publish to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/build/site
force_orphan: true
releases:
needs: build
if: ${{ github.event_name == 'push' && (contains(fromJSON('["master", "develop"]'), github.ref_name) || startsWith(github.ref, 'refs/tags/')) }}
defaults:
run:
shell: bash
name: Create Release Packages
timeout-minutes: 120
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- name: Clone mrdox
uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: release-packages-Linux
path: build
- uses: actions/download-artifact@v3
with:
name: release-packages-Windows
path: build
- name: List artifacts
run: ls -R
working-directory: build
- name: Create changelog
uses: alandefreitas/cpp-actions/[email protected]
with:
output-path: CHANGELOG.md
thank-non-regular: ${{ startsWith(github.ref, 'refs/tags/') }}
github-token: ${{ secrets.GITHUB_TOKEN }}
limit: 150
- name: Remove branch release
if: ${{ github.event_name == 'push' && contains(fromJSON('["master", "develop"]'), github.ref_name) }}
uses: dev-drprasad/[email protected]
with:
tag_name: ${{ github.ref_name }}-release
github_token: ${{ secrets.GITHUB_TOKEN }}
delete_release: true
- name: Create GitHub Package Release
if: ${{ github.event_name == 'push' && (contains(fromJSON('["master", "develop"]'), github.ref_name) || startsWith(github.ref, 'refs/tags/')) }}
uses: softprops/action-gh-release@v1
with:
files: build/MrDox-?.?.?-*.*
name: ${{ github.ref_name || github.ref }}
tag_name: ${{ github.ref_name || github.ref }}${{ ((!startsWith(github.ref, 'refs/tags/')) && '-release') || '' }}
body_path: CHANGELOG.md
prerelease: false
draft: false
token: ${{ github.token }}
- uses: dev-drprasad/[email protected]
if: ${{ github.event_name == 'push' && contains(fromJSON('["master", "develop"]'), github.ref_name) }}
with:
keep_latest: 1
delete_tag_pattern: ${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}