ci: cache libwaku, gate go mod tidy, rename LMN_DIR

- Rename LMN_DIR -> LOGOS_DELIVERY_DIR across the PR-gate and nightly
  workflows, the waku Makefile, and the build docs.
- Cache the built logos-delivery kernel keyed on its upstream HEAD SHA,
  skipping the clone + libwaku build while that commit is unchanged.
- Add a "go mod tidy is clean" step that fails if go.mod/go.sum drift.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Igor Sirotin 2026-06-10 00:42:09 +03:00
parent 4e4a00d574
commit 857b0908f9
No known key found for this signature in database
GPG Key ID: 0EABBCB40CB9AD4A
4 changed files with 42 additions and 16 deletions

View File

@ -46,9 +46,9 @@ jobs:
- name: Build waku bindings
run: |
export LMN_DIR=$(pwd)/vendor/logos-delivery
export CGO_CFLAGS="-I${LMN_DIR}/library/"
export CGO_LDFLAGS="-L${LMN_DIR}/build/ -lwaku -Wl,-rpath,${LMN_DIR}/build/"
export LOGOS_DELIVERY_DIR=$(pwd)/vendor/logos-delivery
export CGO_CFLAGS="-I${LOGOS_DELIVERY_DIR}/library/"
export CGO_LDFLAGS="-L${LOGOS_DELIVERY_DIR}/build/ -lwaku -Wl,-rpath,${LOGOS_DELIVERY_DIR}/build/"
make -C waku build
- name: Increase ulimit
@ -58,9 +58,9 @@ jobs:
run: |
set -euo pipefail
cd waku
export LMN_DIR=$(pwd)/vendor/logos-delivery
export CGO_CFLAGS="-I${LMN_DIR}/library/"
export CGO_LDFLAGS="-L${LMN_DIR}/build/ -lwaku -Wl,-rpath,${LMN_DIR}/build/"
export LOGOS_DELIVERY_DIR=$(pwd)/vendor/logos-delivery
export CGO_CFLAGS="-I${LOGOS_DELIVERY_DIR}/library/"
export CGO_LDFLAGS="-L${LOGOS_DELIVERY_DIR}/build/ -lwaku -Wl,-rpath,${LOGOS_DELIVERY_DIR}/build/"
go test -count=10 -p=1 -v -timeout=360m . | tee ../testlogs.log
- name: Upload daily test logs

View File

@ -16,7 +16,7 @@ jobs:
env:
# Clone the logos-delivery checkout OUTSIDE the module tree: a directory
# named `vendor/` at the module root would put Go into vendor mode.
LMN_DIR: ${{ github.workspace }}/.logos-delivery
LOGOS_DELIVERY_DIR: ${{ github.workspace }}/.logos-delivery
# libwaku (kernel) is required at compile time for the cgo packages.
# Updated to also include liblogosdelivery once the messaging package lands.
CGO_CFLAGS: -I${{ github.workspace }}/.logos-delivery/library/
@ -35,11 +35,29 @@ jobs:
with:
go-version: "1.24"
- name: Resolve logos-delivery commit
# Cache the built kernel keyed on the exact upstream commit, so the
# expensive clone + build is skipped while logos-delivery's HEAD is
# unchanged. ls-remote gives us the SHA before we clone.
id: logos-delivery-rev
run: |
rev=$(git ls-remote https://github.com/logos-messaging/logos-delivery.git HEAD | cut -f1)
echo "rev=$rev" >> "$GITHUB_OUTPUT"
- name: Cache logos-delivery build
id: logos-delivery-cache
uses: actions/cache@v4
with:
path: ${{ env.LOGOS_DELIVERY_DIR }}
key: logos-delivery-${{ runner.os }}-${{ steps.logos-delivery-rev.outputs.rev }}
- name: Clone logos-delivery
run: git clone --depth 1 https://github.com/logos-messaging/logos-delivery.git "$LMN_DIR"
if: steps.logos-delivery-cache.outputs.cache-hit != 'true'
run: git clone --depth 1 https://github.com/logos-messaging/logos-delivery.git "$LOGOS_DELIVERY_DIR"
- name: Build libwaku
run: make -C "$LMN_DIR" libwaku -j
if: steps.logos-delivery-cache.outputs.cache-hit != 'true'
run: make -C "$LOGOS_DELIVERY_DIR" libwaku -j
- name: go build
run: go build ./...
@ -47,6 +65,14 @@ jobs:
- name: go vet
run: go vet ./...
- name: go mod tidy is clean
# `go mod tidy` must be a no-op on a well-maintained module. If it
# changes go.mod/go.sum the PR left them out of sync — fail and show
# the diff so the author can commit the tidied result.
run: |
go mod tidy
git diff --exit-code go.mod go.sum
- name: Ensure base ref is available for lint
# golangci-lint's new-from-merge-base needs origin/master present.
run: git fetch --no-tags origin master

View File

@ -18,9 +18,9 @@ If you have `logos-delivery` checked out, point the build to it:
```bash
# path to your existing logos-delivery clone
export LMN_DIR=/absolute/path/to/logos-delivery
export CGO_CFLAGS="-I${LMN_DIR}/library"
export CGO_LDFLAGS="-L${LMN_DIR}/build -lwaku -Wl,-rpath,${LMN_DIR}/build"
export LOGOS_DELIVERY_DIR=/absolute/path/to/logos-delivery
export CGO_CFLAGS="-I${LOGOS_DELIVERY_DIR}/library"
export CGO_LDFLAGS="-L${LOGOS_DELIVERY_DIR}/build -lwaku -Wl,-rpath,${LOGOS_DELIVERY_DIR}/build"
# compile all packages
make -C waku build

View File

@ -1,17 +1,17 @@
# Makefile for Waku Go Bindings
# Path to logos-delivery submodule
export LMN_DIR ?= $(shell pwd)/../vendor/logos-delivery
export LOGOS_DELIVERY_DIR ?= $(shell pwd)/../vendor/logos-delivery
# Debugging output
print-paths:
@echo "LMN_DIR: $(LMN_DIR)"
@echo "LOGOS_DELIVERY_DIR: $(LOGOS_DELIVERY_DIR)"
@echo "HEADER_PATH: $(LIBWAKU_HEADER_PATH)"
@echo "LIB_PATH: $(LIBWAKU_LIB_PATH)"
# Default paths for libwaku library and headers (can be overridden)
export LIBWAKU_HEADER_PATH ?= $(LMN_DIR)/library
export LIBWAKU_LIB_PATH ?= $(LMN_DIR)/build
export LIBWAKU_HEADER_PATH ?= $(LOGOS_DELIVERY_DIR)/library
export LIBWAKU_LIB_PATH ?= $(LOGOS_DELIVERY_DIR)/build
export CGO_CFLAGS := -I$(LIBWAKU_HEADER_PATH)/
export CGO_LDFLAGS := -L$(LIBWAKU_LIB_PATH)/ -lwaku -Wl,-rpath,$(LIBWAKU_LIB_PATH)/