|
| 1 | +# CI: Build & Test LibreMesh |
| 2 | + |
| 3 | +This workflow builds a LibreMesh firmware image from source and runs automated |
| 4 | +tests on a physical device in the FCEFYN lab. |
| 5 | + |
| 6 | +It is triggered **manually** — it does not run automatically on every commit. |
| 7 | +You decide when to run it and with which parameters. |
| 8 | + |
| 9 | +--- |
| 10 | + |
| 11 | +## When to use it |
| 12 | + |
| 13 | +Run this workflow when you want to: |
| 14 | + |
| 15 | +- Test a specific version or branch of |
| 16 | + [lime-packages](https://github.com/libremesh/lime-packages) on real hardware |
| 17 | +- Verify that a set of packages installs and boots correctly on a lab device |
| 18 | +- Produce a firmware image with custom packages for a specific device |
| 19 | + |
| 20 | +--- |
| 21 | + |
| 22 | +## How to run it |
| 23 | + |
| 24 | +1. Go to the repository on GitHub |
| 25 | +2. Click the **Actions** tab |
| 26 | +3. Select **Build LibreMesh and Test on DUT** in the left panel |
| 27 | +4. Click **Run workflow** |
| 28 | +5. Fill in the inputs (see below) and click the green **Run workflow** button |
| 29 | + |
| 30 | +--- |
| 31 | + |
| 32 | +## Inputs |
| 33 | + |
| 34 | +| Input | Required | Default | Description | |
| 35 | +|-------|----------|---------|-------------| |
| 36 | +| `duts` | yes | `belkin_rt3200` | Device(s) to build and test. Comma-separated. Use `all` for every lab device. | |
| 37 | +| `lime_ref` | yes | `v2024.1` | Branch, tag, or commit SHA of lime-packages to build from. | |
| 38 | +| `openwrt_version` | no | `23.05.5` | OpenWrt version to use. Must be compatible with `lime_ref`. | |
| 39 | +| `extra_packages` | no | _(empty)_ | Space-separated packages to add or remove from the base set. Prefix with `-` to remove. Example: `luci-app-dawn -lime-proto-batadv` | |
| 40 | +| `config_file` | no | _(empty)_ | Repo-relative path to a config file to inject as `/etc/config/<name>` in the firmware. Example: `firmware/configs/belkin_rt3200.conf` | |
| 41 | + |
| 42 | +### Supported devices |
| 43 | + |
| 44 | +| `duts` value | Hardware | OpenWrt target | |
| 45 | +|---|---|---| |
| 46 | +| `belkin_rt3200` | Belkin RT3200 / Linksys E8450 | `mediatek/mt7622` | |
| 47 | +| `openwrt_one` | OpenWrt One | `mediatek/filogic` | |
| 48 | +| `bananapi_r4` | Banana Pi R4 | `mediatek/filogic` | |
| 49 | +| `librerouter` | LibreRouter v1 | `ath79/generic` | |
| 50 | + |
| 51 | +### OpenWrt / lime-packages compatibility |
| 52 | + |
| 53 | +| `openwrt_version` | Compatible `lime_ref` | |
| 54 | +|---|---| |
| 55 | +| `23.05.5` | `v2024.1` | |
| 56 | +| `24.10.5` | `master` or newer tags | |
| 57 | +| `25.12.0` | `master` or newer tags | |
| 58 | + |
| 59 | +--- |
| 60 | + |
| 61 | +## What happens when you run it |
| 62 | + |
| 63 | +The workflow has three jobs that run in sequence: |
| 64 | + |
| 65 | +### 1. Resolve matrix (~5 seconds, GitHub-hosted) |
| 66 | + |
| 67 | +Parses the `duts` input and builds a job matrix so each device runs in |
| 68 | +parallel. For example, `"belkin_rt3200,librerouter"` becomes two independent |
| 69 | +build jobs. |
| 70 | + |
| 71 | +### 2. Build (~20–25 min per device, GitHub-hosted) |
| 72 | + |
| 73 | +For each device, two Docker containers run back to back: |
| 74 | + |
| 75 | +**Step 1 — OpenWrt SDK** |
| 76 | +Downloads `ghcr.io/openwrt/sdk:<target>-<subtarget>-v<openwrt_version>` and |
| 77 | +compiles the lime-packages listed below from source, using the exact git ref |
| 78 | +you specified in `lime_ref`. This is the slow step. |
| 79 | + |
| 80 | +Packages compiled: |
| 81 | + |
| 82 | +- `lime-system` |
| 83 | +- `lime-proto-babeld` |
| 84 | +- `lime-proto-batadv` |
| 85 | +- `lime-proto-anygw` |
| 86 | +- `lime-hwd-openwrt-wan` |
| 87 | +- `lime-app` |
| 88 | +- `shared-state` + `shared-state-babeld_hosts` + `shared-state-bat_hosts` + `shared-state-nodes_and_links` |
| 89 | +- `babeld-auto-gw-mode` |
| 90 | +- anything you add via `extra_packages` |
| 91 | + |
| 92 | +**Step 2 — OpenWrt ImageBuilder** |
| 93 | +Downloads `ghcr.io/openwrt/imagebuilder:<target>-<subtarget>-v<openwrt_version>` |
| 94 | +and assembles the compiled `.ipk` packages into a complete firmware image |
| 95 | +(`.bin` or `.itb`). This step takes ~2–3 minutes. |
| 96 | + |
| 97 | +The firmware is uploaded as a GitHub Actions artifact named |
| 98 | +`firmware-<dut>-<lime_ref>-<short_sha>` and kept for 7 days. |
| 99 | + |
| 100 | +### 3. Flash and test (lab self-hosted runner, `testbed-fcefyn`) |
| 101 | + |
| 102 | +Runs on the physical T430 machine in the FCEFYN lab. |
| 103 | + |
| 104 | +1. Downloads the firmware artifact from step 2 |
| 105 | +2. Reserves the target device via [labgrid](https://labgrid.readthedocs.io) |
| 106 | + (waits if the device is busy) |
| 107 | +3. Loads the firmware onto the device |
| 108 | +4. Runs the [libremesh-tests](https://github.com/fcefyn-testbed/libremesh-tests) |
| 109 | + test suite with pytest |
| 110 | +5. Releases the device when done (even if tests fail) |
| 111 | + |
| 112 | +--- |
| 113 | + |
| 114 | +## Examples |
| 115 | + |
| 116 | +**Test the latest stable lime-packages on the Belkin RT3200:** |
| 117 | +``` |
| 118 | +duts: belkin_rt3200 |
| 119 | +lime_ref: v2024.1 |
| 120 | +openwrt_version: 23.05.5 |
| 121 | +``` |
| 122 | + |
| 123 | +**Test a feature branch on all devices:** |
| 124 | +``` |
| 125 | +duts: all |
| 126 | +lime_ref: my-feature-branch |
| 127 | +openwrt_version: 24.10.5 |
| 128 | +``` |
| 129 | + |
| 130 | +**Add a package and remove another:** |
| 131 | +``` |
| 132 | +duts: belkin_rt3200 |
| 133 | +lime_ref: v2024.1 |
| 134 | +extra_packages: luci-app-dawn -lime-proto-batadv |
| 135 | +``` |
| 136 | + |
| 137 | +**Inject a custom network config:** |
| 138 | +``` |
| 139 | +duts: belkin_rt3200 |
| 140 | +lime_ref: v2024.1 |
| 141 | +config_file: firmware/configs/belkin_rt3200.conf |
| 142 | +``` |
| 143 | + |
| 144 | +--- |
| 145 | + |
| 146 | +## Testing the build locally with `act` |
| 147 | + |
| 148 | +[act](https://github.com/nektos/act) lets you run the build job on your own |
| 149 | +machine without pushing to GitHub. Only the `build` job works locally — the |
| 150 | +`flash_and_test` job requires physical lab hardware and is automatically |
| 151 | +skipped. |
| 152 | + |
| 153 | +```bash |
| 154 | +act workflow_dispatch \ |
| 155 | + --workflows .github/workflows/build-and-test-libremesh.yml \ |
| 156 | + --job build \ |
| 157 | + --input duts="belkin_rt3200" \ |
| 158 | + --input lime_ref="v2024.1" \ |
| 159 | + --input openwrt_version="23.05.5" \ |
| 160 | + --input config_file="" \ |
| 161 | + --input extra_packages="" \ |
| 162 | + -P ubuntu-latest=catthehacker/ubuntu:act-22.04 \ |
| 163 | + --artifact-server-path /tmp/act-artifacts |
| 164 | +``` |
| 165 | + |
| 166 | +The firmware is saved to `/tmp/act-artifacts` and to `./images/` in the repo |
| 167 | +root (not committed). |
0 commit comments