Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,11 @@ jobs:
if: needs.discover.outputs.any == 'true'
steps:
- uses: actions/checkout@v4
with:
# The SX1262 model is a submodule now. Without this the
# checkout is a bare gitlink and build.sh stops on its own
# guard, which is the loud failure but still a failure.
submodules: recursive

- name: Toolchain
if: matrix.target.apt != ''
Expand Down Expand Up @@ -338,6 +343,11 @@ jobs:
runs-on: ${{ matrix.target.runs_on }}
steps:
- uses: actions/checkout@v4
with:
# The SX1262 model is a submodule now. Without this the
# checkout is a bare gitlink and build.sh stops on its own
# guard, which is the loud failure but still a failure.
submodules: recursive

- name: Toolchain
if: matrix.target.apt != ''
Expand Down
78 changes: 78 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# What a pull request here is checked against.
#
# build.yml only ever ran on a tag or a button, so nothing verified a change
# before it landed. That is how a change to build.sh and a new submodule reached
# a merge with no evidence they compiled: the guard in build.sh would have said
# so loudly, but only on the next release, which is the wrong moment to find out.
#
# Deliberately one platform, and the two halves of what this repository actually
# builds: radioserver, which wraps the vendored chip model behind a socket, and
# one native role, which links the same model into MeshCore itself. They exercise
# different include paths and different source lists over the same library, and
# the first change to use a glob for those sources broke exactly one of them.
# Cross-compiling for four platforms is the release's job, not a reviewer's.
name: pull request

on:
pull_request:
workflow_dispatch:

jobs:
radioserver:
name: radioserver compiles
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# The SX1262 model lives in MeshBench/virtual-sx1262. Without this the
# checkout is a bare gitlink and there is nothing to compile.
submodules: recursive

- name: The submodule is actually here
run: |
set -euo pipefail
# Checked separately from the build so an empty submodule reads as an
# empty submodule rather than as a compile error in a missing file.
test -f vendor/virtual-sx1262/src/VirtualSX1262.cpp
echo "vendor/virtual-sx1262 at $(git -C vendor/virtual-sx1262 rev-parse --short HEAD)"

- name: Build radioserver
run: ./build.sh radioserver out

- name: It is an executable, not an empty file
run: |
set -euo pipefail
bin=$(find out -name 'radioserver-*' -type f)
test -x "$bin"
file "$bin"

native:
name: a native role compiles
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

# The same refs build.yml uses, at whatever upstream's default branch is:
# this job asks whether our own wiring compiles, and pinning a MeshCore
# commit here would be a second pin to keep honest for no gain. A break
# caused by upstream moving is worth seeing on a pull request too.
- name: MeshCore and its crypto dependency
run: |
set -euo pipefail
git clone --depth 1 --filter=blob:none https://github.com/meshcore-dev/MeshCore MeshCore
git clone --depth 1 https://github.com/rweather/arduinolibs arduinolibs

- name: Build simple_repeater
env:
MESHCORE: ${{ github.workspace }}/MeshCore
CRYPTO: ${{ github.workspace }}/arduinolibs/libraries/Crypto
run: ./build.sh simple_repeater out

- name: It is an executable, not an empty file
run: |
set -euo pipefail
bin=$(find out -name 'meshcore-simple_repeater-*' -type f)
test -x "$bin"
file "$bin"
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "vendor/virtual-sx1262"]
path = vendor/virtual-sx1262
url = https://github.com/MeshBench/virtual-sx1262.git
5 changes: 5 additions & 0 deletions NOTICE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ licensed, copyright Scott Powell / rippleradios.com. Their applications are
compiled **unmodified**; everything this repository adds is the host variant in
`variants/host/` and the bridge in `bridge/`, also MIT.

