Skip to content

Commit 40f9ea3

Browse files
created a serial testing interface and updated .yml workflow
1 parent 2ad695e commit 40f9ea3

File tree

3 files changed

+225
-167
lines changed

3 files changed

+225
-167
lines changed

.github/workflows/hil_build.yml

Lines changed: 48 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,55 @@
1-
name: HIL Build
2-
on: [push, pull_request]
1+
name: HIL Build (Manual / Fallback)
2+
3+
on:
4+
workflow_dispatch:
5+
6+
concurrency:
7+
group: hil-manual
8+
cancel-in-progress: true
39

410
jobs:
5-
build-linux:
6-
runs-on: self-hosted
11+
hil-on-pi:
12+
runs-on: [self-hosted, linux, arm64, pi, hil]
713

814
defaults:
915
run:
1016
shell: bash
17+
1118
steps:
12-
- uses: actions/checkout@v3
13-
- name: Install Dependencies
14-
run: |
15-
sudo apt-get -y install python3-venv build-essential cmake
16-
python3 -m venv venv/
17-
source venv/bin/activate
18-
pip install --upgrade pip
19-
pip install -r requirements.txt
20-
pip install -e .
21-
22-
- name: Create Ground Station Binary Directory
23-
run: |
24-
mkdir build_gs
25-
cd build_gs
26-
cmake .. -DCMAKE_BUILD_TYPE=GS
27-
28-
- name: Build
29-
run: |
30-
cd build_gs
31-
cmake --build .
32-
33-
- name: Download binary wiht CRC
34-
uses: actions/download-artifact@v4
35-
with:
36-
name: launchpad-bin
37-
38-
- name: Run HIL
39-
run: |
40-
python3 hil/hil_main.py /dev/ttyACM0 OBC-firmware-crc.bin
19+
- uses: actions/checkout@v4
20+
21+
- name: Install deps on Pi
22+
run: |
23+
sudo apt-get update
24+
sudo apt-get -y install python3-venv build-essential cmake
25+
python3 -m venv .venv
26+
source .venv/bin/activate
27+
python3 -m pip install --upgrade pip
28+
python3 -m pip install -r requirements.txt || true
29+
python3 -m pip install -r obc/tools/python/requirements.txt || true
30+
python3 -m pip install -e .
31+
32+
- name: Build Ground Station (optional)
33+
run: |
34+
cmake -S . -B build_gs -DCMAKE_BUILD_TYPE=GS
35+
cmake --build build_gs -j
36+
37+
- name: Build OBC firmware (Rev1 with CRC)
38+
run: |
39+
cmake -S . -B build_arm -DCMAKE_BUILD_TYPE=OBC -DBOARD_TYPE=OBC_REVISION_1 -DDEBUG=0
40+
cmake --build build_arm -j
41+
test -f build_arm/OBC-firmware-crc.bin
42+
43+
- name: Flash & Run HIL (local build)
44+
env:
45+
PORT: /dev/serial0 # change if your UART device differs
46+
run: |
47+
source .venv/bin/activate
48+
python3 hil/hil_main.py "$PORT" "$(pwd)/build_arm/OBC-firmware-crc.bin"
49+
50+
- name: Upload HIL logs
51+
if: always()
52+
uses: actions/upload-artifact@v4
53+
with:
54+
name: hil-logs
55+
path: hil_logs/**

.github/workflows/obc_build.yml

Lines changed: 128 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -1,138 +1,147 @@
1-
name: OBC Build / HIL
2-
on: [push, pull_request]
1+
name: OBC Build + HIL (PR)
2+
3+
on:
4+
pull_request:
5+
branches: [ main ]
6+
workflow_dispatch:
7+
8+
concurrency:
9+
group: obc-hil-${{ github.ref }}
10+
cancel-in-progress: true
311

412
jobs:
513
OBC_BUILD:
614
runs-on: ubuntu-latest
715
steps:
8-
- uses: actions/checkout@v3
9-
10-
- name: Setup
11-
run: |
12-
sudo apt-get update
13-
sudo apt-get -y install build-essential cmake
14-
15-
- name: Install requirements
16-
run: |
17-
python3 -m pip install -r requirements.txt
18-
19-
- name: Create binary directory
20-
run: |
21-
mkdir build
22-
cd build
23-
export REPO_ROOT=$(git rev-parse --show-toplevel)
24-
25-
- name: Build (Release-Launchpad)
26-
run: |
27-
cd build
28-
cmake .. -DCMAKE_BUILD_TYPE=OBC -G"Unix Makefiles" -DBOARD_TYPE=RM46_LAUNCHPAD -DDEBUG=0
29-
make
30-
31-
- name: Upload CRC Binary (Release-Launchpad)
32-
uses: actions/upload-artifact@v4
33-
with:
34-
name: launchpad-bin
35-
path: build/OBC-firmware-crc.bin
36-
37-
- name: Build (Release-OBC Rev1)
38-
run: |
39-
cd build
40-
cmake .. -DCMAKE_BUILD_TYPE=OBC -G"Unix Makefiles" -DBOARD_TYPE=OBC_REVISION_1 -DDEBUG=0
41-
make
42-
43-
- name: Upload CRC Binary (Release-OBC Rev1)
44-
uses: actions/upload-artifact@v4
45-
with:
46-
name: rev1-bin
47-
path: build/OBC-firmware-crc.bin
48-
49-
- name: Build (Release-OBC Rev2)
50-
run: |
51-
cd build
52-
cmake .. -DCMAKE_BUILD_TYPE=OBC -G"Unix Makefiles" -DBOARD_TYPE=OBC_REVISION_2 -DDEBUG=0
53-
make
54-
55-
- name: Upload CRC Binary (Release-OBC Rev2)
56-
uses: actions/upload-artifact@v4
57-
with:
58-
name: rev2-bin
59-
path: build/OBC-firmware-crc.bin
60-
61-
- name: Build (Debug-Launchpad)
62-
run: |
63-
cd build
64-
cmake .. -DCMAKE_BUILD_TYPE=OBC -G"Unix Makefiles" -DBOARD_TYPE=RM46_LAUNCHPAD -DDEBUG=1
65-
make
66-
67-
- name: Build (Debug-OBC Rev1)
68-
run: |
69-
cd build
70-
cmake .. -DCMAKE_BUILD_TYPE=OBC -G"Unix Makefiles" -DBOARD_TYPE=OBC_REVISION_1 -DDEBUG=1
71-
make
72-
73-
- name: Build (Debug-OBC Rev2)
74-
run: |
75-
cd build
76-
cmake .. -DCMAKE_BUILD_TYPE=OBC -G"Unix Makefiles" -DBOARD_TYPE=OBC_REVISION_2 -DDEBUG=1
77-
make
78-
79-
- name: Upload binary
80-
uses: actions/upload-artifact@v4
81-
with:
82-
name: bin-file
83-
path: build/OBC-firmware.bin
16+
- uses: actions/checkout@v4
17+
18+
- name: Setup toolchain
19+
run: |
20+
sudo apt-get update
21+
sudo apt-get -y install build-essential cmake python3-venv
22+
23+
- name: Install Python reqs (project)
24+
run: |
25+
python3 -m pip install --upgrade pip
26+
# Install both if they exist; don't fail the build if one is missing
27+
python3 -m pip install -r requirements.txt || true
28+
python3 -m pip install -r obc/tools/python/requirements.txt || true
29+
30+
- name: Configure build directory
31+
run: |
32+
cmake -S . -B build -G "Unix Makefiles"
33+
34+
# --- Build all targets you already had ---
35+
36+
- name: Build (Release - Launchpad)
37+
run: |
38+
cmake --build build --clean-first -- -j
39+
cmake -S . -B build -DCMAKE_BUILD_TYPE=OBC -DBOARD_TYPE=RM46_LAUNCHPAD -DDEBUG=0
40+
cmake --build build -j
41+
- name: Upload CRC Binary (Release - Launchpad)
42+
uses: actions/upload-artifact@v4
43+
with:
44+
name: launchpad-bin
45+
path: build/OBC-firmware-crc.bin
46+
47+
- name: Build (Release - OBC Rev1)
48+
run: |
49+
cmake -S . -B build -DCMAKE_BUILD_TYPE=OBC -DBOARD_TYPE=OBC_REVISION_1 -DDEBUG=0
50+
cmake --build build -j
51+
test -f build/OBC-firmware-crc.bin
52+
- name: Upload CRC Binary (Release - OBC Rev1)
53+
uses: actions/upload-artifact@v4
54+
with:
55+
name: rev1-bin
56+
path: build/OBC-firmware-crc.bin
57+
58+
- name: Build (Release - OBC Rev2)
59+
run: |
60+
cmake -S . -B build -DCMAKE_BUILD_TYPE=OBC -DBOARD_TYPE=OBC_REVISION_2 -DDEBUG=0
61+
cmake --build build -j
62+
- name: Upload CRC Binary (Release - OBC Rev2)
63+
uses: actions/upload-artifact@v4
64+
with:
65+
name: rev2-bin
66+
path: build/OBC-firmware-crc.bin
67+
68+
- name: Build (Debug - Launchpad)
69+
run: |
70+
cmake -S . -B build -DCMAKE_BUILD_TYPE=OBC -DBOARD_TYPE=RM46_LAUNCHPAD -DDEBUG=1
71+
cmake --build build -j
72+
73+
- name: Build (Debug - OBC Rev1)
74+
run: |
75+
cmake -S . -B build -DCMAKE_BUILD_TYPE=OBC -DBOARD_TYPE=OBC_REVISION_1 -DDEBUG=1
76+
cmake --build build -j
77+
78+
- name: Build (Debug - OBC Rev2)
79+
run: |
80+
cmake -S . -B build -DCMAKE_BUILD_TYPE=OBC -DBOARD_TYPE=OBC_REVISION_2 -DDEBUG=1
81+
cmake --build build -j
82+
83+
- name: Upload raw binary (latest build dir)
84+
uses: actions/upload-artifact@v4
85+
with:
86+
name: bin-file
87+
path: build/OBC-firmware.bin
8488

8589
CRC:
8690
needs: OBC_BUILD
8791
runs-on: ubuntu-latest
8892
steps:
89-
- name: Download binary
90-
uses: actions/download-artifact@v4
91-
with:
92-
name: bin-file
93-
path: .
94-
95-
- name: Display CRC
96-
run: |
97-
echo "CRC checksum:"
98-
cksum OBC-firmware.bin
93+
- name: Download binary
94+
uses: actions/download-artifact@v4
95+
with:
96+
name: bin-file
97+
path: .
98+
- name: Display CRC
99+
run: |
100+
echo "CRC checksum:"
101+
cksum OBC-firmware.bin
99102
100103
OBC_HIL:
101104
needs: OBC_BUILD
102-
runs-on: self-hosted
105+
runs-on: [self-hosted, linux, arm64, pi, hil]
103106

104107
defaults:
105108
run:
106109
shell: bash
107110

108111
steps:
109-
- uses: actions/checkout@v3
110-
- name: Install Dependencies
111-
run: |
112-
sudo apt-get -y install python3-venv build-essential cmake
113-
python3 -m venv venv/
114-
source venv/bin/activate
115-
pip install --upgrade pip
116-
pip install -r requirements.txt
117-
pip install -e .
118-
119-
- name: Create Ground Station Binary Directory
120-
run: |
121-
mkdir build_gs
122-
cd build_gs
123-
cmake .. -DCMAKE_BUILD_TYPE=GS
124-
125-
- name: Build
126-
run: |
127-
cd build_gs
128-
cmake --build .
129-
130-
- name: Download binary wiht CRC
131-
uses: actions/download-artifact@v4
132-
with:
133-
name: launchpad-bin
134-
135-
- name: Run HIL
136-
run: |
137-
source venv/bin/activate
138-
python hil/hil_main.py /dev/ttyACM0 OBC-firmware-crc.bin
112+
- uses: actions/checkout@v4
113+
114+
- name: Prepare Python env on Pi
115+
run: |
116+
python3 -m venv .venv
117+
source .venv/bin/activate
118+
python3 -m pip install --upgrade pip
119+
python3 -m pip install -r requirements.txt || true
120+
python3 -m pip install -r obc/tools/python/requirements.txt || true
121+
python3 -m pip install -e .
122+
123+
- name: Build Ground Station (optional)
124+
run: |
125+
cmake -S . -B build_gs -DCMAKE_BUILD_TYPE=GS
126+
cmake --build build_gs -j
127+
128+
- name: Download firmware with CRC (Rev1)
129+
uses: actions/download-artifact@v4
130+
with:
131+
name: rev1-bin
132+
path: artifacts
133+
134+
- name: Flash & Run HIL
135+
env:
136+
PORT: /dev/ttyUSB0
137+
run: |
138+
source .venv/bin/activate
139+
ls -l artifacts
140+
python3 hil/hil_main.py "$PORT" "$(pwd)/artifacts/OBC-firmware-crc.bin"
141+
142+
- name: Upload HIL logs
143+
if: always()
144+
uses: actions/upload-artifact@v4
145+
with:
146+
name: hil-logs
147+
path: hil_logs/**

0 commit comments

Comments
 (0)