|
| 1 | +# GitHub Actions CI/CD |
| 2 | + |
| 3 | +This directory contains GitHub Actions workflows for automated building and testing of DB48X/DB50X. |
| 4 | + |
| 5 | +## Workflows |
| 6 | + |
| 7 | +### build.yml |
| 8 | + |
| 9 | +Main build workflow that runs on every push and pull request to main/master/develop branches. |
| 10 | + |
| 11 | +#### Jobs |
| 12 | + |
| 13 | +**Simulator Builds (db48x):** |
| 14 | + |
| 15 | +1. **build-simulator-macos** - Builds the macOS simulator |
| 16 | + - Platform: macOS (latest) |
| 17 | + - Requirements: Qt 6.8.1 |
| 18 | + - Target: `make sim` |
| 19 | + - Build ID: Uses GitHub Actions run number |
| 20 | + - Artifacts: `db48x.app`, help files |
| 21 | + |
| 22 | +2. **build-simulator-linux** - Builds the Linux simulator |
| 23 | + - Platform: Ubuntu Linux (latest) |
| 24 | + - Requirements: Qt 6.5.3 LTS, libxcb-cursor0, libgl1-mesa-dev, libxkbcommon-x11-0, libfreetype6-dev, pkg-config |
| 25 | + - Target: `make sim` |
| 26 | + - Build ID: Uses GitHub Actions run number |
| 27 | + - Artifacts: `db48x` binary, help files |
| 28 | + |
| 29 | +3. **build-simulator-windows** - Builds the Windows simulator |
| 30 | + - Platform: Windows (latest) |
| 31 | + - Requirements: Qt 6.7.3 (includes MinGW 9.0) |
| 32 | + - Target: `mingw32-make sim` |
| 33 | + - Build ID: Uses GitHub Actions run number |
| 34 | + - Artifacts: `db48x.exe`, DLLs, help files |
| 35 | + |
| 36 | +**Color DM32 Simulator Builds (db50x):** |
| 37 | + |
| 38 | +4. **build-color-simulator-macos** - Builds the color DM32 simulator for macOS |
| 39 | + - Platform: macOS (latest) |
| 40 | + - Requirements: Qt 6.8.1 |
| 41 | + - Target: `make color-dm32-sim` |
| 42 | + - Build ID: Uses GitHub Actions run number |
| 43 | + - Artifacts: `db50x.app`, help files |
| 44 | + |
| 45 | +5. **build-color-simulator-linux** - Builds the color DM32 simulator for Linux |
| 46 | + - Platform: Ubuntu Linux (latest) |
| 47 | + - Requirements: Qt 6.5.3 LTS, libxcb-cursor0, libgl1-mesa-dev, libxkbcommon-x11-0, libfreetype6-dev, pkg-config |
| 48 | + - Target: `make color-dm32-sim` |
| 49 | + - Build ID: Uses GitHub Actions run number |
| 50 | + - Artifacts: `db50x` binary, help files |
| 51 | + |
| 52 | +6. **build-color-simulator-windows** - Builds the color DM32 simulator for Windows |
| 53 | + - Platform: Windows (latest) |
| 54 | + - Requirements: Qt 6.7.3 (includes MinGW 9.0) |
| 55 | + - Target: `mingw32-make color-dm32-sim` |
| 56 | + - Build ID: Uses GitHub Actions run number |
| 57 | + - Artifacts: `db50x.exe`, DLLs, help files |
| 58 | + |
| 59 | +**Other Builds:** |
| 60 | + |
| 61 | +7. **build-wasm** - Builds WebAssembly version |
| 62 | + - Platform: Ubuntu Linux (latest) |
| 63 | + - Requirements: Emscripten SDK (emsdk), libfreetype6-dev, pkg-config |
| 64 | + - Target: `make wasm` |
| 65 | + - Build ID: Uses GitHub Actions run number |
| 66 | + - Artifacts: `db48x.js`, `db48x.wasm`, HTML files, help files |
| 67 | + |
| 68 | +8. **build-dm42-firmware** - Builds DM42 firmware |
| 69 | + - Platform: Ubuntu Linux (latest) |
| 70 | + - Requirements: ARM GCC toolchain (gcc-arm-none-eabi), libfreetype6-dev, pkg-config |
| 71 | + - Target: `make all` (runs twice for CRC verification) |
| 72 | + - Build ID: Uses GitHub Actions run number |
| 73 | + - Artifacts: `db48x.pgm`, `db48x_qspi.bin`, help files |
| 74 | + |
| 75 | +9. **build-dm32-firmware** - Builds DM32 firmware |
| 76 | + - Platform: Ubuntu Linux (latest) |
| 77 | + - Requirements: ARM GCC toolchain (gcc-arm-none-eabi), libfreetype6-dev, pkg-config |
| 78 | + - Target: `make dm32-all` (runs twice for CRC verification) |
| 79 | + - Build ID: Uses GitHub Actions run number |
| 80 | + - Artifacts: `db50x.pg5`, `db50x_qspi.bin`, help files |
| 81 | + |
| 82 | +10. **build-release-package** - Creates release packages |
| 83 | + - Runs only on pushes to main/master |
| 84 | + - Depends on all other build jobs |
| 85 | + - Creates `.tar.gz` archives of firmware builds |
| 86 | + |
| 87 | +## Artifacts |
| 88 | + |
| 89 | +Build artifacts are automatically uploaded and can be downloaded from the Actions tab in GitHub: |
| 90 | + |
| 91 | +- **macOS simulators**: `.app` bundles ready to run |
| 92 | +- **Linux simulators**: Native binaries |
| 93 | +- **Windows simulators**: `.exe` executables with required DLLs |
| 94 | +- **WASM builds**: `.js`, `.wasm`, and HTML files for web deployment |
| 95 | +- **Firmware builds**: `.pgm`/`.pg5` and `_qspi.bin` files |
| 96 | +- **Help files**: `.md` and `.idx` included with all builds |
| 97 | + |
| 98 | +## Manual Triggering |
| 99 | + |
| 100 | +All workflows can be manually triggered using the "workflow_dispatch" event from the Actions tab in GitHub. |
| 101 | + |
| 102 | +## Local Testing |
| 103 | + |
| 104 | +To test builds locally before pushing: |
| 105 | + |
| 106 | +```bash |
| 107 | +# Simulator (requires Qt 6.8.1) |
| 108 | +make sim |
| 109 | + |
| 110 | +# Color DM32 simulator (requires Qt 6.8.1) |
| 111 | +make color-dm32-sim |
| 112 | + |
| 113 | +# WASM build (requires Emscripten SDK) |
| 114 | +make wasm |
| 115 | + |
| 116 | +# DM42 firmware (requires ARM toolchain) |
| 117 | +make all |
| 118 | + |
| 119 | +# DM32 firmware (requires ARM toolchain) |
| 120 | +make dm32-all |
| 121 | +``` |
| 122 | + |
| 123 | +## Requirements |
| 124 | + |
| 125 | +### For macOS simulator builds: |
| 126 | +- Qt 6.8.1 with qtmultimedia module |
| 127 | +- Xcode command line tools |
| 128 | + |
| 129 | +### For Linux simulator builds: |
| 130 | +- Qt 6.5.3 LTS with qtmultimedia module |
| 131 | +- libxcb-cursor0 |
| 132 | +- libgl1-mesa-dev |
| 133 | +- libxkbcommon-x11-0 |
| 134 | +- libfreetype6-dev |
| 135 | +- pkg-config |
| 136 | + |
| 137 | +### For Windows simulator builds: |
| 138 | +- Qt 6.7.3 with qtmultimedia module (MinGW build, includes MinGW 9.0 toolchain) |
| 139 | + |
| 140 | +### For WASM builds: |
| 141 | +- Emscripten SDK (emsdk) |
| 142 | +- libfreetype6-dev (FreeType font library) |
| 143 | +- pkg-config |
| 144 | + |
| 145 | +### For firmware builds: |
| 146 | +- gcc-arm-none-eabi |
| 147 | +- binutils-arm-none-eabi |
| 148 | +- libfreetype6-dev |
| 149 | +- pkg-config |
| 150 | + |
| 151 | +## Troubleshooting |
| 152 | + |
| 153 | +### Common Build Issues |
| 154 | + |
| 155 | +**Qt version compatibility:** |
| 156 | +- Linux builds use Qt 6.5.3 LTS (6.8.1 not available for `gcc_64`) |
| 157 | +- Windows builds use Qt 6.7.3 with bundled MinGW 9.0 (switched from MSVC due to preprocessor directive incompatibilities) |
| 158 | +- macOS builds use Qt 6.8.1 |
| 159 | +- Note: Qt's `win64_mingw` package includes its own MinGW toolchain; no separate MinGW installation needed |
| 160 | + |
| 161 | +**FreeType dependency:** |
| 162 | +- All builds that use fonts (WASM, simulators, firmware) require `libfreetype6-dev` and `pkg-config` |
| 163 | +- Install with: `sudo apt-get install -y libfreetype6-dev pkg-config` |
| 164 | + |
| 165 | +**WASM shell issues:** |
| 166 | +- The `source` command requires bash, not dash (Ubuntu's default `/bin/sh`) |
| 167 | +- Fix: Use `shell: bash` in workflow and `SHELL=/bin/bash` for make |
| 168 | + |
| 169 | +**Firmware CRC re-builds:** |
| 170 | +- First build may fail CRC check, requiring a second build |
| 171 | +- This is expected behavior |
| 172 | +- Fix: Use `make all || make all` to automatically retry |
| 173 | + |
| 174 | +**Build tool compilation:** |
| 175 | +- Build tools (forcecrc32, crc32check, decimize) must specify `TARGET=opt` |
| 176 | +- Without this, they inherit the firmware target (e.g., `db50x`) and fail to build |
| 177 | +- Fixed in Makefile lines 592-596 |
| 178 | + |
| 179 | +**Windows MSVC issues:** |
| 180 | +- MSVC doesn't support `#warning` preprocessor directive (GCC/Clang extension) |
| 181 | +- MSVC doesn't support POSIX signals used in recorder library |
| 182 | +- Solution: Use MinGW (GCC for Windows) which provides POSIX compatibility layer |
| 183 | + |
| 184 | +**MinGW missing POSIX features:** |
| 185 | +- MinGW lacks `SIGSTKSZ` constant and `strsignal()` function |
| 186 | +- Solution: Patched recorder submodule to provide fallbacks when `HAVE_SIGSTKSZ` and `HAVE_STRSIGNAL` are not defined |
| 187 | +- The recorder's Makefile CONFIG checks for these features and generates appropriate `HAVE_*` defines |
| 188 | +- Fallback: `SIGSTKSZ` defaults to 16384, `strsignal()` returns "Signal N" string |
| 189 | + |
| 190 | +**Build ID:** |
| 191 | +- All builds use `.build_id` file in root directory for version tracking |
| 192 | +- GitHub Actions creates this automatically using `${{ github.run_number }}` for all build jobs |
| 193 | +- The build ID is read by `tools/build_id` script and embedded in firmware builds |
| 194 | +- For local builds, create manually: `echo "1" > .build_id` (or it defaults to 0) |
| 195 | + |
| 196 | +## Customization |
| 197 | + |
| 198 | +To modify build triggers, edit the `on:` section in `build.yml`. Current triggers: |
| 199 | +- Push to stable or dev branches |
| 200 | +- Pull requests targeting stable or dev |
| 201 | +- Manual workflow dispatch |
| 202 | + |
0 commit comments