Skip to content

Commit

Permalink
Merge pull request #23 from Quetzal-framework/develop
Browse files Browse the repository at this point in the history
feat: devcontainers integration in Visual Code Studio
  • Loading branch information
Becheler authored Dec 14, 2023
2 parents b20f05c + 0afd4f0 commit c20a083
Show file tree
Hide file tree
Showing 44 changed files with 502 additions and 137 deletions.
20 changes: 20 additions & 0 deletions .devcontainer/Dockerfile-alpine
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM alpine:3.18 AS build

LABEL maintainer="Arnaud Becheler" \
description="Development Environment for Quetzal-CoaTL"

WORKDIR /app

# Installs build tools, see https://pkgs.alpinelinux.org/packages
RUN apk update && \
apk add --no-cache \
bash \
perl \
linux-headers \
build-base=0.5-r3 \
cmake=3.26.5-r0 \
python3=3.11.6-r0 \
py3-pip=23.1.2-r0 \
git

RUN pip install conan==2.0.13
21 changes: 21 additions & 0 deletions .devcontainer/Dockerfile-ubuntu
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM ubuntu:22.04

ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get update -y
RUN apt-get install -y --no-install-recommends\
vim \
git \
gcc-12 \
g++-12 \
build-essential \
libboost-all-dev \
cmake \
unzip \
tar \
ca-certificates \
doxygen \
graphviz \
python3-pip

RUN pip install conan==2.0.13
35 changes: 35 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// For format details, see https://aka.ms/devcontainer.json.
// For config options, see the README at: https://github.com/devcontainers/templates/tree/main/src/cpp
{
"name": "C++",
// have no effect on the build but are only used when creating and running the dev container from the image
"workspaceMount": "source=${localWorkspaceFolder},target=/app,type=bind",
"workspaceFolder": "/app", // /default path in container to open
"build": {
"context": "..",
"dockerfile": "Dockerfile-ubuntu"
},
"onCreateCommand": "chmod +x .devcontainer/onCreateCommand.sh && ./.devcontainer/onCreateCommand.sh",
// Features to add to the dev container, see https://containers.dev/feature
"features": {},

// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
"settings": {},
"extensions": [
"streetsidesoftware.code-spell-checker"
]
}
}

// 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": "gcc -v",

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
2 changes: 2 additions & 0 deletions .devcontainer/onCreateCommand.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
conan install conanfile.py --profile:build=conan/profiles/linux-armv8-gcc12-release --profile:host=conan/profiles/linux-armv8-gcc12-release --build=missing --output-folder=build
conan install conanfile.py --profile:build=conan/profiles/linux-armv8-gcc12-debug --profile:host=conan/profiles/linux-armv8-gcc12-debug --build=missing --output-folder=build
58 changes: 31 additions & 27 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
BUILD_TYPE: Debug

jobs:
build:
Expand All @@ -23,40 +23,44 @@ jobs:
fetch-depth: 0
submodules: recursive

- name: Get GCC-12
run: |
sudo apt update && sudo apt upgrade -y
sudo apt install -y gcc-12 g++-12
sudo apt install -y python3-pip
sudo apt install -y cmake
sudo apt install -y doxygen
- name: Get Apt packages
run: >
sudo apt-get update -y &&
sudo apt-get install -y --no-install-recommends
vim
git
gcc-12
g++-12
build-essential
libboost-all-dev
cmake
unzip
tar
ca-certificates
doxygen
graphviz
python3-pip
- name: Conan installation
id: conan
uses: turtlebrowser/get-conan@main
with:
version: 1.60.1
run: pip install conan==2.0.13

- name: Conan version
run: echo "${{ steps.conan.outputs.version }}"

