From 74b19c05d1fead6cc3b523b2aa1337d70b142bfe Mon Sep 17 00:00:00 2001 From: Ivan FB <128452529+Ivansete-status@users.noreply.github.com> Date: Thu, 29 Jan 2026 15:48:34 +0100 Subject: [PATCH] simple refactor to reduce PRs CI load (#3701) * add discord notification in ci-daily --- .github/workflows/ci-daily.yml | 79 +++++++++++++++++++ .github/workflows/ci.yml | 2 +- Makefile | 6 +- library/kernel_api/debug_node_api.nim | 3 +- .../test_waku_filter_dos_protection.nim | 3 +- tests/waku_lightpush/test_ratelimit.nim | 5 +- 6 files changed, 90 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/ci-daily.yml diff --git a/.github/workflows/ci-daily.yml b/.github/workflows/ci-daily.yml new file mode 100644 index 000000000..236bd5216 --- /dev/null +++ b/.github/workflows/ci-daily.yml @@ -0,0 +1,79 @@ +name: Daily logos-messaging-nim CI + +on: + schedule: + - cron: '30 6 * * *' + +env: + NPROC: 2 + MAKEFLAGS: "-j${NPROC}" + NIMFLAGS: "--parallelBuild:${NPROC} --colors:off -d:chronicles_colors:none" + +jobs: + build: + strategy: + fail-fast: false + matrix: + os: [ubuntu-22.04, macos-15] + runs-on: ${{ matrix.os }} + timeout-minutes: 45 + + name: build-${{ matrix.os }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Get submodules hash + id: submodules + run: | + echo "hash=$(git submodule status | awk '{print $1}' | sort | shasum -a 256 | sed 's/[ -]*//g')" >> $GITHUB_OUTPUT + + - name: Cache submodules + uses: actions/cache@v3 + with: + path: | + vendor/ + .git/modules + key: ${{ runner.os }}-vendor-modules-${{ steps.submodules.outputs.hash }} + + - name: Make update + run: make update + + - name: Build binaries + run: make V=1 QUICK_AND_DIRTY_COMPILER=1 examples tools + + - name: Notify Discord + if: always() + env: + DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }} + run: | + STATUS="${{ job.status }}" + OS="${{ matrix.os }}" + REPO="${{ github.repository }}" + RUN_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" + + if [ "$STATUS" = "success" ]; then + COLOR=3066993 + TITLE="✅ CI Success" + else + COLOR=15158332 + TITLE="❌ CI Failed" + fi + + curl -H "Content-Type: application/json" \ + -X POST \ + -d "{ + \"embeds\": [{ + \"title\": \"$TITLE\", + \"color\": $COLOR, + \"fields\": [ + {\"name\": \"Repository\", \"value\": \"$REPO\", \"inline\": true}, + {\"name\": \"OS\", \"value\": \"$OS\", \"inline\": true}, + {\"name\": \"Status\", \"value\": \"$STATUS\", \"inline\": true} + ], + \"url\": \"$RUN_URL\", + \"footer\": {\"text\": \"Daily logos-messaging-nim CI\"} + }] + }" \ + "$DISCORD_WEBHOOK_URL" + diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index da8383e43..3de6eb4f5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -80,7 +80,7 @@ jobs: run: make update - name: Build binaries - run: make V=1 QUICK_AND_DIRTY_COMPILER=1 all tools + run: make V=1 QUICK_AND_DIRTY_COMPILER=1 all build-windows: needs: changes diff --git a/Makefile b/Makefile index 87bd7bc74..9e241bbfa 100644 --- a/Makefile +++ b/Makefile @@ -51,10 +51,12 @@ endif ########## ## Main ## ########## -.PHONY: all test update clean +.PHONY: all test update clean examples # default target, because it's the first one that doesn't start with '.' -all: | wakunode2 example2 chat2 chat2bridge libwaku +all: | wakunode2 libwaku + +examples: | example2 chat2 chat2bridge test_file := $(word 2,$(MAKECMDGOALS)) define test_name diff --git a/library/kernel_api/debug_node_api.nim b/library/kernel_api/debug_node_api.nim index 98f5332b4..9d5a7f134 100644 --- a/library/kernel_api/debug_node_api.nim +++ b/library/kernel_api/debug_node_api.nim @@ -8,7 +8,8 @@ import libp2p/peerid, metrics, ffi -import waku/factory/waku, waku/node/waku_node, waku/node/health_monitor, library/declare_lib +import + waku/factory/waku, waku/node/waku_node, waku/node/health_monitor, library/declare_lib proc getMultiaddresses(node: WakuNode): seq[string] = return node.info().listenAddresses diff --git a/tests/waku_filter_v2/test_waku_filter_dos_protection.nim b/tests/waku_filter_v2/test_waku_filter_dos_protection.nim index fd3d8c837..be92fc409 100644 --- a/tests/waku_filter_v2/test_waku_filter_dos_protection.nim +++ b/tests/waku_filter_v2/test_waku_filter_dos_protection.nim @@ -217,7 +217,8 @@ suite "Waku Filter - DOS protection": for fut in finished: check not fut.failed() let pingRes = fut.read() - if pingRes.isErr() and pingRes.error().kind == FilterSubscribeErrorKind.TOO_MANY_REQUESTS: + if pingRes.isErr() and + pingRes.error().kind == FilterSubscribeErrorKind.TOO_MANY_REQUESTS: gotTooMany = true break diff --git a/tests/waku_lightpush/test_ratelimit.nim b/tests/waku_lightpush/test_ratelimit.nim index bdab3f074..ffbd1a06d 100644 --- a/tests/waku_lightpush/test_ratelimit.nim +++ b/tests/waku_lightpush/test_ratelimit.nim @@ -122,9 +122,8 @@ suite "Rate limited push service": # ensure period of time has passed and the client can again use the service await sleepAsync(tokenPeriod + 100.millis) - let recoveryRes = await client.publish( - some(DefaultPubsubTopic), fakeWakuMessage(), serverPeerId - ) + let recoveryRes = + await client.publish(some(DefaultPubsubTopic), fakeWakuMessage(), serverPeerId) check recoveryRes.isOk() ## Cleanup