From a1811e73952629eb3a6450a63c4cd0bf92e6e9fd Mon Sep 17 00:00:00 2001 From: tersec Date: Sun, 1 Sep 2024 21:49:41 +0000 Subject: [PATCH 1/2] fix(transport): libp2p compilation in Nim version-2-0 and devel (#1186) For example: ``` /Users/runner/work/nim-libp2p/nim-libp2p/nimbledeps/pkgs2/websock-0.1.0-94f836ae589056b2deb04bdfdcd614fff80adaf5/websock/http/client.nim(173, 5) template/generic instantiation of `async` from here /Users/runner/work/nim-libp2p/nim-libp2p/nimbledeps/pkgs2/websock-0.1.0-94f836ae589056b2deb04bdfdcd614fff80adaf5/websock/http/client.nim(165, 1) Warning: The raises pragma doesn't work on async procedures - use `async: (raises: [...]) instead. [User] /Users/runner/work/nim-libp2p/nim-libp2p/nimbledeps/pkgs2/websock-0.1.0-94f836ae589056b2deb04bdfdcd614fff80adaf5/websock/websock.nim(257, 5) template/generic instantiation of `async` from here /Users/runner/work/nim-libp2p/nim-libp2p/nimbledeps/pkgs2/websock-0.1.0-94f836ae589056b2deb04bdfdcd614fff80adaf5/websock/websock.nim(251, 1) Warning: The raises pragma doesn't work on async procedures - use `async: (raises: [...]) instead. [User] /Users/runner/work/nim-libp2p/nim-libp2p/libp2p/transports/wstransport.nim(77, 18) template/generic instantiation of `async` from here /Users/runner/work/nim-libp2p/nim-libp2p/libp2p/transports/wstransport.nim(83, 10) template/generic instantiation of `setResult` from here /Users/runner/work/nim-libp2p/nim-libp2p/libp2p/transports/wstransport.nim(78, 26) template/generic instantiation of `mapExceptions` from here /Users/runner/work/nim-libp2p/nim-libp2p/nimbledeps/pkgs2/chronos-4.0.2-c5e9517b9189713210e2abab8b77a68da71ded12/chronos/internal/asyncmacro.nim(542, 60) Error: expression 'value(cast[type(recv(s.session, pbytes, nbytes))](chronosInternalRetFuture.internalChild))' is of type 'int' and has to be used (or discarded); start of expression here: /Users/runner/work/nim-libp2p/nim-libp2p/libp2p/transports/wstransport.nim(78, 26) stack trace: (most recent call last) ``` from https://github.com/vacp2p/nim-libp2p/actions/runs/10655841970/job/29533846606?pr=1145 For minimal example of this: ```nim template g(body: untyped) = try: body except CatchableError: raise newException(CatchableError, "") discard g(0) ``` Also, even in 2.0.8, a variation doesn't work: ``` template g(body: untyped) = body discard g(0) ``` --- libp2p/transports/wstransport.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libp2p/transports/wstransport.nim b/libp2p/transports/wstransport.nim index e373688b9..9eb8a340d 100644 --- a/libp2p/transports/wstransport.nim +++ b/libp2p/transports/wstransport.nim @@ -56,7 +56,7 @@ proc new*( stream.initStream() return stream -template mapExceptions(body: untyped) = +template mapExceptions(body: untyped): untyped = try: body except AsyncStreamIncompleteError: From 70754cd575fa8bbc3efb18f37310e3987edb6791 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lex?= Date: Mon, 2 Sep 2024 15:33:16 +0200 Subject: [PATCH 2/2] ci: Enable conditional SAT solving (#1177) * Add conditional SAT dependency solving to a new daily job. closes: https://github.com/vacp2p/nim-libp2p/issues/1174 --- .github/workflows/daily_common.yml | 15 ++++++++++++++- .github/workflows/daily_sat.yml | 15 +++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/daily_sat.yml diff --git a/.github/workflows/daily_common.yml b/.github/workflows/daily_common.yml index 0b2e0d619..be8f22cec 100644 --- a/.github/workflows/daily_common.yml +++ b/.github/workflows/daily_common.yml @@ -17,6 +17,11 @@ on: required: false type: string default: "[]" + use_sat_solver: + description: 'Install dependencies with SAT Solver' + required: false + type: boolean + default: false concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} @@ -86,4 +91,12 @@ jobs: run: | nim --version nimble --version - NIMFLAGS="${NIMFLAGS} --mm:${{ matrix.nim.memory_management }}" nimble test + + if [[ "${{ inputs.use_sat_solver }}" == "true" ]]; then + dependency_solver="sat" + else + dependency_solver="legacy" + fi + + NIMFLAGS="${NIMFLAGS} --mm:${{ matrix.nim.memory_management }} --solver:${dependency_solver}" + nimble test diff --git a/.github/workflows/daily_sat.yml b/.github/workflows/daily_sat.yml new file mode 100644 index 000000000..f9bb9d7ff --- /dev/null +++ b/.github/workflows/daily_sat.yml @@ -0,0 +1,15 @@ +name: Daily SAT + +on: + schedule: + - cron: "30 6 * * *" + workflow_dispatch: + +jobs: + test_amd64: + name: Daily SAT + uses: ./.github/workflows/daily_common.yml + with: + nim: "[{'branch': 'version-2-0', 'memory_management': 'refc'}]" + cpu: "['amd64']" + use_sat_solver: true