|
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 |
3 | 11 |
|
4 | 12 | jobs: |
5 | 13 | OBC_BUILD: |
6 | 14 | runs-on: ubuntu-latest |
7 | 15 | 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 |
84 | 88 |
|
85 | 89 | CRC: |
86 | 90 | needs: OBC_BUILD |
87 | 91 | runs-on: ubuntu-latest |
88 | 92 | 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 |
99 | 102 |
|
100 | 103 | OBC_HIL: |
101 | 104 | needs: OBC_BUILD |
102 | | - runs-on: self-hosted |
| 105 | + runs-on: [self-hosted, linux, arm64, pi, hil] |
103 | 106 |
|
104 | 107 | defaults: |
105 | 108 | run: |
106 | 109 | shell: bash |
107 | 110 |
|
108 | 111 | 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