-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 3334995
Showing
149 changed files
with
21,803 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
# Google C/C++ Code Style settings | ||
# https://clang.llvm.org/docs/ClangFormatStyleOptions.html | ||
# Author: Kehan Xue, kehan.xue (at) gmail.com | ||
|
||
Language: Cpp | ||
BasedOnStyle: Google | ||
AccessModifierOffset: -1 | ||
AlignAfterOpenBracket: Align | ||
AlignConsecutiveAssignments: None | ||
AlignOperands: Align | ||
AllowAllArgumentsOnNextLine: true | ||
AllowAllConstructorInitializersOnNextLine: true | ||
AllowAllParametersOfDeclarationOnNextLine: false | ||
AllowShortBlocksOnASingleLine: Empty | ||
AllowShortCaseLabelsOnASingleLine: false | ||
AllowShortFunctionsOnASingleLine: Inline | ||
AllowShortIfStatementsOnASingleLine: Never # To avoid conflict, set this "Never" and each "if statement" should include brace when coding | ||
AllowShortLambdasOnASingleLine: Inline | ||
AllowShortLoopsOnASingleLine: false | ||
AlwaysBreakAfterReturnType: None | ||
AlwaysBreakTemplateDeclarations: Yes | ||
BinPackArguments: true | ||
BreakBeforeBraces: Custom | ||
BraceWrapping: | ||
AfterCaseLabel: false | ||
AfterClass: false | ||
AfterStruct: false | ||
AfterControlStatement: Never | ||
AfterEnum: false | ||
AfterFunction: false | ||
AfterNamespace: false | ||
AfterUnion: false | ||
AfterExternBlock: false | ||
BeforeCatch: false | ||
BeforeElse: false | ||
BeforeLambdaBody: false | ||
IndentBraces: false | ||
SplitEmptyFunction: false | ||
SplitEmptyRecord: false | ||
SplitEmptyNamespace: false | ||
BreakBeforeBinaryOperators: None | ||
BreakBeforeTernaryOperators: true | ||
BreakConstructorInitializers: BeforeColon | ||
BreakInheritanceList: BeforeColon | ||
ColumnLimit: 80 | ||
CompactNamespaces: false | ||
ContinuationIndentWidth: 4 | ||
Cpp11BracedListStyle: true | ||
DerivePointerAlignment: false # Make sure the * or & align on the left | ||
EmptyLineBeforeAccessModifier: LogicalBlock | ||
FixNamespaceComments: true | ||
IncludeBlocks: Preserve | ||
IndentCaseLabels: true | ||
IndentPPDirectives: None | ||
IndentWidth: 2 | ||
KeepEmptyLinesAtTheStartOfBlocks: true | ||
MaxEmptyLinesToKeep: 1 | ||
NamespaceIndentation: None | ||
ObjCSpaceAfterProperty: false | ||
ObjCSpaceBeforeProtocolList: true | ||
PointerAlignment: Left | ||
ReflowComments: false | ||
# SeparateDefinitionBlocks: Always # Only support since clang-format 14 | ||
SpaceAfterCStyleCast: false | ||
SpaceAfterLogicalNot: false | ||
SpaceAfterTemplateKeyword: true | ||
SpaceBeforeAssignmentOperators: true | ||
SpaceBeforeCpp11BracedList: false | ||
SpaceBeforeCtorInitializerColon: true | ||
SpaceBeforeInheritanceColon: true | ||
SpaceBeforeParens: ControlStatements | ||
SpaceBeforeRangeBasedForLoopColon: true | ||
SpaceBeforeSquareBrackets: false | ||
SpaceInEmptyParentheses: false | ||
SpacesBeforeTrailingComments: 2 | ||
SpacesInAngles: false | ||
SpacesInCStyleCastParentheses: false | ||
SpacesInContainerLiterals: false | ||
SpacesInParentheses: false | ||
SpacesInSquareBrackets: false | ||
Standard: c++17 | ||
TabWidth: 4 | ||
UseTab: Never |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
# [Choice] bionic (18.04), focal (20.04) | ||
ARG VARIANT="jammy" | ||
FROM ubuntu:${VARIANT} | ||
|
||
# Restate the variant to use it later on in the llvm and cmake installations | ||
ARG VARIANT | ||
|
||
# Install necessary packages available from standard repos | ||
RUN apt-get update -qq && export DEBIAN_FRONTEND=noninteractive && \ | ||
apt-get install -y --no-install-recommends \ | ||
software-properties-common wget apt-utils file zip \ | ||
openssh-client gpg-agent socat rsync \ | ||
make ninja-build git \ | ||
python3 python3-pip | ||
|
||
# Install conan | ||
RUN python3 -m pip install --upgrade pip setuptools && \ | ||
python3 -m pip install conan && \ | ||
conan --version | ||
|
||
# By default, anything you run in Docker is done as superuser. | ||
# Conan runs some install commands as superuser, and will prepend `sudo` to | ||
# these commands, unless `CONAN_SYSREQUIRES_SUDO=0` is in your env variables. | ||
ENV CONAN_SYSREQUIRES_SUDO 0 | ||
# Some packages request that Conan use the system package manager to install | ||
# a few dependencies. This flag allows Conan to proceed with these installations; | ||
# leaving this flag undefined can cause some installation failures. | ||
ENV CONAN_SYSREQUIRES_MODE enabled | ||
|
||
# Store Conan files at this path so host chose to map as volume for semantic | ||
# completion. Must be same path on host and container for compile_commands.json | ||
# to match. | ||
ENV CONAN_USER_HOME=/etc/conan | ||
RUN mkdir ${CONAN_USER_HOME} && chmod a+rw ${CONAN_USER_HOME} | ||
|
||
# User-settable versions: | ||
# This Dockerfile should support gcc-[7, 8, 9, 10, 11] and clang-[10, 11, 12, 13] | ||
# Earlier versions of clang will require significant modifications to the IWYU section | ||
ARG GCC_VER="11" | ||
# Add gcc-${GCC_VER} | ||
RUN add-apt-repository -y ppa:ubuntu-toolchain-r/test && \ | ||
apt-get update -qq && export DEBIAN_FRONTEND=noninteractive && \ | ||
apt-get install -y --no-install-recommends \ | ||
gcc-${GCC_VER} g++-${GCC_VER} gdb | ||
|
||
# Set gcc-${GCC_VER} as default gcc | ||
RUN update-alternatives --install /usr/bin/gcc gcc $(which gcc-${GCC_VER}) 100 | ||
RUN update-alternatives --install /usr/bin/g++ g++ $(which g++-${GCC_VER}) 100 | ||
|
||
ARG LLVM_VER="14" | ||
# Add clang-${LLVM_VER} | ||
ARG LLVM_URL="http://apt.llvm.org/${VARIANT}/" | ||
ARG LLVM_PKG="llvm-toolchain-${VARIANT}-${LLVM_VER}" | ||
RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - 2>/dev/null && \ | ||
add-apt-repository -y "deb ${LLVM_URL} ${LLVM_PKG} main" && \ | ||
apt-get update -qq && export DEBIAN_FRONTEND=noninteractive && \ | ||
apt-get install -y --no-install-recommends \ | ||
clang-${LLVM_VER} lldb-${LLVM_VER} lld-${LLVM_VER} clangd-${LLVM_VER} \ | ||
llvm-${LLVM_VER}-dev libclang-${LLVM_VER}-dev clang-tidy-${LLVM_VER} clang-format-${LLVM_VER} | ||
|
||
# Set the default clang-tidy, so CMake can find it | ||
RUN update-alternatives --install /usr/bin/clang-tidy clang-tidy $(which clang-tidy-${LLVM_VER}) 1 | ||
|
||
# Set the default clang-format | ||
RUN update-alternatives --install /usr/bin/clang-format clang-format $(which clang-format-${LLVM_VER}) 1 | ||
|
||
# Set clang-${LLVM_VER} as default clang | ||
RUN update-alternatives --install /usr/bin/clang clang $(which clang-${LLVM_VER}) 100 | ||
RUN update-alternatives --install /usr/bin/clang++ clang++ $(which clang++-${LLVM_VER}) 100 | ||
|
||
# Add current cmake/ccmake, from Kitware | ||
ARG CMAKE_URL="https://apt.kitware.com/ubuntu/" | ||
ARG CMAKE_PKG=${VARIANT} | ||
RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null \ | ||
| gpg --dearmor - | tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null && \ | ||
apt-add-repository -y "deb ${CMAKE_URL} ${CMAKE_PKG} main" && \ | ||
apt-get update -qq && export DEBIAN_FRONTEND=noninteractive && \ | ||
apt-get install -y --no-install-recommends cmake cmake-curses-gui | ||
|
||
# Install editors | ||
RUN apt-get update -qq && export DEBIAN_FRONTEND=noninteractive && \ | ||
apt-get install -y --no-install-recommends \ | ||
neovim emacs nano | ||
|
||
# Install optional dependecies | ||
RUN apt-get update -qq && export DEBIAN_FRONTEND=noninteractive && \ | ||
apt-get install -y --no-install-recommends \ | ||
doxygen graphviz ccache cppcheck | ||
ENV CCACHE_DIR=/home/ccache | ||
RUN mkdir ${CCACHE_DIR} && chmod a+rw ${CCACHE_DIR} | ||
|
||
# Install include-what-you-use | ||
ENV IWYU /home/iwyu | ||
ENV IWYU_BUILD ${IWYU}/build | ||
ENV IWYU_SRC ${IWYU}/include-what-you-use | ||
RUN mkdir -p ${IWYU_BUILD} && \ | ||
git clone --branch clang_${LLVM_VER} \ | ||
https://github.com/include-what-you-use/include-what-you-use.git \ | ||
${IWYU_SRC} | ||
RUN CC=clang-${LLVM_VER} CXX=clang++-${LLVM_VER} cmake -S ${IWYU_SRC} \ | ||
-B ${IWYU_BUILD} \ | ||
-G "Unix Makefiles" -DCMAKE_PREFIX_PATH=/usr/lib/llvm-${LLVM_VER} && \ | ||
cmake --build ${IWYU_BUILD} -j && \ | ||
cmake --install ${IWYU_BUILD} | ||
|
||
# Per https://github.com/include-what-you-use/include-what-you-use#how-to-install: | ||
# `You need to copy the Clang include directory to the expected location before | ||
# running (similarly, use include-what-you-use -print-resource-dir to learn | ||
# exactly where IWYU wants the headers).` | ||
RUN mkdir -p $(include-what-you-use -print-resource-dir 2>/dev/null) | ||
RUN ln -s $(readlink -f /usr/lib/clang/${LLVM_VER}/include) \ | ||
$(include-what-you-use -print-resource-dir 2>/dev/null)/include | ||
|
||
## Cleanup cached apt data we don't need anymore | ||
RUN apt-get autoremove -y && apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Allow the user to set compiler defaults | ||
ARG USE_CLANG | ||
# if --build-arg USE_CLANG=1, set CC to 'clang' or set to null otherwise. | ||
ENV CC=${USE_CLANG:+"clang"} | ||
ENV CXX=${USE_CLANG:+"clang++"} | ||
# if CC is null, set it to 'gcc' (or leave as is otherwise). | ||
ENV CC=${CC:-"gcc"} | ||
ENV CXX=${CXX:-"g++"} | ||
|
||
ARG USERNAME=user | ||
ARG USER_UID=1000 | ||
ARG USER_GID=$USER_UID | ||
RUN groupadd --gid $USER_GID $USERNAME \ | ||
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \ | ||
&& apt-get update \ | ||
&& apt-get install -y sudo \ | ||
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ | ||
&& chmod 0440 /etc/sudoers.d/$USERNAME | ||
USER $USERNAME | ||
|
||
CMD ["/bin/bash"] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: | ||
// https://github.com/microsoft/vscode-dev-containers/tree/v0.205.2/containers/cpp | ||
{ | ||
"name": "C++", | ||
"build": { | ||
"dockerfile": "Dockerfile" | ||
// Update 'VARIANT' to pick an Ubuntu OS version. Options: [bionic, focal]. Default: focal | ||
// Update 'GCC_VER' to pick a gcc and g++ version. Options: [7, 8, 9, 10, 11]. Default: 11 | ||
// Update 'LLVM_VER' to pick clang version. Options: [10, 11, 12, 13]. Default: 13 | ||
// Update 'USE_CLANG' to set clang as the default C and C++ compiler. Options: [1, null]. Default null | ||
// "args": { | ||
// "VARIANT": "focal", | ||
// "GCC_VER": "11", | ||
// "LLVM_VER": "13" | ||
// } | ||
}, | ||
"runArgs": [ | ||
"--cap-add=SYS_PTRACE", | ||
"--security-opt", | ||
"seccomp=unconfined" | ||
], | ||
// Set *default* container specific settings.json values on container create. | ||
"settings": { | ||
"cmake.configureOnOpen": true, | ||
"editor.formatOnSave": true | ||
}, | ||
// Add the IDs of extensions you want installed when the container is created. | ||
"extensions": [ | ||
"ms-vscode.cpptools-extension-pack", | ||
"cschlosser.doxdocgen", | ||
"ms-python.python", | ||
"ms-python.vscode-pylance", | ||
], | ||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
// "forwardPorts": [], | ||
// Use 'postCreateCommand' to run commands after the container is created. | ||
"postCreateCommand": "sudo apt update && sudo apt install -y g++ make cmake libgmp-dev libssl-dev libboost-all-dev software-properties-common cmake git build-essential libssl-dev xxd", | ||
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. | ||
//"remoteUser": "vscode", | ||
"workspaceMount": "source=${localWorkspaceFolder},target=/workspaces/${localWorkspaceFolderBasename},type=bind,consistency=delegated", | ||
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", | ||
"features": { | ||
"git": "latest", | ||
"git-lfs": "latest" | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.git/ | ||
build/ | ||
**/build/ | ||
**/CMakeCache.txt | ||
**/.git/ | ||
docker/ | ||
plottertest/ | ||
results/ | ||
results-paper/ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
name: devcontainer | ||
|
||
on: | ||
push: | ||
branches: [ "master" ] | ||
pull_request: | ||
branches: [ "master" ] | ||
|
||
env: | ||
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | ||
BUILD_TYPE: Release | ||
|
||
jobs: | ||
build: | ||
runs-on: [self-hosted, linux, x64] | ||
|
||
steps: | ||
- name: Copy Runner Env to Workflow Env | ||
run: | | ||
echo "::add-mask::${LOCAL_REG_URL}" | ||
echo "::add-mask::${LOCAL_REG_USER}" | ||
echo "::add-mask::${LOCAL_REG_PASS}" | ||
echo "LOCAL_REG_URL=${LOCAL_REG_URL}" >> $GITHUB_ENV | ||
echo "LOCAL_REG_USER=${LOCAL_REG_USER}" >> $GITHUB_ENV | ||
echo "LOCAL_REG_PASS=${LOCAL_REG_PASS}" >> $GITHUB_ENV | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: 'recursive' | ||
token: ${{ secrets.SUBMODULE_PAT }} | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 'latest' | ||
|
||
- name: Docker Login to Local Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.LOCAL_REG_URL }} | ||
username: ${{ env.LOCAL_REG_USER }} | ||
password: ${{ env.LOCAL_REG_PASS }} | ||
|
||
- name: Install updated Skopeo | ||
# This can be omitted once runner images have a version of Skopeo > 1.4.1 | ||
# See https://github.com/containers/skopeo/issues/1874 | ||
run: | | ||
# sudo apt purge buildah golang-github-containers-common podman skopeo | ||
# sudo apt autoremove --purge | ||
REPO_URL="https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable" | ||
source /etc/os-release | ||
sudo sh -c "echo 'deb ${REPO_URL}/x${NAME}_${VERSION_ID}/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:unstable.list" | ||
sudo wget -qnv https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/x${NAME}_${VERSION_ID}/Release.key -O Release.key | ||
sudo apt-key add Release.key | ||
sudo apt-get update | ||
sudo apt-get install skopeo | ||
- name: Configure CMake in Cached devcontainer | ||
uses: devcontainers/[email protected] | ||
env: | ||
BUILDX_NO_DEFAULT_ATTESTATIONS: true | ||
with: | ||
imageName: ${{ env.LOCAL_REG_URL }}/secret-snail/localization-server-devcontainer | ||
cacheFrom: ${{ env.LOCAL_REG_URL }}/secret-snail/localization-server-devcontainer | ||
push: always | ||
runCmd: | | ||
cmake -B ./build -S ./ -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} && \ | ||
cd ./build && make -j8 && ctest | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: container | ||
|
||
on: | ||
push: | ||
branches: [ "master" ] | ||
pull_request: | ||
branches: [ "master" ] | ||
|
||
jobs: | ||
|
||
build: | ||
runs-on: [self-hosted, linux, x64] | ||
steps: | ||
- name: Copy Runner Env to Workflow Env | ||
run: | | ||
echo "::add-mask::${LOCAL_REG_URL}" | ||
echo "::add-mask::${LOCAL_REG_USER}" | ||
echo "::add-mask::${LOCAL_REG_PASS}" | ||
echo "LOCAL_REG_URL=${LOCAL_REG_URL}" >> $GITHUB_ENV | ||
echo "LOCAL_REG_USER=${LOCAL_REG_USER}" >> $GITHUB_ENV | ||
echo "LOCAL_REG_PASS=${LOCAL_REG_PASS}" >> $GITHUB_ENV | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: 'recursive' | ||
token: ${{ secrets.SUBMODULE_PAT }} | ||
|
||
- name: Docker Login to Local Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.LOCAL_REG_URL }} | ||
username: ${{ env.LOCAL_REG_USER }} | ||
password: ${{ env.LOCAL_REG_PASS }} | ||
|
||
- name: Build the Docker image | ||
run: docker build . --file ./docker/Dockerfile --tag ${{ env.LOCAL_REG_URL }}/secret-snail/localization-server:latest | ||
|
||
- name: Run the tests in the container | ||
run: | | ||
docker run --rm ${{ env.LOCAL_REG_URL }}/secret-snail/localization-server:latest \ | ||
bash -c "cd ./build && ctest" | ||
- name: Push the Docker image | ||
run: docker push ${{ env.LOCAL_REG_URL }}/secret-snail/localization-server:latest |
Oops, something went wrong.