mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-01-03 14:33:12 +00:00
feat: ensure waku is installable via nimble
This commit is contained in:
parent
9808e205af
commit
5116312c11
56
.github/workflows/test-nimble-install.yml
vendored
Normal file
56
.github/workflows/test-nimble-install.yml
vendored
Normal file
@ -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
|
||||
15
examples/nimble/example.nimble
Normal file
15
examples/nimble/example.nimble
Normal file
@ -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"
|
||||
28
examples/nimble/src/example.nim
Normal file
28
examples/nimble/src/example.nim
Normal file
@ -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()
|
||||
Loading…
x
Reference in New Issue
Block a user