add fault states #182
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
name: Telemetry Firmware | |
on: [push] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: 'recursive' | |
- uses: Solar-Gators/STM32-Infrastructure@main | |
with: | |
project-path: 'telemetry-firmware' | |
project-target: 'OpenTelemetry' | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: 'Telemetry Release Binary' | |
path: ./telemetry-firmware/Debug/*.elf | |
if-no-files-found: error | |
telemetry-collector-build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: 'true' | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build Docker Container | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
file: ./telemetry-collector/Dockerfile | |
push: true | |
tags: ghcr.io/solar-gators/telemetry-collector:latest | |
cache-from: | | |
ghcr.io/solar-gators/telemetry-collector:latest | |
build-args: BUILDKIT_INLINE_CACHE=1 | |
telemetry-collector-test: | |
defaults: | |
run: | |
working-directory: telemetry-collector | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: 'true' | |
- run: sudo apt-get -y install lcov | |
- run: make coverage | |
- run: pip install -r requirements.txt | |
- run: pip install -r ./tests/python/test-requirements.txt | |
- run: pytest ./tests/python/integration.py # python tests | |
- run: make test # cpp tests | |
- run: make coverage-html | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: coverage | |
path: coverage | |
integration-tests: | |
services: | |
mysql: | |
image: mysql:5.7 | |
env: | |
MYSQL_DATABASE: 'SolarGators_Telemetry_Dev' | |
MYSQL_USER: 'solargators' | |
MYSQL_PASSWORD: 'password' | |
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes' | |
ports: | |
- 3306:3306 | |
api: | |
image: ghcr.io/solar-gators/pit-gui-service:latest | |
ports: | |
- 9000:9000 | |
- 8000:8000/udp | |
env: | |
DATABASE_PASSWORD: 'password' | |
DATABASE_HOST: 'mysql' | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: telemetry-firmware | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: 'recursive' | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
- run: npm i pm2 -g | |
# build and start collector | |
- run: pip install -r ../telemetry-collector/requirements.txt | |
- run: pip install -r ../telemetry-collector/tests/python/test-requirements.txt | |
- run: cd ../telemetry-collector && make | |
- run: | | |
cd ../telemetry-collector && | |
pm2 start ecosystem.config.js --env ci | |
- name: Comment out files that renode doesn't mock properly | |
run: | | |
sed -i 's/SystemClock_Config();/\/\/SystemClock_Config();/' Core/Src/main.c && \ | |
sed -i 's/MX_CAN_Init();/\/\/MX_CAN_Init();/' Core/Src/main.c && \ | |
sed -i 's/osTimerStart(can_tx_timer_id, 2000);/\/\/osTimerStart(can_tx_timer_id, 2000);/' Core/Src/user.cpp | |
# Need to rebuild with modified code | |
- uses: Solar-Gators/STM32-Infrastructure@main | |
with: | |
project-path: 'telemetry-firmware' | |
project-target: 'OpenTelemetry' | |
- name: Install testing python packages | |
run: pip3 install -r tests/requirements.txt | |
- run: sudo chmod 777 ./Debug/OpenTelemetry.elf | |
- name: Install Renode | |
run: | | |
curl -L https://github.com/renode/renode/releases/download/v1.13.2/renode_1.13.2_amd64.deb --output renode_1.13.2_amd64.deb && \ | |
sudo apt-get install policykit-1 libgtk2.0-0 screen uml-utilities gtk-sharp2 libc6-dev gcc python3 python3-pip && \ | |
sudo apt install ./renode_1.13.2_amd64.deb && \ | |
pip install -r /opt/renode/tests/requirements.txt | |
- run: renode-test tests/*.robot | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: 'Reports' | |
path: | | |
./telemetry-firmware/*.html | |
./telemetry-firmware/*.xml | |
- run: docker logs "${{ job.services.api.id }}" | |
if: always() | |
- run: pm2 log --lines 500 --nostream | |
if: always() |