-
Notifications
You must be signed in to change notification settings - Fork 11
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 #2 from makers-for-life/enable-ci
Migrate GitHub actions from old repo
- Loading branch information
Showing
9 changed files
with
340 additions
and
26 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,22 @@ | ||
AccessModifierOffset: -3 | ||
AllowAllParametersOfDeclarationOnNextLine: true | ||
AllowShortIfStatementsOnASingleLine: false | ||
AlwaysBreakAfterDefinitionReturnType: None | ||
AlwaysBreakAfterReturnType: None | ||
AlwaysBreakTemplateDeclarations: true | ||
BinPackParameters: false | ||
BreakBeforeBinaryOperators: NonAssignment | ||
BreakBeforeBraces: Attach | ||
ColumnLimit: 100 | ||
CompactNamespaces: false | ||
ConstructorInitializerAllOnOneLineOrOnePerLine: true | ||
ConstructorInitializerIndentWidth: 4 | ||
IncludeBlocks: Preserve | ||
IndentWidth: 4 | ||
Language: Cpp | ||
MacroBlockBegin: "^MAPS_BEGIN_[A-Z]*_DEFINITION$" | ||
MacroBlockEnd: "^MAPS_END_[A-Z]*_DEFINITION$" | ||
PointerAlignment: Left | ||
SpacesInParentheses: false | ||
UseTab: Never | ||
SpacesBeforeTrailingComments: 2 |
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,31 @@ | ||
name: Firmware Documentation | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
build-and-deploy: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Create documentation directory | ||
run: | | ||
mkdir -p local/docs | ||
- name: Generate documentation for firmware | ||
uses: mattnotmitt/doxygen-action@v1 | ||
|
||
- name: Archive all documentation | ||
uses: actions/upload-artifact@v1 | ||
with: | ||
name: docs | ||
path: local/docs/ | ||
|
||
- name: Deploy all documentation | ||
uses: JamesIves/github-pages-deploy-action@releases/v3 | ||
if: github.ref == 'refs/heads/master' | ||
with: | ||
BRANCH: gh-pages | ||
FOLDER: local/docs/html/ | ||
TARGET_FOLDER: ./ |
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,34 @@ | ||
name: Firmware Lint | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
cpp-lint: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: action-cpp-lint | ||
uses: CyberZHG/[email protected] | ||
with: | ||
args: "--recursive ./" | ||
|
||
cppcheck: | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- name: install cppcheck | ||
run: | | ||
sed 's/bionic/focal/g' /etc/apt/sources.list | sudo tee /etc/apt/sources.list.d/focal.list | ||
sudo apt-get update | ||
echo "Package: cppcheck" | sudo tee /etc/apt/preferences.d/cppcheck | ||
echo "Pin: release n=focal" | sudo tee -a /etc/apt/preferences.d/cppcheck | ||
echo "Pin-Priority: 990" | sudo tee -a /etc/apt/preferences.d/cppcheck | ||
sudo apt-get install -y cppcheck | ||
- uses: actions/checkout@v2 | ||
- name: run cppcheck | ||
run: | | ||
cppcheck --version | ||
cppcheck --error-exitcode=1 --enable=all --inline-suppr -I ./includes ./srcs | ||
cppcheck --error-exitcode=1 --addon=cert --inline-suppr -I ./includes ./srcs | ||
cppcheck --error-exitcode=1 --addon=misra --inline-suppr --suppressions-list=./cppcheck/misra-suppr.txt -I ./includes ./srcs |
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,164 @@ | ||
name: Firmware Release | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Install Arduino CLI | ||
uses: arduino/[email protected] | ||
|
||
- name: Install STM libs | ||
run: | | ||
arduino-cli config init --additional-urls https://github.com/stm32duino/BoardManagerFiles/raw/master/STM32/package_stm_index.json | ||
arduino-cli config dump | ||
arduino-cli core update-index | ||
arduino-cli core install STM32:stm32 | ||
arduino-cli lib install LiquidCrystal | ||
arduino-cli lib install "Analog Buttons" | ||
arduino-cli lib install OneButton | ||
sed -i '/recipe.output.tmp_file={build.project_name}.hex/d' "$HOME/.arduino15/packages/STM32/hardware/stm32/1.8.0/platform.txt" | ||
sed -i '/recipe.output.save_file={build.project_name}.{build.variant}.hex/d' "$HOME/.arduino15/packages/STM32/hardware/stm32/1.8.0/platform.txt" | ||
- name: Get the version | ||
id: version | ||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | ||
run: | | ||
echo ::set-output name=version::${GITHUB_REF/refs\/tags\//} | ||
- name: Set VERSION variable | ||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') && steps.version.outputs.version != '' | ||
run: | | ||
sed -Ei "s/#define VERSION \".+\"/#define VERSION \"${{ steps.version.outputs.version }}\"/" includes/parameters.h | ||
- name: Build production HW2-FAULHABER | ||
run: | | ||
sed -Ei 's/#define HARDWARE_VERSION [0-9]+/#define HARDWARE_VERSION 2/' includes/config.h | ||
sed -Ei 's/#define MODE .+/#define MODE MODE_PROD/' includes/config.h | ||
sed -Ei 's/#define PNEUMATIC_HARDWARE_VERSION .+/#define PNEUMATIC_HARDWARE_VERSION PHW_FAULHABER/' includes/config.h | ||
sed -Ei 's/#define VALVE_TYPE .+/#define VALVE_TYPE VT_FAULHABER/' includes/config.h | ||
arduino-cli compile --fqbn STM32:stm32:Nucleo_64:opt=o3std,pnum=NUCLEO_F411RE --verbose srcs/respirator.cpp --output output/respirator-production | ||
mkdir -p dist/ | ||
VERSION=$(sed -En 's/#define VERSION[ ]+["](.+)["]/\1/p' includes/parameters.h) | ||
cp output/respirator-production.bin "dist/respirator-production-HW2-FAULHABER-$VERSION-$GITHUB_SHA.bin" | ||
- name: Build qualification HW2-FAULHABER | ||
run: | | ||
sed -Ei 's/#define HARDWARE_VERSION [0-9]+/#define HARDWARE_VERSION 2/' includes/config.h | ||
sed -Ei 's/#define MODE .+/#define MODE MODE_QUALIFICATION/' includes/config.h | ||
sed -Ei 's/#define PNEUMATIC_HARDWARE_VERSION .+/#define PNEUMATIC_HARDWARE_VERSION PHW_FAULHABER/' includes/config.h | ||
sed -Ei 's/#define VALVE_TYPE .+/#define VALVE_TYPE VT_FAULHABER/' includes/config.h | ||
arduino-cli compile --fqbn STM32:stm32:Nucleo_64:opt=o3std,pnum=NUCLEO_F411RE --verbose srcs/qualification.cpp --output output/respirator-qualification | ||
mkdir -p dist/ | ||
VERSION=$(sed -En 's/#define VERSION[ ]+["](.+)["]/\1/p' includes/parameters.h) | ||
cp output/respirator-qualification.bin "dist/respirator-qualification-HW2-FAULHABER-$VERSION-$GITHUB_SHA.bin" | ||
- name: Build integration test HW2-FAULHABER | ||
run: | | ||
sed -Ei 's/#define HARDWARE_VERSION [0-9]+/#define HARDWARE_VERSION 2/' includes/config.h | ||
sed -Ei 's/#define MODE .+/#define MODE MODE_INTEGRATION_TEST/' includes/config.h | ||
sed -Ei 's/#define PNEUMATIC_HARDWARE_VERSION .+/#define PNEUMATIC_HARDWARE_VERSION PHW_FAULHABER/' includes/config.h | ||
sed -Ei 's/#define VALVE_TYPE .+/#define VALVE_TYPE VT_FAULHABER/' includes/config.h | ||
arduino-cli compile --fqbn STM32:stm32:Nucleo_64:opt=o3std,pnum=NUCLEO_F411RE --verbose srcs/qualification.cpp --output output/respirator-integration-test | ||
mkdir -p dist/ | ||
VERSION=$(sed -En 's/#define VERSION[ ]+["](.+)["]/\1/p' includes/parameters.h) | ||
cp output/respirator-integration-test.bin "dist/respirator-integration-test-HW2-FAULHABER-$VERSION-$GITHUB_SHA.bin" | ||
- name: Build production HW2 | ||
run: | | ||
sed -Ei 's/#define HARDWARE_VERSION [0-9]+/#define HARDWARE_VERSION 2/' includes/config.h | ||
sed -Ei 's/#define MODE .+/#define MODE MODE_PROD/' includes/config.h | ||
sed -Ei 's/#define PNEUMATIC_HARDWARE_VERSION .+/#define PNEUMATIC_HARDWARE_VERSION PHW_CHU/' includes/config.h | ||
sed -Ei 's/#define VALVE_TYPE .+/#define VALVE_TYPE VT_SERVO_V1/' includes/config.h | ||
arduino-cli compile --fqbn STM32:stm32:Nucleo_64:opt=o3std,pnum=NUCLEO_F411RE --verbose srcs/respirator.cpp --output output/respirator-production | ||
mkdir -p dist/ | ||
VERSION=$(sed -En 's/#define VERSION[ ]+["](.+)["]/\1/p' includes/parameters.h) | ||
cp output/respirator-production.bin "dist/respirator-production-HW2-$VERSION-$GITHUB_SHA.bin" | ||
- name: Build qualification HW2 | ||
run: | | ||
sed -Ei 's/#define HARDWARE_VERSION [0-9]+/#define HARDWARE_VERSION 2/' includes/config.h | ||
sed -Ei 's/#define MODE .+/#define MODE MODE_QUALIFICATION/' includes/config.h | ||
sed -Ei 's/#define PNEUMATIC_HARDWARE_VERSION .+/#define PNEUMATIC_HARDWARE_VERSION PHW_CHU/' includes/config.h | ||
sed -Ei 's/#define VALVE_TYPE .+/#define VALVE_TYPE VT_SERVO_V1/' includes/config.h | ||
arduino-cli compile --fqbn STM32:stm32:Nucleo_64:opt=o3std,pnum=NUCLEO_F411RE --verbose srcs/qualification.cpp --output output/respirator-qualification | ||
mkdir -p dist/ | ||
VERSION=$(sed -En 's/#define VERSION[ ]+["](.+)["]/\1/p' includes/parameters.h) | ||
cp output/respirator-qualification.bin "dist/respirator-qualification-HW2-$VERSION-$GITHUB_SHA.bin" | ||
- name: Build integration test HW2 | ||
run: | | ||
sed -Ei 's/#define HARDWARE_VERSION [0-9]+/#define HARDWARE_VERSION 2/' includes/config.h | ||
sed -Ei 's/#define MODE .+/#define MODE MODE_INTEGRATION_TEST/' includes/config.h | ||
sed -Ei 's/#define PNEUMATIC_HARDWARE_VERSION .+/#define PNEUMATIC_HARDWARE_VERSION PHW_CHU/' includes/config.h | ||
sed -Ei 's/#define VALVE_TYPE .+/#define VALVE_TYPE VT_SERVO_V1/' includes/config.h | ||
arduino-cli compile --fqbn STM32:stm32:Nucleo_64:opt=o3std,pnum=NUCLEO_F411RE --verbose srcs/qualification.cpp --output output/respirator-integration-test | ||
mkdir -p dist/ | ||
VERSION=$(sed -En 's/#define VERSION[ ]+["](.+)["]/\1/p' includes/parameters.h) | ||
cp output/respirator-integration-test.bin "dist/respirator-integration-test-HW2-$VERSION-$GITHUB_SHA.bin" | ||
- name: Build production HW1 | ||
run: | | ||
sed -Ei 's/#define HARDWARE_VERSION [0-9]+/#define HARDWARE_VERSION 1/' includes/config.h | ||
sed -Ei 's/#define MODE .+/#define MODE MODE_PROD/' includes/config.h | ||
sed -Ei 's/#define PNEUMATIC_HARDWARE_VERSION .+/#define PNEUMATIC_HARDWARE_VERSION PHW_CHU/' includes/config.h | ||
sed -Ei 's/#define VALVE_TYPE .+/#define VALVE_TYPE VT_SERVO_V1/' includes/config.h | ||
arduino-cli compile --fqbn STM32:stm32:Nucleo_64:opt=o3std,pnum=NUCLEO_F411RE --verbose srcs/respirator.cpp --output output/respirator-production | ||
mkdir -p dist/ | ||
VERSION=$(sed -En 's/#define VERSION[ ]+["](.+)["]/\1/p' includes/parameters.h) | ||
cp output/respirator-production.bin "dist/respirator-production-HW1-$VERSION-$GITHUB_SHA.bin" | ||
- name: Build qualification HW1 | ||
run: | | ||
sed -Ei 's/#define HARDWARE_VERSION [0-9]+/#define HARDWARE_VERSION 1/' includes/config.h | ||
sed -Ei 's/#define MODE .+/#define MODE MODE_QUALIFICATION/' includes/config.h | ||
sed -Ei 's/#define PNEUMATIC_HARDWARE_VERSION .+/#define PNEUMATIC_HARDWARE_VERSION PHW_CHU/' includes/config.h | ||
sed -Ei 's/#define VALVE_TYPE .+/#define VALVE_TYPE VT_SERVO_V1/' includes/config.h | ||
arduino-cli compile --fqbn STM32:stm32:Nucleo_64:opt=o3std,pnum=NUCLEO_F411RE --verbose srcs/qualification.cpp --output output/respirator-qualification | ||
mkdir -p dist/ | ||
VERSION=$(sed -En 's/#define VERSION[ ]+["](.+)["]/\1/p' includes/parameters.h) | ||
cp output/respirator-qualification.bin "dist/respirator-qualification-HW1-$VERSION-$GITHUB_SHA.bin" | ||
- name: Build integration test HW1 | ||
run: | | ||
sed -Ei 's/#define HARDWARE_VERSION [0-9]+/#define HARDWARE_VERSION 1/' includes/config.h | ||
sed -Ei 's/#define MODE .+/#define MODE MODE_INTEGRATION_TEST/' includes/config.h | ||
sed -Ei 's/#define PNEUMATIC_HARDWARE_VERSION .+/#define PNEUMATIC_HARDWARE_VERSION PHW_CHU/' includes/config.h | ||
sed -Ei 's/#define VALVE_TYPE .+/#define VALVE_TYPE VT_SERVO_V1/' includes/config.h | ||
arduino-cli compile --fqbn STM32:stm32:Nucleo_64:opt=o3std,pnum=NUCLEO_F411RE --verbose srcs/qualification.cpp --output output/respirator-integration-test | ||
mkdir -p dist/ | ||
VERSION=$(sed -En 's/#define VERSION[ ]+["](.+)["]/\1/p' includes/parameters.h) | ||
cp output/respirator-integration-test.bin "dist/respirator-integration-test-HW1-$VERSION-$GITHUB_SHA.bin" | ||
- name: Archive binaries | ||
uses: actions/upload-artifact@v1 | ||
with: | ||
name: bin | ||
path: dist/ | ||
|
||
- name: Release dev binaries | ||
uses: softprops/action-gh-release@v1 | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | ||
with: | ||
files: | | ||
dist/*.bin | ||
body: | | ||
Auto-release (${{ github.sha }}) | ||
⚠️ FOR TEST PURPOSE ONLY - DO NOT USE IN PRODUCTION | ||
tag_name: auto-${{ github.run_id }} | ||
prerelease: true | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Release stable binaries | ||
uses: softprops/action-gh-release@v1 | ||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') && steps.version.outputs.version != '' | ||
with: | ||
files: | | ||
dist/*.bin | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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,32 @@ | ||
name: Firmware Unit Tests | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
test: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Install Google Test | ||
run: | | ||
export gtest_ver="1.10.0" | ||
# build and install Google Test | ||
wget https://github.com/google/googletest/archive/release-${gtest_ver}.tar.gz | ||
tar xf release-${gtest_ver}.tar.gz | ||
cd googletest-release-${gtest_ver} | ||
cmake . | ||
sudo cmake --build . --target install | ||
- name: Unit Test | ||
run: | | ||
cd $GITHUB_WORKSPACE | ||
# build unit test | ||
mkdir build_test | ||
cd build_test | ||
cmake $GITHUB_WORKSPACE/test/ | ||
cmake --build . | ||
# Run tests | ||
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,12 @@ | ||
/.pio/ | ||
/.vscode/ | ||
/local/ | ||
.DS_Store | ||
/output/* | ||
!/output/.gitkeep | ||
/*.csv | ||
/*.ods | ||
/*.csv# | ||
/*.ods# | ||
build/* | ||
.scannerwork |
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
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
// url inside comment | ||
misra-c2012-3.1:src/software/firmware/srcs/screen.cpp:1 | ||
misra-c2012-3.1:srcs/screen.cpp:1 | ||
|
||
// url inside comment | ||
misra-c2012-3.1:src/software/firmware/srcs/keyboard.cpp:1 | ||
misra-c2012-3.1:srcs/keyboard.cpp:1 |
Oops, something went wrong.