|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + repository_dispatch: |
| 5 | + types: [dependency-update] |
| 6 | + push: |
| 7 | + branches: [master] |
| 8 | + pull_request: |
| 9 | + branches: [master] |
| 10 | + |
| 11 | +permissions: |
| 12 | + contents: read |
| 13 | + |
| 14 | +env: |
| 15 | + PYTEST_VERSION: ">=7.0,<9.0" |
| 16 | + PYYAML_VERSION: ">=6.0,<7.0" |
| 17 | + CLICK_VERSION: ">=8.0,<9.0" |
| 18 | + |
| 19 | +jobs: |
| 20 | + # ──────────────────────────────────────────────────────────── |
| 21 | + # Unit tests — ebuild only, no sibling repos needed |
| 22 | + # ──────────────────────────────────────────────────────────── |
| 23 | + unit: |
| 24 | + name: Unit (${{ matrix.os }} / Python ${{ matrix.python }}) |
| 25 | + runs-on: ${{ matrix.os }} |
| 26 | + strategy: |
| 27 | + fail-fast: false |
| 28 | + matrix: |
| 29 | + os: [ubuntu-latest, windows-latest, macos-latest] |
| 30 | + python: ["3.11", "3.12"] |
| 31 | + steps: |
| 32 | + - uses: actions/checkout@v4 |
| 33 | + |
| 34 | + - uses: actions/setup-python@v5 |
| 35 | + with: |
| 36 | + python-version: ${{ matrix.python }} |
| 37 | + |
| 38 | + - name: Install dependencies |
| 39 | + run: pip install "pytest${{ env.PYTEST_VERSION }}" "pyyaml${{ env.PYYAML_VERSION }}" "click${{ env.CLICK_VERSION }}" |
| 40 | + |
| 41 | + - name: Run unit tests |
| 42 | + run: python -m pytest tests/test_eos_ai.py -v --tb=short --junitxml=results-unit.xml |
| 43 | + |
| 44 | + - name: Upload test results |
| 45 | + if: always() |
| 46 | + uses: actions/upload-artifact@v4 |
| 47 | + with: |
| 48 | + name: unit-results-${{ matrix.os }}-py${{ matrix.python }} |
| 49 | + path: results-unit.xml |
| 50 | + |
| 51 | + # ──────────────────────────────────────────────────────────── |
| 52 | + # Integration tests — checks out eos + eboot alongside ebuild |
| 53 | + # ──────────────────────────────────────────────────────────── |
| 54 | + integration: |
| 55 | + repository_dispatch: |
| 56 | + types: [dependency-update] |
| 57 | + name: Integration (${{ matrix.os }} / Python ${{ matrix.python }}) |
| 58 | + runs-on: ${{ matrix.os }} |
| 59 | + strategy: |
| 60 | + fail-fast: false |
| 61 | + matrix: |
| 62 | + os: [ubuntu-latest, windows-latest, macos-latest] |
| 63 | + python: ["3.11", "3.12"] |
| 64 | + steps: |
| 65 | + # Check out all three repos side-by-side: |
| 66 | + # workspace/ |
| 67 | + # ├── ebuild/ ← this repo |
| 68 | + # ├── eos/ ← sibling |
| 69 | + # └── eboot/ ← sibling |
| 70 | + - name: Checkout ebuild |
| 71 | + uses: actions/checkout@v4 |
| 72 | + with: |
| 73 | + path: ebuild |
| 74 | + |
| 75 | + - name: Checkout eos |
| 76 | + uses: actions/checkout@v4 |
| 77 | + with: |
| 78 | + repository: ${{ github.repository_owner }}/eos |
| 79 | + path: eos |
| 80 | + continue-on-error: true |
| 81 | + |
| 82 | + - name: Checkout eboot |
| 83 | + uses: actions/checkout@v4 |
| 84 | + with: |
| 85 | + repository: ${{ github.repository_owner }}/eboot |
| 86 | + path: eboot |
| 87 | + continue-on-error: true |
| 88 | + |
| 89 | + - uses: actions/setup-python@v5 |
| 90 | + with: |
| 91 | + python-version: ${{ matrix.python }} |
| 92 | + |
| 93 | + - name: Install dependencies |
| 94 | + run: pip install "pytest${{ env.PYTEST_VERSION }}" "pyyaml${{ env.PYYAML_VERSION }}" "click${{ env.CLICK_VERSION }}" |
| 95 | + |
| 96 | + - name: Verify sibling repos |
| 97 | + shell: bash |
| 98 | + run: | |
| 99 | + echo "── Repo layout ──" |
| 100 | + ls -d */ 2>/dev/null || echo "(no subdirectories found)" |
| 101 | + if [ ! -d "eos" ] || [ ! -d "eboot" ]; then |
| 102 | + echo "::warning::Sibling repos not available — integration tests will be skipped" |
| 103 | + fi |
| 104 | +
|
| 105 | + - name: Run integration tests |
| 106 | + if: hashFiles('eos/README.md') != '' && hashFiles('eboot/README.md') != '' |
| 107 | + working-directory: ebuild |
| 108 | + run: python -m pytest tests/test_cortex_r5_integration.py -v --tb=short --junitxml=results-integration.xml |
| 109 | + |
| 110 | + - name: Verify integration tests ran |
| 111 | + if: hashFiles('eos/README.md') != '' && hashFiles('eboot/README.md') != '' |
| 112 | + shell: bash |
| 113 | + working-directory: ebuild |
| 114 | + run: | |
| 115 | + if [ ! -f results-integration.xml ]; then |
| 116 | + echo "::error::Integration test results not found" |
| 117 | + exit 1 |
| 118 | + fi |
| 119 | + if grep -q 'tests="0"' results-integration.xml; then |
| 120 | + echo "::error::Integration tests collected 0 tests" |
| 121 | + exit 1 |
| 122 | + fi |
| 123 | +
|
| 124 | + - name: Upload test results |
| 125 | + if: always() |
| 126 | + uses: actions/upload-artifact@v4 |
| 127 | + with: |
| 128 | + name: integration-results-${{ matrix.os }}-py${{ matrix.python }} |
| 129 | + path: ebuild/results-integration.xml |
| 130 | + if-no-files-found: ignore |
| 131 | + |
| 132 | + # ──────────────────────────────────────────────────────────── |
| 133 | + # Full test suite — all tests via pytest discovery |
| 134 | + # ──────────────────────────────────────────────────────────── |
| 135 | + full-suite: |
| 136 | + name: Full Suite (Python ${{ matrix.python }}) |
| 137 | + runs-on: ubuntu-latest |
| 138 | + strategy: |
| 139 | + fail-fast: false |
| 140 | + matrix: |
| 141 | + python: ["3.11", "3.12"] |
| 142 | + steps: |
| 143 | + - name: Checkout ebuild |
| 144 | + uses: actions/checkout@v4 |
| 145 | + with: |
| 146 | + path: ebuild |
| 147 | + |
| 148 | + - name: Checkout eos |
| 149 | + uses: actions/checkout@v4 |
| 150 | + with: |
| 151 | + repository: ${{ github.repository_owner }}/eos |
| 152 | + path: eos |
| 153 | + continue-on-error: true |
| 154 | + |
| 155 | + - name: Checkout eboot |
| 156 | + uses: actions/checkout@v4 |
| 157 | + with: |
| 158 | + repository: ${{ github.repository_owner }}/eboot |
| 159 | + path: eboot |
| 160 | + continue-on-error: true |
| 161 | + |
| 162 | + - uses: actions/setup-python@v5 |
| 163 | + with: |
| 164 | + python-version: ${{ matrix.python }} |
| 165 | + |
| 166 | + - name: Install dependencies |
| 167 | + run: pip install "pytest${{ env.PYTEST_VERSION }}" pytest-cov "pyyaml${{ env.PYYAML_VERSION }}" "click${{ env.CLICK_VERSION }}" |
| 168 | + |
| 169 | + - name: Check sibling repos |
| 170 | + id: siblings |
| 171 | + shell: bash |
| 172 | + run: | |
| 173 | + if [ -d "eos" ] && [ -d "eboot" ]; then |
| 174 | + echo "available=true" >> $GITHUB_OUTPUT |
| 175 | + else |
| 176 | + echo "available=false" >> $GITHUB_OUTPUT |
| 177 | + echo "::warning::Sibling repos not available — running unit tests only" |
| 178 | + fi |
| 179 | +
|
| 180 | + - name: Run full test suite with coverage |
| 181 | + if: steps.siblings.outputs.available == 'true' |
| 182 | + working-directory: ebuild |
| 183 | + run: | |
| 184 | + python -m pytest tests/ \ |
| 185 | + -v --tb=short \ |
| 186 | + --junitxml=results-full.xml \ |
| 187 | + --cov=ebuild --cov-report=term-missing --cov-report=xml:coverage.xml |
| 188 | +
|
| 189 | + - name: Run unit tests only (no sibling repos) |
| 190 | + if: steps.siblings.outputs.available != 'true' |
| 191 | + working-directory: ebuild |
| 192 | + run: | |
| 193 | + python -m pytest tests/test_eos_ai.py \ |
| 194 | + -v --tb=short \ |
| 195 | + --junitxml=results-full.xml \ |
| 196 | + --cov=ebuild --cov-report=term-missing --cov-report=xml:coverage.xml |
| 197 | +
|
| 198 | + - name: Run standalone pipeline test |
| 199 | + working-directory: ebuild |
| 200 | + run: python test_full_pipeline.py |
| 201 | + |
| 202 | + - name: Verify generated files |
| 203 | + working-directory: ebuild |
| 204 | + run: | |
| 205 | + test -f _generated_test/board.yaml |
| 206 | + test -f _generated_test/boot.yaml |
| 207 | + test -f _generated_test/eos_product_config.h |
| 208 | + test -f _generated_test/eboot_flash_layout.h |
| 209 | +
|
| 210 | + - name: Upload test results |
| 211 | + if: always() |
| 212 | + uses: actions/upload-artifact@v4 |
| 213 | + with: |
| 214 | + name: full-results-py${{ matrix.python }} |
| 215 | + path: | |
| 216 | + ebuild/results-full.xml |
| 217 | + ebuild/coverage.xml |
| 218 | +
|
| 219 | + # ──────────────────────────────────────────────────────────── |
| 220 | + # Gate — single status check for branch protection |
| 221 | + # ──────────────────────────────────────────────────────────── |
| 222 | + ci-pass: |
| 223 | + name: CI Pass |
| 224 | + runs-on: ubuntu-latest |
| 225 | + needs: [unit, integration, full-suite] |
| 226 | + if: always() |
| 227 | + steps: |
| 228 | + - name: Check results |
| 229 | + env: |
| 230 | + UNIT_RESULT: ${{ needs.unit.result }} |
| 231 | + FULL_RESULT: ${{ needs.full-suite.result }} |
| 232 | + INTEG_RESULT: ${{ needs.integration.result }} |
| 233 | + run: | |
| 234 | + if [ "$UNIT_RESULT" != "success" ]; then |
| 235 | + echo "::error::Unit tests failed" |
| 236 | + exit 1 |
| 237 | + fi |
| 238 | + if [ "$FULL_RESULT" != "success" ]; then |
| 239 | + echo "::error::Full test suite failed" |
| 240 | + exit 1 |
| 241 | + fi |
| 242 | + if [ "$INTEG_RESULT" = "failure" ]; then |
| 243 | + echo "::warning::Integration tests failed — review results" |
| 244 | + fi |
| 245 | + echo "All required checks passed" |
0 commit comments