The SX1262 model is no longer here. It is
[MeshBench/virtual-sx1262](https://github.com/MeshBench/virtual-sx1262), MIT,
vendored as a submodule at `vendor/virtual-sx1262`, because QEMU and Renode need
the same chip and a second copy of a chip model drifts.

The commit each release was built from is recorded in that release's body.

Third-party code compiled in:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Worth being exact about, because the interesting bugs live on the boundary.
| MeshCore application and mesh logic | **real**, unmodified |
| MeshCore radio driver — `CustomSX1262`, `RadioLibWrapper` | **real**, unmodified |
| RadioLib 7.6.0 — the version MeshCore pins | **real**, vendored in `vendor/`, unmodified |
| The SX1262 chip | **ours** — `variants/host/VirtualSX1262` |
| The SX1262 chip | **ours**, `vendor/virtual-sx1262` (shared with QEMU and Renode) |
| Arduino, board, filesystem, RTC, sensors, RNG | **ours** — `variants/host/` |
| The air | whatever drives the bridge |

Expand Down
26 changes: 22 additions & 4 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,24 @@ fi

root=$(cd "$(dirname "$0")" && pwd)
variant="$root/variants/host"
# The SX1262 model is shared with QEMU, Renode and the simulator, so it lives
# in its own repository rather than in this variant. A submodule keeps one copy
# and one history: two copies of a chip model drift, and the moment they do a
# native node and an emulated one stop being comparable.
vsx="$root/vendor/virtual-sx1262"
if [ ! -f "$vsx/src/VirtualSX1262.cpp" ]; then
echo "build.sh: vendor/virtual-sx1262 is empty; run: git submodule update --init" >&2
exit 1
fi
# Globbed rather than listed, so the library splitting a file does not break
# this build with an undefined symbol in a repository its author is not in.
vsx_src=("$vsx"/src/*.cpp)
# Both of the model's include roots. src/ holds the C++ class the host variant
# uses directly; include/ holds the C ABI, which abi.cpp needs and which the glob
# above therefore drags in. Carrying the ABI in these binaries costs a few
# unreferenced symbols and means radioserver already exports the surface QEMU and
# Renode link against.
vsx_inc=(-I "$vsx/src" -I "$vsx/include")
src="${MESHCORE:-}/examples/$role"
if [ "$role" != radioserver ]; then
[ -d "$src" ] || { echo "no such role: $role (looked in $MESHCORE/examples)" >&2; exit 2; }
Expand Down Expand Up @@ -94,9 +112,9 @@ if [ "$role" = radioserver ]; then
bin="$out/radioserver-$os-$arch$exe"
rs_flags=("${STD:--std=c++17}" -O2 -w ${extra_flags[@]+"${extra_flags[@]}"})
rs_objs=()
for f in "$variant/VirtualSX1262.cpp" "$root/bridge/radioserver.cpp"; do
for f in "${vsx_src[@]}" "$root/bridge/radioserver.cpp"; do
o="$obj/$(basename "${f%.cpp}").o"
if ! "$CXX" "${rs_flags[@]}" -I "$variant" -c "$f" -o "$o"; then
if ! "$CXX" "${rs_flags[@]}" -I "$variant" "${vsx_inc[@]}" -c "$f" -o "$o"; then
echo "build.sh: radioserver: $(basename "$f") did not compile for $os/$arch" >&2
exit 1
fi
Expand All @@ -118,7 +136,7 @@ bin="$out/meshcore-$role-$os-$arch$exe"
# so MeshCore's own radio driver runs against the library it was written for
# rather than against a stand-in of ours.
radiolib="$root/vendor/RadioLib/src"
inc=(-I "$variant" -I "$MESHCORE/src" -I "$src" -I "$CRYPTO" -I "$MESHCORE/lib/ed25519" -I "$radiolib")
inc=(-I "$variant" "${vsx_inc[@]}" -I "$MESHCORE/src" -I "$src" -I "$CRYPTO" -I "$MESHCORE/lib/ed25519" -I "$radiolib")
# -O2, not -Os: this build exists to be fast, and it is also the build whose
# results get compared against the emulated one. Optimisation level is exactly
# the kind of difference that would make that comparison meaningless if it
Expand Down Expand Up @@ -204,7 +222,7 @@ done
# Test programs in the variant directory are skipped: they carry their own
# main(), so linking one into a role produces "multiple definition of main" and
# takes down every role at once, which reads as the role not porting.
for f in "$variant"/*.cpp "$root/bridge/main.cpp"; do
for f in "$variant"/*.cpp "${vsx_src[@]}" "$root/bridge/main.cpp"; do
case "$(basename "$f")" in *_test.cpp) continue ;; esac
o="$obj/$(basename "${f%.cpp}").o"
# The bridge is the one file that includes windows.h - through winsock2.h -
Expand Down
Loading
Loading