Files
Igor Sirotin c3768ff3fc refactor: address review on the Node facades
Move the Messaging API back out of pkg/kernel: ffi.Handle becomes a
defined type in the internal package, so kernel can hand the context to
pkg/messaging through kernel.Handle without the kernel layer knowing the
tier exists, and without the type being nameable outside this module.

Split Discovery into DiscV5, PeerExchange and DNSDiscovery, group the
node's identity and health under Debug(), and give every facade a pointer
receiver. Drop the node name, the per-operation logging that duplicates
what the library already writes, and GetFreePortIfNeeded — port 0 already
means "let the OS pick".

Heavy kernel tests now mark themselves with requiresNode and skip under
-short, so the gate runs `go test -short ./...` instead of naming tests
in a regexp.
2026-08-25 00:46:13 +01:00

103 lines
3.4 KiB
YAML

name: PR
on:
# Every PR, whatever it targets: a stacked PR based on another branch needs
# the same gate as one based on master.
pull_request:
# Cancel superseded runs on the same PR.
concurrency:
group: pr-${{ github.ref }}
cancel-in-progress: true
jobs:
gate:
runs-on: ubuntu-latest
env:
# Build in module mode; never use a vendor/ dir.
GOFLAGS: -mod=mod
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.24"
- name: Set up Nim
uses: jiro4989/setup-nim-action@v2
with:
nim-version: "2.2.4"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Cache the built library
# Keyed on the .nimble, which carries the logos-delivery pin. Only the
# artifact is cached: a run that fails mid-resolve leaves a partial
# ~/.nimble/pkgcache, and restoring that makes every later run fail with
# "unable to read tree".
uses: actions/cache@v4
with:
path: build
key: liblogosdelivery-${{ runner.os }}-${{ hashFiles('logos_delivery_go_bindings.nimble') }}
- name: Resolve Nim dependencies
run: make deps
- name: Build liblogosdelivery
# Via the Nimble package: the same path a consumer uses.
run: make liblogosdelivery
- name: Export cgo flags
run: |
dir=$(nimble path logos_delivery | tail -1)
echo "CGO_CFLAGS=-I$dir/library" >> "$GITHUB_ENV"
echo "CGO_LDFLAGS=-L$PWD/build -llogosdelivery -Wl,-rpath,$PWD/build" >> "$GITHUB_ENV"
- name: go build
run: go build ./...
- 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
- name: golangci-lint
# v7 is required for golangci-lint v2.
uses: golangci/golangci-lint-action@v7
with:
version: v2.4.0
# `config verify` fetches its JSON schema from golangci-lint.run on
# every run and fails the job when that request times out. An invalid
# config still fails the lint run itself, so skip the pre-check.
verify: false
- name: go test (run)
# Everything that needs neither a live node nor outbound connectivity.
# The heavy kernel suite marks itself with requiresNode and skips under
# -short; it runs nightly in CI.yml.
run: go test -short ./...
- name: go test integration (compile)
# The integration suite needs outbound connectivity, so it is behind a
# build tag. Compile it here so it cannot rot unnoticed.
run: go test -tags integration -run '^$' ./...
- name: go test kernel (compile)
# Compile the node-requiring tests that -short skipped, so they cannot
# rot either.
run: go test -run '^$' ./pkg/kernel/...