Skip to content

Commit b67946b

Browse files
committed
fix build pipeline
1 parent 6a5b2c8 commit b67946b

File tree

11 files changed

+278
-356
lines changed

11 files changed

+278
-356
lines changed

.github/workflows/documentation.yml

Lines changed: 57 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ permissions:
1313
contents: write
1414

1515
jobs:
16-
build_simulator:
17-
name: Build Simulator
16+
measure_heap:
17+
name: Heap measurements
1818
runs-on: ubuntu-latest
1919
steps:
2020
- uses: actions/checkout@v3
@@ -34,7 +34,7 @@ jobs:
3434
with:
3535
repository: matth-x/MicroOcppSimulator
3636
path: MicroOcppSimulator
37-
ref: 2cb07cdbe53954a694a29336ab31eac2d2b48673
37+
ref: 65b1c2e9c8a3f40907a823a0bc2f657423ebef65
3838
submodules: 'recursive'
3939
- name: Clean MicroOcpp submodule
4040
run: |
@@ -47,32 +47,8 @@ jobs:
4747
run: cmake -S ./MicroOcppSimulator -B ./MicroOcppSimulator/build -DCMAKE_CXX_FLAGS="-DMO_OVERRIDE_ALLOCATION=1 -DMO_ENABLE_HEAP_PROFILER=1"
4848
- name: Compile
4949
run: cmake --build ./MicroOcppSimulator/build -j 32 --target mo_simulator
50-
- name: Upload Simulator executable
51-
uses: actions/upload-artifact@v4
52-
with:
53-
name: Simulator executable
54-
path: |
55-
MicroOcppSimulator/build/mo_simulator
56-
MicroOcppSimulator/public/bundle.html.gz
57-
if-no-files-found: error
58-
retention-days: 1
59-
60-
measure_heap:
61-
needs: build_simulator
62-
name: Heap measurements
63-
runs-on: ubuntu-latest
64-
steps:
65-
- uses: actions/checkout@v3
66-
- uses: actions/setup-python@v4
67-
with:
68-
python-version: 3.x
6950
- name: Install Python dependencies
7051
run: pip install requests paramiko pandas
71-
- name: Get Simulator
72-
uses: actions/download-artifact@v4
73-
with:
74-
name: Simulator executable
75-
path: MicroOcppSimulator
7652
- name: Measure heap and create reports
7753
run: |
7854
mkdir -p docs/assets/tables
@@ -81,23 +57,25 @@ jobs:
8157
TEST_DRIVER_URL: ${{ secrets.TEST_DRIVER_URL }}
8258
TEST_DRIVER_CONFIG: ${{ secrets.TEST_DRIVER_CONFIG }}
8359
TEST_DRIVER_KEY: ${{ secrets.TEST_DRIVER_KEY }}
60+
TEST_DRIVER_CERT: ${{ secrets.TEST_DRIVER_CERT }}
8461
MO_SIM_CONFIG: ${{ secrets.MO_SIM_CONFIG }}
8562
MO_SIM_OCPP_SERVER: ${{ secrets.MO_SIM_OCPP_SERVER }}
86-
MO_SIM_API_CERT: ${{ secrets.MO_SIM_API_CERT }}
87-
MO_SIM_API_KEY: ${{ secrets.MO_SIM_API_KEY }}
88-
MO_SIM_API_CONFIG: ${{ secrets.MO_SIM_API_CONFIG }}
89-
SSH_LOCAL_PRIV: ${{ secrets.SSH_LOCAL_PRIV }}
90-
SSH_HOST_PUB: ${{ secrets.SSH_HOST_PUB }}
63+
MO_SIM_OCPP_CERT: ${{ secrets.MO_SIM_OCPP_CERT }}
64+
MO_SIM_RMT_CTRL_CONFIG: ${{ secrets.MO_SIM_RMT_CTRL_CONFIG }}
65+
MO_SIM_RMT_CTRL_CERT: ${{ secrets.MO_SIM_RMT_CTRL_CERT }}
9166
- name: Upload reports
9267
uses: actions/upload-artifact@v4
9368
with:
9469
name: Memory usage reports CSV
9570
path: docs/assets/tables
9671
if-no-files-found: error
9772

