-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from SoftwareDefinedVehicle/main
Initial contribution
- Loading branch information
Showing
93 changed files
with
5,611 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,110 @@ | ||
BasedOnStyle: WebKit | ||
TabWidth: 4 | ||
IndentWidth: 4 | ||
UseTab: Never | ||
ColumnLimit: 100 | ||
|
||
--- | ||
Language: Cpp | ||
|
||
DisableFormat: false | ||
Standard: Cpp11 | ||
|
||
AccessModifierOffset: -4 | ||
AlignAfterOpenBracket: true | ||
AlignConsecutiveAssignments: true | ||
AlignConsecutiveDeclarations: true | ||
AlignEscapedNewlinesLeft: false | ||
AlignOperands: true | ||
AlignTrailingComments: false | ||
AllowAllParametersOfDeclarationOnNextLine: true | ||
AllowShortBlocksOnASingleLine: false | ||
AllowShortCaseLabelsOnASingleLine: false | ||
AllowShortFunctionsOnASingleLine: Empty | ||
AllowShortIfStatementsOnASingleLine: false | ||
AllowShortLoopsOnASingleLine: false | ||
AlwaysBreakAfterDefinitionReturnType: false | ||
AlwaysBreakAfterReturnType: None | ||
AlwaysBreakBeforeMultilineStrings: false | ||
AlwaysBreakTemplateDeclarations: true | ||
BinPackArguments: false | ||
BinPackParameters: false | ||
|
||
BreakBeforeBraces: Custom | ||
BraceWrapping: { | ||
AfterClass: 'false' | ||
AfterControlStatement: 'false' | ||
AfterEnum: 'false' | ||
AfterFunction: 'true' | ||
AfterNamespace: 'false' | ||
AfterStruct: 'false' | ||
AfterUnion: 'false' | ||
BeforeCatch: 'false' | ||
BeforeElse: 'false' | ||
IndentBraces: 'false' | ||
AfterExternBlock: 'false' | ||
SplitEmptyFunction: 'false' | ||
SplitEmptyRecord: 'false' | ||
SplitEmptyNamespace: 'true' | ||
} | ||
|
||
BreakAfterJavaFieldAnnotations: true | ||
BreakBeforeInheritanceComma: true | ||
BreakBeforeBinaryOperators: None | ||
BreakBeforeTernaryOperators: true | ||
BreakConstructorInitializersBeforeComma: true | ||
BreakInheritanceList: BeforeColon | ||
BreakStringLiterals: true | ||
|
||
CommentPragmas: '^ IWYU pragma:' | ||
CompactNamespaces: false | ||
ConstructorInitializerAllOnOneLineOrOnePerLine: false | ||
ConstructorInitializerIndentWidth: 4 | ||
ContinuationIndentWidth: 4 | ||
Cpp11BracedListStyle: true | ||
SpaceBeforeCpp11BracedList: false | ||
DerivePointerAlignment: false | ||
ExperimentalAutoDetectBinPacking: false | ||
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ] | ||
IndentCaseLabels: false | ||
FixNamespaceComments: true | ||
IndentWrappedFunctionNames: false | ||
KeepEmptyLinesAtTheStartOfBlocks: true | ||
MacroBlockBegin: '' | ||
MacroBlockEnd: '' | ||
JavaScriptQuotes: Double | ||
MaxEmptyLinesToKeep: 1 | ||
NamespaceIndentation: All | ||
ObjCBlockIndentWidth: 4 | ||
ObjCSpaceAfterProperty: true | ||
ObjCSpaceBeforeProtocolList: true | ||
PenaltyBreakBeforeFirstCallParameter: 19 | ||
PenaltyBreakComment: 300 | ||
PenaltyBreakFirstLessLess: 120 | ||
PenaltyBreakString: 1000 | ||
|
||
PenaltyExcessCharacter: 1000000 | ||
PenaltyReturnTypeOnItsOwnLine: 60 | ||
PointerAlignment: Left | ||
SpaceAfterCStyleCast: false | ||
SpaceBeforeAssignmentOperators: true | ||
SpaceBeforeParens: Never | ||
SpaceInEmptyParentheses: false | ||
SpacesBeforeTrailingComments: 1 | ||
SpacesInAngles: false | ||
SpacesInContainerLiterals: true | ||
SpacesInCStyleCastParentheses: false | ||
SpacesInParentheses: false | ||
SpacesInSquareBrackets: false | ||
SpaceAfterTemplateKeyword: true | ||
SpaceBeforeInheritanceColon: true | ||
|
||
SortUsingDeclarations: true | ||
SortIncludes: true | ||
|
||
ReflowComments: false | ||
|
||
UseCRLF: false | ||
|
||
IncludeBlocks: Preserve | ||
IndentPPDirectives: AfterHash |
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,17 @@ | ||
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.195.0/containers/cpp/.devcontainer/base.Dockerfile | ||
# [Choice] Debian / Ubuntu version (use Debian 11/9, Ubuntu 18.04/21.04 on local arm64/Apple Silicon): debian-11, debian-10, debian-9, ubuntu-21.04, ubuntu-20.04, ubuntu-18.04 | ||
ARG VARIANT="bullseye" | ||
FROM mcr.microsoft.com/vscode/devcontainers/cpp:0-${VARIANT} | ||
|
||
# ENV http_proxy "http://172.17.0.1:3128" | ||
# ENV https_proxy "http://172.17.0.1:3128" | ||
|
||
# Required packages. | ||
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ | ||
&& apt-get -y install python3-pip python3-setuptools python3-wheel ninja-build \ | ||
libblkid-dev libselinux-dev gcc-9-aarch64-linux-gnu g++-9-aarch64-linux-gnu \ | ||
mosquitto mosquitto-clients \ | ||
&& pip3 install meson | ||
|
||
# Optional packages. | ||
RUN apt-get -y install vim file iputils-ping |
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,42 @@ | ||
// For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at: | ||
// https://github.com/microsoft/vscode-dev-containers/tree/v0.195.0/containers/cpp | ||
{ | ||
"name": "SDV Self Update DevContainer", | ||
"build": { | ||
"dockerfile": "Dockerfile", | ||
// Update 'VARIANT' to pick an Debian / Ubuntu OS version: debian-11, debian-10, debian-9, ubuntu-21.04, ubuntu-20.04, ubuntu-18.04 | ||
// Use Debian 11, Debian 9, Ubuntu 18.04 or Ubuntu 21.04 on local arm64/Apple Silicon | ||
"args": { "VARIANT": "bullseye" } | ||
}, | ||
"runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined"], | ||
|
||
// Configure tool-specific properties. | ||
"customizations": { | ||
// Configure properties specific to VS Code. | ||
"vscode": { | ||
// Set *default* container specific settings.json values on container create. | ||
"settings": {}, | ||
|
||
// Add the IDs of extensions you want installed when the container is created. | ||
"extensions": [ | ||
"ms-vscode.cpptools", | ||
"ms-vscode.cmake-tools", | ||
"GitHub.copilot", | ||
"bierner.markdown-mermaid" | ||
] | ||
} | ||
}, | ||
|
||
// 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", | ||
|
||
// Comment out this line to run as root instead. | ||
"remoteUser": "vscode", | ||
"features": { | ||
"docker-in-docker": "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,58 @@ | ||
#!/usr/bin/env bash | ||
#------------------------------------------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information. | ||
#------------------------------------------------------------------------------------------------------------- | ||
# | ||
set -e | ||
|
||
CMAKE_VERSION=${1:-"none"} | ||
|
||
if [ "${CMAKE_VERSION}" = "none" ]; then | ||
echo "No CMake version specified, skipping CMake reinstallation" | ||
exit 0 | ||
fi | ||
|
||
# Cleanup temporary directory and associated files when exiting the script. | ||
cleanup() { | ||
EXIT_CODE=$? | ||
set +e | ||
if [[ -n "${TMP_DIR}" ]]; then | ||
echo "Executing cleanup of tmp files" | ||
rm -Rf "${TMP_DIR}" | ||
fi | ||
exit $EXIT_CODE | ||
} | ||
trap cleanup EXIT | ||
|
||
|
||
echo "Installing CMake..." | ||
apt-get -y purge --auto-remove cmake | ||
mkdir -p /opt/cmake | ||
|
||
architecture=$(dpkg --print-architecture) | ||
case "${architecture}" in | ||
arm64) | ||
ARCH=aarch64 ;; | ||
amd64) | ||
ARCH=x86_64 ;; | ||
*) | ||
echo "Unsupported architecture ${architecture}." | ||
exit 1 | ||
;; | ||
esac | ||
|
||
CMAKE_BINARY_NAME="cmake-${CMAKE_VERSION}-linux-${ARCH}.sh" | ||
CMAKE_CHECKSUM_NAME="cmake-${CMAKE_VERSION}-SHA-256.txt" | ||
TMP_DIR=$(mktemp -d -t cmake-XXXXXXXXXX) | ||
|
||
echo "${TMP_DIR}" | ||
cd "${TMP_DIR}" | ||
|
||
curl -sSL "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/${CMAKE_BINARY_NAME}" -O | ||
curl -sSL "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/${CMAKE_CHECKSUM_NAME}" -O | ||
|
||
sha256sum -c --ignore-missing "${CMAKE_CHECKSUM_NAME}" | ||
sh "${TMP_DIR}/${CMAKE_BINARY_NAME}" --prefix=/opt/cmake --skip-license | ||
|
||
ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake |
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,101 @@ | ||
name: Build and Push SUA docker image | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
workflow_dispatch: | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: sua | ||
|
||
jobs: | ||
|
||
build: | ||
strategy: | ||
matrix: | ||
architecture: [ arm64, amd64 ] | ||
|
||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
id-token: write | ||
|
||
steps: | ||
- id: repo_name | ||
uses: ASzc/change-string-case-action@v1 | ||
with: | ||
string: ${{ github.repository }} | ||
- name: Find latest tag | ||
uses: oprypin/find-latest-tag@v1 | ||
with: | ||
repository: ${{ github.repository }} | ||
releases-only: false | ||
id: build_tag | ||
- run: echo "repo is at version ${{ steps.build_tag.outputs.tag }}" | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: true | ||
|
||
# Workaround: https://github.com/docker/build-push-action/issues/461 | ||
- name: Setup Docker buildx | ||
uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf | ||
|
||
# Login against a Docker registry except on PR | ||
# https://github.com/docker/login-action | ||
- name: Log into registry ${{ env.REGISTRY }} | ||
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# Extract metadata (tags, labels) for Docker | ||
# https://github.com/docker/metadata-action | ||
- name: Extract Docker metadata | ||
id: meta | ||
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
|
||
# https://github.com/docker/build-push-action | ||
- name: Build and push Docker image to ghcr.io | ||
id: build-and-push | ||
uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a | ||
with: | ||
push: true | ||
context: . | ||
platforms: linux/${{ matrix.architecture }} | ||
file: Dockerfile.${{ matrix.architecture }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
tags: | | ||
${{ env.REGISTRY }}/${{ steps.repo_name.outputs.lowercase }}/${{ env.IMAGE_NAME }}:testing_${{ matrix.architecture}} | ||
create-multiarch-image: | ||
runs-on: ubuntu-latest | ||
name: Create multiarch image | ||
needs: [build] | ||
|
||
steps: | ||
- id: repo_name | ||
uses: ASzc/change-string-case-action@v1 | ||
with: | ||
string: ${{ github.repository }} | ||
|
||
- name: Log into registry ${{ env.REGISTRY }} | ||
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Create merged manifest and push | ||
env: | ||
REPO: ghcr.io/SoftwareDefinedVehicle/leda-contrib-self-update-agent-fork | ||
run: | | ||
docker buildx imagetools create -t ${{ env.REGISTRY }}/${{ steps.repo_name.outputs.lowercase }}/${{ env.IMAGE_NAME }}:testing ${{ env.REGISTRY }}/${{ steps.repo_name.outputs.lowercase }}/${{ env.IMAGE_NAME }}:testing_arm64 ${{ env.REGISTRY }}/${{ steps.repo_name.outputs.lowercase }}/${{ env.IMAGE_NAME }}:testing_amd64 | ||
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,65 @@ | ||
name: CMake native build and unit tests | ||
|
||
on: | ||
push: | ||
pull_request: | ||
branches: [ main ] | ||
|
||
env: | ||
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | ||
BUILD_TYPE: Release | ||
|
||
jobs: | ||
build_for_architecture: | ||
strategy: | ||
matrix: | ||
arch: [amd64, arm64] | ||
runs-on: [ ubuntu-latest ] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: recursive | ||
|
||
# Remove apt repos that are known to break from time to time | ||
# See https://github.com/actions/virtual-environments/issues/323 | ||
- name: Remove broken apt repos [Ubuntu] | ||
run: | | ||
for apt_file in `grep -lr microsoft /etc/apt/sources.list.d/`; do sudo rm $apt_file; done | ||
- name: Install tools | ||
run: | | ||
sudo apt-get install apt-transport-https --yes | ||
sudo apt-get -y update | ||
sudo apt-get -y upgrade | ||
sudo apt-get -y install autoconf binutils cmake file \ | ||
gcc g++ git libtool make \ | ||
build-essential libcurl4-openssl-dev \ | ||
binutils-aarch64-linux-gnu gcc-9-aarch64-linux-gnu g++-9-aarch64-linux-gnu \ | ||
python3 python3-pip python3-setuptools python3-wheel ninja-build python3-pip \ | ||
libselinux1-dev libmount-dev libmount1 libblkid-dev | ||
pip3 install meson | ||
- name: Configure CMake | ||
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} | ||
|
||
- name: Build for ${{ matrix.arch }} | ||
run: | | ||
mkdir build_${{ matrix.arch }} | ||
ln -s build_${{ matrix.arch }} build | ||
./scripts/build_openssl_${{ matrix.arch }}.sh | ||
./scripts/build_glib_${{ matrix.arch }}.sh | ||
cd build_${{ matrix.arch }} | ||
cmake -DCMAKE_INSTALL_PREFIX=../dist_${{ matrix.arch }} -DCMAKE_TOOLCHAIN_FILE=../cmake/linux/${{ matrix.arch }}/toolchain.cmake -DOPENSSL_ROOT_DIR=../build_${{ matrix.arch }} -DOPENSSL_CRYPTO_LIBRARY=../build_${{ matrix.arch }}/lib/libcrypto.so .. | ||
make | ||
- name: Run unit tests | ||
# execute tests only for the x86, as for arm the running on qemu would be required | ||
if: ${{ matrix.arch=='amd64' }} | ||
run: | | ||
LD_LIBRARY_PATH=./build_${{ matrix.arch }}/lib:./build_${{ matrix.arch }}/3rdparty ./build_${{ matrix.arch }}/utest/TestSDVSelfUpdateAgent | ||
- name: Upload ${{ matrix.arch }} artifact to workspace | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: sdv-self-update-agent_${{ matrix.arch }} | ||
path: ${{github.workspace}}/build_${{ matrix.arch }}/src/sdv-self-update-agent |
Oops, something went wrong.