|
| 1 | +# Build all three members and prove the generated code is really generated. |
| 2 | +# |
| 3 | +# The interesting failure mode here is not "does it compile" — it is that a |
| 4 | +# HOST wayland-scanner would silently produce different code. 1.22 does not |
| 5 | +# know 1.23's `deprecated-since` attribute and rejects protocol/wayland.xml |
| 6 | +# outright, so the job asserts the generator that ran was the one this build |
| 7 | +# produced. |
| 8 | +name: ci |
| 9 | + |
| 10 | +on: |
| 11 | + push: |
| 12 | + branches: [main] |
| 13 | + tags: ['v*'] |
| 14 | + pull_request: |
| 15 | + workflow_dispatch: |
| 16 | + |
| 17 | +jobs: |
| 18 | + build: |
| 19 | + runs-on: ubuntu-latest |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@v4 |
| 22 | + |
| 23 | + - name: Install xlings + mcpp |
| 24 | + run: | |
| 25 | + curl -fsSL https://d2learn.org/xlings-install.sh | bash |
| 26 | + echo "$HOME/.xlings/subos/default/bin" >> "$GITHUB_PATH" |
| 27 | + "$HOME/.xlings/bin/xlings" install mcpp -y |
| 28 | +
|
| 29 | + - name: Build the workspace |
| 30 | + run: mcpp build --workspace |
| 31 | + |
| 32 | + - name: wayland-scanner runs and is 1.23.1 |
| 33 | + run: | |
| 34 | + scanner=$(find mcpp/scanner/target -name wayland-scanner -type f | head -1) |
| 35 | + test -n "$scanner" || { echo "no wayland-scanner was built"; exit 1; } |
| 36 | + "$scanner" --version |
| 37 | + "$scanner" --version | grep -qx 'wayland-scanner 1.23.1' |
| 38 | +
|
| 39 | + - name: the generated protocol code came from THIS scanner |
| 40 | + run: | |
| 41 | + scanner=$(find mcpp/scanner/target -name wayland-scanner -type f | head -1) |
| 42 | + "$scanner" -s public-code protocol/wayland.xml /tmp/wayland-protocol.c |
| 43 | + head -1 /tmp/wayland-protocol.c |
| 44 | + grep -q 'Generated by wayland-scanner 1.23.1' /tmp/wayland-protocol.c |
| 45 | +
|
| 46 | + - name: both libraries carry the canonical SONAMEs |
| 47 | + run: | |
| 48 | + for pair in "client:libwayland-client.so.0" "server:libwayland-server.so.0"; do |
| 49 | + member=${pair%%:*}; want=${pair#*:} |
| 50 | + so=$(find "mcpp/$member/target" -name "${want%.0}" -type f | head -1) |
| 51 | + test -n "$so" || { echo "$member: no library built"; exit 1; } |
| 52 | + got=$(readelf -d "$so" | sed -n 's/.*SONAME.*\[\(.*\)\]/\1/p') |
| 53 | + echo "$member -> $got" |
| 54 | + test "$got" = "$want" || { echo "expected $want"; exit 1; } |
| 55 | + done |
| 56 | +
|
| 57 | + - name: the two libraries do not overlap |
| 58 | + run: | |
| 59 | + # Mesa's libEGL_mesa has DT_NEEDED on both; if one carried the |
| 60 | + # other's API the process would resolve it to whichever loaded |
| 61 | + # first. wl_display_create is server-only, wl_display_connect |
| 62 | + # client-only. |
| 63 | + c=$(find mcpp/client/target -name libwayland-client.so -type f | head -1) |
| 64 | + s=$(find mcpp/server/target -name libwayland-server.so -type f | head -1) |
| 65 | + readelf --dyn-syms -W "$c" | grep -q ' wl_display_connect' || exit 1 |
| 66 | + readelf --dyn-syms -W "$c" | grep -q ' wl_display_create' && { echo "client leaked the server API"; exit 1; } |
| 67 | + readelf --dyn-syms -W "$s" | grep -q ' wl_display_create' || exit 1 |
| 68 | + readelf --dyn-syms -W "$s" | grep -q ' wl_display_connect' && { echo "server leaked the client API"; exit 1; } |
| 69 | + echo "client and server APIs are disjoint" |
| 70 | +
|
| 71 | + - name: upstream's own build still works |
| 72 | + run: | |
| 73 | + # The fork patches no upstream file, so meson must still be able to |
| 74 | + # build this tree. If this breaks, something was modified that should |
| 75 | + # not have been. |
| 76 | + sudo apt-get update -qq |
| 77 | + sudo apt-get install -y -qq meson ninja-build libffi-dev libexpat1-dev |
| 78 | + meson setup build-meson -Ddocumentation=false -Ddtd_validation=false |
| 79 | + ninja -C build-meson |
0 commit comments