98-
build_firmware_size:
73+
build_firmware:
9974
name: Build firmware
10075
runs-on: ubuntu-latest
76+
strategy:
77+
matrix:
78+
part: [v16, v201, v16_v201]
10179
steps:
10280
- uses: actions/checkout@v3
10381
- name: Cache pip
@@ -119,35 +97,28 @@ jobs:
11997
python -m pip install --upgrade pip
12098
pip install --upgrade platformio
12199
- name: Run PlatformIO
122-
run: pio ci --lib="." --build-dir="${{ github.workspace }}/../build" --keep-build-dir --project-conf="./tests/benchmarks/firmware_size/platformio.ini" ./tests/benchmarks/firmware_size/main.cpp
123-
- name: Move firmware files # change path to location without parent dir ('..') statement (to make upload-artifact happy)
100+
run: pio ci --lib="." --build-dir="${{ github.workspace }}/../build" --keep-build-dir --project-conf="./tests/benchmarks/firmware_size/platformio.ini" -e ${{ matrix.part }} ./tests/benchmarks/firmware_size/main.cpp
101+
- name: Move firmware file # change path to location without parent dir ('..') statement (to make upload-artifact happy)
124102
run: |
125103
mkdir firmware
126-
mv "${{ github.workspace }}/../build/.pio/build/v16/firmware.elf" firmware/firmware_v16.elf
127-
mv "${{ github.workspace }}/../build/.pio/build/v201/firmware.elf" firmware/firmware_v201.elf
128-
- name: Upload firmware linker files
104+
mv "${{ github.workspace }}/../build/.pio/build/${{ matrix.part }}/firmware.elf" "firmware/firmware_${{ matrix.part }}.elf"
105+
- name: Upload firmware linker file
129106
uses: actions/upload-artifact@v4
130107
with:
131-
name: Firmware linker files
108+
name: Firmware linker file ${{ matrix.part }}
132109
path: firmware
133110
if-no-files-found: error
134111
retention-days: 1
135112

136-
evaluate_firmware:
137-
needs: build_firmware_size
138-
name: Static firmware analysis
113+
build_bloaty:
114+
name: Build Google bloaty
139115
runs-on: ubuntu-latest
140116
steps:
141117
- uses: actions/checkout@v3
142-
- uses: actions/setup-python@v4
143-
with:
144-
python-version: 3.x
145118
- uses: actions/cache@v2
146119
with:
147120
key: ${{ github.ref }}
148121
path: .cache
149-
- name: Install Python dependencies
150-
run: pip install pandas
151122
- name: Get build tools
152123
run: |
153124
sudo apt update
@@ -165,16 +136,53 @@ jobs:
165136
run: |
166137
cmake -B tools/bloaty/build -G Ninja -S tools/bloaty
167138
cmake --build tools/bloaty/build -j 32
168-
- name: Get firmware linker files
139+
- name: Upload bloaty executable
140+
uses: actions/upload-artifact@v4
141+
with:
142+
name: Google bloaty
143+
path: tools/bloaty/build/bloaty
144+
if-no-files-found: error
145+
retention-days: 1
146+
147+
evaluate_firmware:
148+
needs: [build_firmware, build_bloaty]
149+
name: Static firmware analysis
150+
steps:
151+
- uses: actions/checkout@v3
152+
- uses: actions/cache@v2
153+
with:
154+
key: ${{ github.ref }}
155+
path: .cache
156+
- name: Set up Python
157+
uses: actions/setup-python@v4
158+
- name: Install Python dependencies
159+
run: pip install pandas
160+
- name: Get firmware linker file
161+
uses: actions/download-artifact@v4
162+
with:
163+
name: Firmware linker file v16
164+
path: firmware
165+
- name: Get firmware linker file
166+
uses: actions/download-artifact@v4
167+
with:
168+
name: Firmware linker file v201
169+
path: firmware
170+
- name: Get firmware linker file
169171
uses: actions/download-artifact@v4
170172
with:
171-
name: Firmware linker files
173+
name: Firmware linker file v16_v201
172174
path: firmware
175+
- name: Get bloaty executable
176+
uses: actions/download-artifact@v4
177+
with:
178+
name: Google bloaty
179+
path: tools/bloaty/build/bloaty
173180
- name: Run bloaty
174181
run: |
175182
mkdir -p docs/assets/tables
176183
tools/bloaty/build/bloaty firmware/firmware_v16.elf -d compileunits --csv -n 0 > docs/assets/tables/bloaty_v16.csv
177184
tools/bloaty/build/bloaty firmware/firmware_v201.elf -d compileunits --csv -n 0 > docs/assets/tables/bloaty_v201.csv
185+
tools/bloaty/build/bloaty firmware/firmware_v16_v201.elf -d compileunits --csv -n 0 > docs/assets/tables/bloaty_v16_v201.csv
178186
- name: Evaluate and create reports
179187
run: python tests/benchmarks/scripts/eval_firmware_size.py
180188
- name: Upload reports

