-
Notifications
You must be signed in to change notification settings - Fork 0
152 lines (130 loc) · 4.53 KB
/
telemetry-firmware.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
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()