From 5116312c110154bec60e39fe89cd9409221107ff Mon Sep 17 00:00:00 2001 From: fryorcraken Date: Tue, 14 Oct 2025 20:43:28 +1100 Subject: [PATCH] feat: ensure waku is installable via nimble --- .github/workflows/test-nimble-install.yml | 56 +++++++++++++++++++++++ examples/nimble/example.nimble | 15 ++++++ examples/nimble/src/example.nim | 28 ++++++++++++ 3 files changed, 99 insertions(+) create mode 100644 .github/workflows/test-nimble-install.yml create mode 100644 examples/nimble/example.nimble create mode 100644 examples/nimble/src/example.nim diff --git a/.github/workflows/test-nimble-install.yml b/.github/workflows/test-nimble-install.yml new file mode 100644 index 000000000..2361f8dba --- /dev/null +++ b/.github/workflows/test-nimble-install.yml @@ -0,0 +1,56 @@ +name: Test Nimble Installation + +on: + pull_request: + push: + branches: + - master + +jobs: + test-nimble-install: + strategy: + matrix: + os: [ubuntu-latest, macos-latest] # TODO: Windows + nim-version: ['2.2.4'] # TODO: tests with more versions + + runs-on: ${{ matrix.os }} + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - uses: nim-lang/setup-nimble-action@v1 + with: + nimble-version: "nightly" + repo-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Display Nimble version + run: | + nimble --version + + - name: Display example.nimble + run: cat examples/nimble/example.nimble + + - name: Display waku.nimble + run: head -n40 waku.nimble + + - name: Install waku from head of PR branch + working-directory: examples/nimble + run: nimble --verbose install "waku@#${{ github.event.pull_request.head.sha }}" + + - name: List installed packages + working-directory: examples/nimble + run: | + nimble list --installed --ver + + - name: Build example project + working-directory: examples/nimble + run: | + echo "Building example project..." + nimble --verbose build + + - name: Run example project + working-directory: examples/nimble + run: | + echo "Running example project..." + nimble --verbose run \ No newline at end of file diff --git a/examples/nimble/example.nimble b/examples/nimble/example.nimble new file mode 100644 index 000000000..25cbbbdd7 --- /dev/null +++ b/examples/nimble/example.nimble @@ -0,0 +1,15 @@ +# Package + +version = "0.1.0" +author = "fryorcraken" +description = "Test Waku with nimble" +license = "MIT" +srcDir = "src" +bin = @["example"] + + +# Dependencies + +requires "chronos" +requires "results" +requires "waku" \ No newline at end of file diff --git a/examples/nimble/src/example.nim b/examples/nimble/src/example.nim new file mode 100644 index 000000000..18756cdba --- /dev/null +++ b/examples/nimble/src/example.nim @@ -0,0 +1,28 @@ +import std/options +import chronos, results +import waku + +proc main() {.async.} = + echo("Starting Waku node...") + + # Create a basic configuration for the Waku node + # No RLN so we don't need to path an eth rpc endpoint + let config = + newNodeConfig(wakuConfig = newWakuConfig(bootstrapNodes = @[], clusterId = 42)) + + # Create the node using the library API's createNode function + let node = (await createNode(config)).valueOr: + echo("Failed to create node: ", error) + quit(1) + + echo("Waku node created successfully!") + + # Start the node + (await startWaku(addr node)).isOkOr: + echo("Failed to start node: ", error) + quit(1) + + echo("Node started successfully! exiting") + +when isMainModule: + waitFor main()