- name: Conan profile configuration
run: |
conan profile new quetzal-profile --detect --force
conan profile update settings.compiler="gcc" quetzal-profile
conan profile update settings.compiler.version=12 quetzal-profile
conan profile update settings.compiler.cppstd=20 quetzal-profile
conan profile update settings.compiler.libcxx="libstdc++11" quetzal-profile
conan profile update env.CC=[/usr/bin/gcc-12] quetzal-profile
conan profile update env.CXX=[/usr/bin/g++-12] quetzal-profile
# - name: Conan profile configuration
# run: |
# conan profile detect --name profile
# conan profile update settings.compiler="gcc" profile
# conan profile update settings.build_type="Release" profile
# conan profile update settings.compiler.version=12 profile
# conan profile update settings.compiler.cppstd=20 profile
# conan profile update settings.compiler.libcxx="libstdc++11" profile
# conan profile update env.CC=[/usr/bin/gcc-12] profile
# conan profile update env.CXX=[/usr/bin/g++-12] profile

- name: Conan install dependencies
run: >
conan install conanfile.py
--build=missing
--install-folder=build
-pr:b=quetzal-profile
-pr:h=quetzal-profile
conan install conanfile.py --profile:build=conan/profiles/linux-x86-gcc12-debug --profile:host=conan/profiles/linux-x86-gcc12-debug --build=missing --output-folder=build
- name: CMake configuration
run: >
Expand All @@ -74,7 +78,7 @@ jobs:
- name: CMake test
working-directory: ${{github.workspace}}/build
run: ctest -C ${{env.BUILD_TYPE}}
run: ctest -C ${{env.BUILD_TYPE}} --rerun-failed --output-on-failure

- name: Doxygen documentation generation
working-directory: ${{github.workspace}}/build
Expand Down
9 changes: 9 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"recommendations": [
"ms-vscode-remote.remote-containers",
"ms-vscode.cpptools-themes",
"ms-vscode.cpptools",
"ms-vscode.cpptools-extension-pack",
"twxs.cmake"
]
}
26 changes: 26 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Debugger settings: File used by Visual Studio Code to define debug configurations.
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch Main",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/main.out",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "Build Main"
}
]
}
82 changes: 82 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
// Workspace settings are stored in the workspace .vscode folder and only apply when the workspace is opened.
{
"cmake.configureOnOpen": false,
"files.associations": {
"cwchar": "cpp",
"string": "cpp",
"initializer_list": "cpp",
"iosfwd": "cpp",
"new": "cpp",
"type_traits": "cpp",
"utility": "cpp",
"cctype": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"csignal": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwctype": "cpp",
"any": "cpp",
"array": "cpp",
"atomic": "cpp",
"strstream": "cpp",
"bit": "cpp",
"*.tcc": "cpp",
"bitset": "cpp",
"chrono": "cpp",
"codecvt": "cpp",
"compare": "cpp",
"complex": "cpp",
"concepts": "cpp",
"condition_variable": "cpp",
"cstdint": "cpp",
"deque": "cpp",
"list": "cpp",
"map": "cpp",
"set": "cpp",
"unordered_map": "cpp",
"unordered_set": "cpp",
"vector": "cpp",
"exception": "cpp",
"algorithm": "cpp",
"functional": "cpp",
"iterator": "cpp",
"memory": "cpp",
"memory_resource": "cpp",
"numeric": "cpp",
"optional": "cpp",
"random": "cpp",
"ratio": "cpp",
"regex": "cpp",
"string_view": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"fstream": "cpp",
"future": "cpp",
"iomanip": "cpp",
"iostream": "cpp",
"istream": "cpp",
"limits": "cpp",
"mutex": "cpp",
"numbers": "cpp",
"ostream": "cpp",
"ranges": "cpp",
"semaphore": "cpp",
"span": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"stop_token": "cpp",
"streambuf": "cpp",
"thread": "cpp",
"cfenv": "cpp",
"cinttypes": "cpp",
"typeindex": "cpp",
"typeinfo": "cpp",
"valarray": "cpp",
"variant": "cpp"
}
}
Loading

0 comments on commit c20a083

Please sign in to comment.