From 857b0908f97eecd64b05f3f9986bf2154fa4d4e9 Mon Sep 17 00:00:00 2001 From: Igor Sirotin Date: Wed, 10 Jun 2026 00:42:09 +0300 Subject: [PATCH] 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) --- .github/workflows/CI.yml | 12 ++++++------ .github/workflows/pr.yml | 32 +++++++++++++++++++++++++++++--- README.md | 6 +++--- waku/Makefile | 8 ++++---- 4 files changed, 42 insertions(+), 16 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 9b627a2..18a2954 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -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 diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index ebf2ce1..6ef442a 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -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 diff --git a/README.md b/README.md index 07412ab..f86363e 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/waku/Makefile b/waku/Makefile index 211ed8e..4a6523a 100644 --- a/waku/Makefile +++ b/waku/Makefile @@ -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)/