|
1 | | -name: Production CI/CD Pipeline |
| 1 | +name: CI — eBoot |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
5 | | - branches: [ main ] |
| 5 | + branches: [main, develop] |
| 6 | + tags: ["v*"] |
6 | 7 | pull_request: |
7 | | - branches: [ main ] |
| 8 | + branches: [main] |
| 9 | + |
| 10 | +env: |
| 11 | + BUILD_TYPE: Release |
8 | 12 |
|
9 | 13 | jobs: |
10 | | - build-and-test: |
11 | | - runs-on: ubuntu-latest |
| 14 | + # ── Unit & Integration Tests ────────────────────────────────────────────── |
| 15 | + test: |
| 16 | + name: Build & Test (Linux x86_64) |
| 17 | + runs-on: ubuntu-22.04 |
| 18 | + steps: |
| 19 | + - uses: actions/checkout@v4 |
| 20 | + with: |
| 21 | + submodules: recursive |
| 22 | + |
| 23 | + - name: Install dependencies |
| 24 | + run: | |
| 25 | + sudo apt-get update -qq |
| 26 | + sudo apt-get install -y --no-install-recommends \ |
| 27 | + cmake ninja-build gcc-12 g++-12 \ |
| 28 | + gcc-arm-none-eabi binutils-arm-none-eabi \ |
| 29 | + lcov gcovr python3-pip |
| 30 | + pip3 install pytest pytest-cov |
| 31 | +
|
| 32 | + - name: Configure (host) |
| 33 | + run: | |
| 34 | + cmake -B build/host -G Ninja \ |
| 35 | + -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ |
| 36 | + -DCMAKE_C_COMPILER=gcc-12 \ |
| 37 | + -DCMAKE_CXX_COMPILER=g++-12 \ |
| 38 | + -DENABLE_COVERAGE=ON \ |
| 39 | + -DBUILD_TESTS=ON |
| 40 | +
|
| 41 | + - name: Build (host) |
| 42 | + run: cmake --build build/host --parallel $(nproc) |
| 43 | + |
| 44 | + - name: Run C unit tests |
| 45 | + run: | |
| 46 | + cd build/host |
| 47 | + ctest --output-on-failure --parallel $(nproc) |
| 48 | +
|
| 49 | + - name: Run Python tests |
| 50 | + run: | |
| 51 | + python3 -m pytest tests/ -v --tb=short \ |
| 52 | + --cov=. --cov-report=xml --cov-report=term-missing |
| 53 | + continue-on-error: false |
| 54 | + |
| 55 | + - name: Upload coverage |
| 56 | + uses: codecov/codecov-action@v4 |
| 57 | + with: |
| 58 | + files: coverage.xml |
| 59 | + flags: eboot |
| 60 | + |
| 61 | + # ── Cross-compile ARM Cortex-M4 ─────────────────────────────────────────── |
| 62 | + build-arm: |
| 63 | + name: Cross-compile ARM Cortex-M4 |
| 64 | + runs-on: ubuntu-22.04 |
| 65 | + needs: test |
12 | 66 | steps: |
13 | | - - uses: actions/checkout@v3 |
| 67 | + - uses: actions/checkout@v4 |
| 68 | + with: |
| 69 | + submodules: recursive |
| 70 | + |
| 71 | + - name: Install ARM toolchain |
| 72 | + run: | |
| 73 | + sudo apt-get update -qq |
| 74 | + sudo apt-get install -y gcc-arm-none-eabi binutils-arm-none-eabi cmake ninja-build |
| 75 | +
|
| 76 | + - name: Configure (ARM) |
| 77 | + run: | |
| 78 | + cmake -B build/arm -G Ninja \ |
| 79 | + -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ |
| 80 | + -DCMAKE_TOOLCHAIN_FILE=cmake/arm-cortex-m4.cmake \ |
| 81 | + -DBUILD_TESTS=OFF |
| 82 | +
|
| 83 | + - name: Build (ARM) |
| 84 | + run: cmake --build build/arm --parallel $(nproc) |
| 85 | + |
| 86 | + - name: List artifacts |
| 87 | + run: find build/arm -name "*.elf" -o -name "*.bin" -o -name "*.hex" | sort |
| 88 | + |
| 89 | + - name: Upload ARM artifacts |
| 90 | + uses: actions/upload-artifact@v4 |
| 91 | + with: |
| 92 | + name: eboot-arm-cortex-m4 |
| 93 | + path: | |
| 94 | + build/arm/**/*.elf |
| 95 | + build/arm/**/*.bin |
| 96 | + build/arm/**/*.hex |
| 97 | + retention-days: 90 |
| 98 | + |
| 99 | + # ── Static Analysis ─────────────────────────────────────────────────────── |
| 100 | + static-analysis: |
| 101 | + name: Static Analysis (cppcheck + clang-tidy) |
| 102 | + runs-on: ubuntu-22.04 |
| 103 | + steps: |
| 104 | + - uses: actions/checkout@v4 |
| 105 | + - name: Install tools |
| 106 | + run: sudo apt-get install -y cppcheck clang-tidy |
| 107 | + - name: cppcheck |
| 108 | + run: | |
| 109 | + cppcheck --enable=all --error-exitcode=1 \ |
| 110 | + --suppress=missingIncludeSystem \ |
| 111 | + --suppress=unusedFunction \ |
| 112 | + -I include/ src/ 2>&1 | tee cppcheck.log |
| 113 | + continue-on-error: true |
| 114 | + - name: Upload analysis report |
| 115 | + uses: actions/upload-artifact@v4 |
| 116 | + with: |
| 117 | + name: eboot-static-analysis |
| 118 | + path: cppcheck.log |
| 119 | + |
| 120 | + # ── Release ─────────────────────────────────────────────────────────────── |
| 121 | + release: |
| 122 | + name: Create GitHub Release |
| 123 | + runs-on: ubuntu-22.04 |
| 124 | + needs: [test, build-arm] |
| 125 | + if: startsWith(github.ref, 'refs/tags/v') |
| 126 | + steps: |
| 127 | + - uses: actions/checkout@v4 |
| 128 | + with: |
| 129 | + submodules: recursive |
| 130 | + |
| 131 | + - name: Install dependencies |
| 132 | + run: | |
| 133 | + sudo apt-get update -qq |
| 134 | + sudo apt-get install -y cmake ninja-build gcc-arm-none-eabi |
14 | 135 |
|
15 | | - - name: Set up Python |
16 | | - uses: actions/setup-python@v4 |
17 | | - with: |
18 | | - python-version: '3.11' |
| 136 | + - name: Build release artifacts |
| 137 | + run: | |
| 138 | + cmake -B build/release -G Ninja \ |
| 139 | + -DCMAKE_BUILD_TYPE=Release \ |
| 140 | + -DBUILD_TESTS=OFF |
| 141 | + cmake --build build/release --parallel $(nproc) |
19 | 142 |
|
20 | | - - name: Install Dependencies |
21 | | - run: | |
22 | | - python -m pip install --upgrade pip |
23 | | - pip install pytest pytest-cov requests matplotlib numpy |
| 143 | + - name: Package artifacts |
| 144 | + run: | |
| 145 | + mkdir -p dist |
| 146 | + find build/release -name "*.elf" -exec cp {} dist/ \; |
| 147 | + find build/release -name "*.bin" -exec cp {} dist/ \; |
| 148 | + tar czf eboot-${{ github.ref_name }}-linux-x86_64.tar.gz -C dist . |
24 | 149 |
|
25 | | - - name: Run Domain-Specific Test Suite |
26 | | - run: | |
27 | | - python run_all_tests.py |
| 150 | + - name: Create Release |
| 151 | + uses: softprops/action-gh-release@v2 |
| 152 | + with: |
| 153 | + files: | |
| 154 | + eboot-${{ github.ref_name }}-linux-x86_64.tar.gz |
| 155 | + generate_release_notes: true |
| 156 | + draft: false |
| 157 | + prerelease: false |
0 commit comments