-
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.
Importing the workflow scripts from the OBDH 2.0 repository. closes #59
- Loading branch information
Showing
3 changed files
with
168 additions
and
2 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,64 @@ | ||
# | ||
# static-analysis-workflow.yml | ||
# | ||
# Copyright (C) 2021, SpaceLab. | ||
# | ||
# This file is part of TTC 2.0. | ||
# | ||
# TTC 2.0 is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# TTC 2.0 is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with TTC 2.0. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
# | ||
|
||
|
||
name: Static Analysis | ||
|
||
on: | ||
push: | ||
branches: [ dev_firmware ] | ||
pull_request: | ||
branches: [ master, dev, dev_firmware] | ||
|
||
# 'workflow_dispatch' allows manual execution | ||
# of this workflow under the repository's 'Actions' tab | ||
workflow_dispatch: | ||
|
||
jobs: | ||
|
||
cppcheck-analysis: | ||
name: cppcheck-analysis | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
fail-fast: false | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Install CppCheck | ||
run: sudo apt install -y cppcheck | ||
|
||
- name: Execute CppCheck on tasks files | ||
run: cppcheck --std=c99 --force --error-exitcode=-1 --addon=misra.py firmware/app/tasks/ | ||
|
||
- name: Execute CppCheck on devices files | ||
run: cppcheck --std=c99 --error-exitcode=-1 --addon=misra.py firmware/devices/ | ||
|
||
- name: Execute CppCheck on drivers files | ||
run: cppcheck --std=c99 --error-exitcode=-1 --inline-suppr --addon=misra.py firmware/drivers/ | ||
|
||
- name: Execute CppCheck on system files | ||
run: cppcheck --std=c99 --error-exitcode=-1 --inline-suppr --addon=misra.py firmware/system/ | ||
|
||
- name: Execute CppCheck on main files | ||
run: cppcheck --std=c99 --error-exitcode=-1 --addon=misra.py firmware/main.c firmware/version.h |
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 |
---|---|---|
@@ -0,0 +1,102 @@ | ||
# | ||
# unit-tests-drivers.yml | ||
# | ||
# Copyright (C) 2021, SpaceLab. | ||
# | ||
# This file is part of TTC 2.0. | ||
# | ||
# TTC 2.0 is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# TTC 2.0 is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with TTC 2.0. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
# | ||
|
||
|
||
name: Drivers Unit Tests | ||
|
||
on: | ||
push: | ||
branches: [ dev_firmware ] | ||
pull_request: | ||
branches: [ master, dev, dev_firmware] | ||
|
||
# 'workflow_dispatch' allows manual execution | ||
# of this workflow under the repository's 'Actions' tab | ||
workflow_dispatch: | ||
|
||
jobs: | ||
|
||
# Generates Matrix | ||
# This job executes the 'deployJSON.py' script | ||
# which compiles a list of all files ending in '_test.c' | ||
# in a given directory and includes them in a .json file | ||
# along with the path to the executable file. | ||
generate-matrix: | ||
name: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
outputs: | ||
matrix: ${{ steps.set-matrix.outputs.matrix }} | ||
|
||
steps: | ||
# Checks-out the repository under $GITHUB_WORKSPACE, so the job can navigate it | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Create JSON file | ||
run: python3 .github/workflows/deployJSON.py --source firmware/tests/drivers/ | ||
|
||
- name: Resulting JSON file for matrix generation | ||
run: echo "$(cat .github/workflows/test-list.json)" | ||
|
||
# Set the matrix output from the JSON (manipulated to remove spaces and replace \n -> %0A, " -> \") | ||
- id: set-matrix | ||
name: Set matrix output from the JSON file | ||
run: echo "::set-output name=matrix::$( echo "$(cat .github/workflows/test-list.json)" | sed ':a;N;$!ba;s/\n/%0A/g' )" | ||
|
||
# This job reads the matrix containing the paths | ||
# created by the previous job and runs each program | ||
# individually, i.e. spawning one job for every | ||
# test file included in the matrix. | ||
run-tests: | ||
name: run-tests | ||
needs: generate-matrix | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
fail-fast: false | ||
|
||
matrix: ${{fromJson(needs.generate-matrix.outputs.matrix)}} | ||
|
||
|
||
env: | ||
MAKE_TARGET: ${{ matrix.name }} | ||
TEST_FILE: ${{ matrix.test_name }} | ||
TEST_PATH: ${{ matrix.path }} | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
# Install required libs | ||
- name: Install CMocka | ||
run: sudo apt-get install libcmocka0 libcmocka-dev | ||
|
||
- name: Signal make target | ||
run: echo "Generating make file for $MAKE_TARGET" | ||
|
||
- name: Generate Test File | ||
run: cd firmware/tests/drivers && make $MAKE_TARGET | ||
|
||
- name: Signal running test | ||
run: echo "Running $TEST_FILE" | ||
|
||
- name: Run test | ||
run: $TEST_PATH |