Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI and formatting #14

Merged
merged 4 commits into from
Dec 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
BasedOnStyle: Google
IndentWidth: 4
---
Language: Cpp
ColumnLimit: 100
PointerAlignment: Right
AlignAfterOpenBracket: Align
AlignConsecutiveMacros: true
AllowAllParametersOfDeclarationOnNextLine: false
SortIncludes: false
SpaceAfterCStyleCast: true
AllowShortCaseLabelsOnASingleLine: false
AllowAllArgumentsOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Never
AllowShortFunctionsOnASingleLine: None
BinPackArguments: false
BinPackParameters: false
---
26 changes: 26 additions & 0 deletions .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Compilation & tests

on: [push, pull_request]

jobs:
job_build_debug:
name: Build debug
runs-on: ubuntu-latest

container:
image: docker://ledgerhq/ledger-app-builder:1.6.1-2

steps:
- name: Clone
uses: actions/checkout@v2

- name: Build Stellar
run: |
make clean
make DEBUG=1

- name: Upload app binary
uses: actions/upload-artifact@v2
with:
name: stellar-app-debug
path: bin
19 changes: 19 additions & 0 deletions .github/workflows/lint-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Code style check

on: [push, pull_request]

jobs:
job_lint:
name: Lint
runs-on: ubuntu-latest

steps:
- name: Clone
uses: actions/checkout@v2

- name: Lint
uses: DoozyX/clang-format-lint-action@v0.11
with:
source: "./"
extensions: "h,c"
clangFormatVersion: 10
49 changes: 49 additions & 0 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"env": {
"BOLOS_SDK": "/opt/nanos-secure-sdk",
"BOLOS_ENV": "/opt/bolos-devenv"
},
"configurations": [
{
"name": "Nano S",
"includePath": [
"/usr/include",
"${workspaceFolder}/src",
"${env:BOLOS_SDK}/include/*",
"${env:BOLOS_SDK}/lib_ux/include/*"
],
"defines": [
"TARGET_NANOS",
"OS_IO_SEPROXYHAL",
"HAVE_BAGL",
"HAVE_SPRINTF",
"HAVE_IO_USB",
"HAVE_L4_USBLIB",
"IO_USB_MAX_ENDPOINTS=6",
"IO_HID_EP_LENGTH=64",
"HAVE_USB_APDU",
"USB_SEGMENT_SIZE=64",
"UNUSED(x)=(void)x",
"APPVERSION=\"1.0.0\"",
"APPNAME=\"Boilerplate\"",
"MAJOR_VERSION=1",
"MINOR_VERSION=0",
"PATCH_VERSION=0",
"IO_SEPROXYHAL_BUFFER_SIZE_B=128",
"HAVE_UX_FLOW",
"DEBUG=1",
"HAVE_PRINTF",
"PRINTF=screen_printf"
],
"compilerPath": "${env:BOLOS_ENV}/gcc-arm-none-eabi-5_3-2016q1/bin/arm-none-eabi-gcc",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "gcc-arm",
"browse": {
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
}
}
],
"version": 4
}
26 changes: 26 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "gdb",
"request": "attach",
"name": "Attach to gdbserver",
"executable": "${workspaceFolder}/bin/app.elf",
"target": ":1234",
"remote": true,
"cwd": "${workspaceFolder}",
"valuesFormatting": "parseText",
"gdbpath": "gdb-multiarch",
"autorun": [
"set architecture arm",
"handle SIGILL nostop pass noprint",
"add-symbol-file ${workspaceFolder}/bin/app.elf 0x40000000",
"b *0x40000000",
"c"
]
}
]
}
11 changes: 11 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"files.associations": {
"*.h": "c",
"vector": "c",
"memory": "c",
"thread": "c",
"string": "c"
},
"C_Cpp.clang_format_path": "/usr/bin/clang-format",
"editor.formatOnSave": true
}
111 changes: 111 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "make",
"type": "shell",
"command": "make clean && make",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [
"$gcc"
]
},
{
"label": "[debug] make",
"type": "shell",
"command": "make clean && make DEBUG=1",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [
"$gcc"
]
},
{
"label": "make clean",
"type": "shell",
"command": "make clean",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [
"$gcc"
]
},
{
"label": "make load",
"type": "shell",
"command": "make load",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [
"$gcc"
]
},
{
"label": "run unit tests",
"type": "shell",
"command": "cd unit-tests && rm -rf build && cmake -Bbuild -H. && make -C build && CTEST_OUTPUT_ON_FAILURE=1 make -C build test",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [
"$gcc"
]
},
{
"label": "run Speculos",
"type": "shell",
"command": "python /path/to/speculos/speculos.py ${workspaceFolder}/bin/app.elf --ontop --sdk 1.6 --apdu-port 9999 --button-port 42000 --automation-port 43000",
"group": {
"kind": "build",
"isDefault": true
},
"dependsOn": [
"make debug"
],
"problemMatcher": []
},
{
"label": "[debug] run Speculos",
"type": "shell",
"command": "python /path/to/speculos/speculos.py -d ${workspaceFolder}/bin/app.elf --ontop --sdk 1.6 --apdu-port 9999 --button-port 42000 --automation-port 43000",
"group": {
"kind": "build",
"isDefault": true
},
"dependsOn": [
"make debug"
],
"problemMatcher": []
},
{
"label": "run tests",
"type": "shell",
"command": "cd tests && pytest",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": []
},
{
"label": "kill Speculos",
"type": "shell",
"command": "pkill -f speculos.py",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": []
}
]
}
Loading