src/MicroOcpp.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,16 +186,12 @@ bool mo_beginTransaction_authorized2(MO_Context *ctx, unsigned int evseId, const
186186

187187
#if MO_ENABLE_V201
188188
//Same as mo_beginTransaction, but function name fits better for OCPP 2.0.1 and more options for 2.0.1.
189-
//Attempt to authorize a pending transaction, or create new transactino to authorize. If local
189+
//Attempt to authorize a pending transaction, or create new transaction to authorize. If local
190190
//authorization is enabled, will search the local whitelist if server response takes too long.
191191
//Backwards-compatible: if MO is initialized with 1.6, then this is the same as `mo_beginTransaction()`
192192
bool mo_authorizeTransaction(const char *idToken); //idTokenType ISO14443 is assumed
193193
bool mo_authorizeTransaction2(MO_Context *ctx, unsigned int evseId, const char *idToken, MO_IdTokenType type);
194194
bool mo_authorizeTransaction3(MO_Context *ctx, unsigned int evseId, const char *idToken, MO_IdTokenType type, bool validateIdToken, const char *groupIdToken);
195-
196-
//Same as `mo_beginAuthorization()`, but skip authorization. `groupIdToken` can be NULL
197-
bool mo_setTransactionAuthorized(const char *idToken, const char *groupIdToken); //idTokenType ISO14443 is assumed
198-
bool mo_setTransactionAuthorized2(MO_Context *ctx, unsigned int evseId, const char *idToken, MO_IdTokenType type, const char *groupIdToken);
199195
#endif //MO_ENABLE_V201
200196

201197
/*

src/MicroOcpp/Model/Diagnostics/DiagnosticsService.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,7 @@ MO_UploadLogStatus DiagnosticsService::getUploadStatus() {
509509
return status;
510510
}
511511

512+
#if MO_ENABLE_V16
512513
v16::DiagnosticsStatus DiagnosticsService::getUploadStatus16() {
513514

514515
MO_UploadLogStatus status = getUploadStatus();
@@ -535,6 +536,7 @@ v16::DiagnosticsStatus DiagnosticsService::getUploadStatus16() {
535536
}
536537
return res;
537538
}
539+
#endif //MO_ENABLE_V16
538540

539541
void DiagnosticsService::setDiagnosticsReader(size_t (*diagnosticsReader)(char *buf, size_t size, void *user_data), void(*onClose)(void *user_data), void *user_data) {
540542
this->diagnosticsReader = diagnosticsReader;

src/MicroOcpp/Model/RemoteControl/RemoteControlService.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#ifndef MO_REMOTECONTROLSERVICE_H
66
#define MO_REMOTECONTROLSERVICE_H
77

8+
#include <MicroOcpp/Core/Operation.h>
89
#include <MicroOcpp/Model/RemoteControl/RemoteControlDefs.h>
910
#include <MicroOcpp/Model/SmartCharging/SmartChargingModel.h>
1011
#include <MicroOcpp/Model/Transactions/Transaction.h>

src/MicroOcpp/Model/Reset/ResetService.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include <MicroOcpp/Model/Transactions/TransactionService201.h>
1616
#include <MicroOcpp/Debug.h>
1717

18-
#if MO_ENABLE_V16
18+
#if MO_ENABLE_V16 || MO_ENABLE_V201
1919

2020
#ifndef MO_RESET_DELAY
2121
#define MO_RESET_DELAY 10
@@ -38,6 +38,10 @@ void (*defaultExecuteResetImpl)() = nullptr;
3838

3939
#endif //MO_PLATFORM
4040

41+
#endif //MO_ENABLE_V16 || MO_ENABLE_V201
42+
43+
#if MO_ENABLE_V16
44+
4145
using namespace MicroOcpp;
4246

4347
v16::ResetService::ResetService(Context& context)

src/MicroOcpp/Model/SmartCharging/SmartChargingService.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ void SmartChargingServiceEvse::trackTransaction() {
232232
}
233233
} else {
234234
//check if transaction has just been completed
235-
if (trackTxRmtProfileId >= 0 || trackTxStart.isDefined() || trackTransactionId16 >= 0) {
235+
if (trackTxRmtProfileId >= 0 || trackTxStart.isDefined() || *trackTransactionId201) {
236236
//yes, clear data
237237
update = true;
238238
trackTxRmtProfileId = -1;

src/MicroOcpp/Model/Transactions/TransactionService16.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
#include <MicroOcpp/Core/Request.h>
2929
#include <MicroOcpp/Core/Connection.h>
3030

31+
#if MO_ENABLE_V16
32+
3133
#ifndef MO_TX_CLEAN_ABORTED
3234
#define MO_TX_CLEAN_ABORTED 1
3335
#endif
@@ -1499,3 +1501,5 @@ TransactionServiceEvse* TransactionService::getEvse(unsigned int evseId) {
14991501

15001502
return evses[evseId];
15011503
}
1504+
1505+
#endif //MO_ENABLE_V16

src/MicroOcpp/Operations/Heartbeat.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#if MO_ENABLE_V16 || MO_ENABLE_V201
1111

1212
using namespace MicroOcpp;
13-
using namespace MicroOcpp::v16;
1413

1514
Heartbeat::Heartbeat(Context& context) : MemoryManaged("v16.Operation.", "Heartbeat"), context(context) {
1615

0 commit comments

Comments
 (0)