From 4d55f501269b346a0fb02fff4fc0815036b8c7ce Mon Sep 17 00:00:00 2001 From: Tanguy Date: Wed, 2 Nov 2022 21:34:18 +0100 Subject: [PATCH 1/7] Nim ping test --- ping/nim/Dockerfile | 10 +++++ ping/nim/libp2p_ping.nimble | 13 ++++++ ping/nim/main.nim | 83 +++++++++++++++++++++++++++++++++++++ ping/nim/manifest.toml | 19 +++++++++ 4 files changed, 125 insertions(+) create mode 100644 ping/nim/Dockerfile create mode 100644 ping/nim/libp2p_ping.nimble create mode 100644 ping/nim/main.nim create mode 100644 ping/nim/manifest.toml diff --git a/ping/nim/Dockerfile b/ping/nim/Dockerfile new file mode 100644 index 000000000..05f28e1a7 --- /dev/null +++ b/ping/nim/Dockerfile @@ -0,0 +1,10 @@ +FROM nimlang/nim:alpine as builder + +RUN nimble install -y "https://github.com/status-im/testground-nim-sdk@#9fba8111179c2ace7a2b595d8ed8cb10f0bf9c21" +RUN nimble install -y "libp2p" +FROM builder + +COPY . . +RUN cd plan && nimble install -dy && nim c -d:chronicles_log_level=NOTICE main.nim + +ENTRYPOINT ["plan/main"] diff --git a/ping/nim/libp2p_ping.nimble b/ping/nim/libp2p_ping.nimble new file mode 100644 index 000000000..f75795abd --- /dev/null +++ b/ping/nim/libp2p_ping.nimble @@ -0,0 +1,13 @@ +# Package + +version = "0.1.0" +author = "The author" +description = "Demo for another package" +license = "MIT" + + +# Dependencies + +requires "nim >= 1.2.2", + "https://github.com/status-im/testground-nim-sdk", + "libp2p == 1.0.0" diff --git a/ping/nim/main.nim b/ping/nim/main.nim new file mode 100644 index 000000000..bbf7d3308 --- /dev/null +++ b/ping/nim/main.nim @@ -0,0 +1,83 @@ +import serialization, json_serialization +import libp2p, testground_sdk, libp2p/protocols/ping +import chronos +import sequtils + +type + PeerData = object + id: string + addrs: seq[string] + +testground(client): + let addresses = getInterfaces().filterIt(it.name == "eth1").mapIt(it.addresses) + if addresses.len < 1 or addresses[0].len < 1: + quit "Can't find local ip!" + + let + maxLatency = client.param(int, "max_latency_ms") + rng = libp2p.newRng() + address = addresses[0][0].host + switch = newStandardSwitch(addrs = MultiAddress.init(address).tryGet(), rng = rng) + pingProtocol = Ping.new(rng = rng) + + switch.mount(pingProtocol) + await switch.start() + defer: await switch.stop() + + let peersTopic = client.subscribe("peers", PeerData) + await client.publish("peers", + PeerData( + id: $switch.peerInfo.peerId, + addrs: switch.peerInfo.addrs.mapIt($it) + ) + ) + echo "Listening on ", switch.peerInfo.addrs + + var peersInfo: seq[PeerData] + while peersInfo.len < client.testInstanceCount: + peersInfo.add(await peersTopic.popFirst()) + + for peerInfo in peersInfo: + if peerInfo.id == $switch.peerInfo.peerId: break + let + peerId = PeerId.init(peerInfo.id).tryGet() + addrs = peerInfo.addrs.mapIt(MultiAddress.init(it).tryGet()) + await switch.connect(peerId, addrs) + + discard await client.signalAndWait("connected", client.testInstanceCount) + + proc pingPeer(peer: PeerData, tag: string) {.async.} = + if peer.id == $switch.peerInfo.peerId: return + let + stream = await switch.dial(PeerId.init(peer.id).tryGet(), PingCodec) + rtt = await pingProtocol.ping(stream) + await stream.close() + client.recordMessage("ping result (" & tag & ") from peer " & peer.id & ": " & $rtt) + + var futs: seq[Future[void]] + for peer in peersInfo: futs.add(pingPeer(peer, "initial")) + await allFutures(futs) + + discard await client.signalAndWait("initial", client.testInstanceCount) + + for iter in 1 .. client.param(int, "iterations"): + let + latency = milliseconds(rng.rand(maxLatency)) + callbackState = "network-configured-" & $iter + client.recordMessage("Iteration " & $iter & ", my latency: " & $latency) + await client.updateNetworkParameter( + NetworkConf( + enable: true, + network: "default", + callback_state: callbackState, + callback_target: some client.testInstanceCount, + routing_policy: "accept_all", + default: LinkShape(latency: int(latency.nanoseconds)) + ) + ) + await client.waitForBarrier(callbackState, client.testInstanceCount) + + for peer in peersInfo: futs.add(pingPeer(peer, "iteration-" & $iter)) + await allFutures(futs) + + discard await client.signalAndWait("done-" & $iter, client.testInstanceCount) diff --git a/ping/nim/manifest.toml b/ping/nim/manifest.toml new file mode 100644 index 000000000..62a4640f1 --- /dev/null +++ b/ping/nim/manifest.toml @@ -0,0 +1,19 @@ +name = "compatibility-nim" + +[defaults] +builder = "docker:generic" +runner = "local:docker" + +[builders."docker:generic"] +enabled = true + +[runners."local:docker"] +enabled = true + +[[testcases]] +name = "ping" +instances = { min = 2, max = 10000, default = 5 } + + [testcases.params] + max_latency_ms = { type = "int", desc = "maximum value for random local link latency", unit = "ms", default = 1000 } + iterations = { type = "int", desc = "number of ping iterations we'll run against each peer", unit = "count", default = 5 } From c8e4b3227ec3ad92b2220c85dfbf280b257f3b43 Mon Sep 17 00:00:00 2001 From: Tanguy Date: Mon, 7 Nov 2022 18:10:25 +0100 Subject: [PATCH 2/7] Working interop --- ping/_compositions/all-interop-latest.toml | 109 +++++++++++++++++++++ ping/nim/Dockerfile | 5 +- ping/nim/main.nim | 16 ++- 3 files changed, 125 insertions(+), 5 deletions(-) create mode 100644 ping/_compositions/all-interop-latest.toml diff --git a/ping/_compositions/all-interop-latest.toml b/ping/_compositions/all-interop-latest.toml new file mode 100644 index 000000000..507ddce39 --- /dev/null +++ b/ping/_compositions/all-interop-latest.toml @@ -0,0 +1,109 @@ +[metadata] + name = "go-rust-cross-version-{{ or $.Env.InteropTarget "-" }}-{{ or $.Env.GitReference "" }}" + +[global] + plan = "libp2p/ping" + case = "ping" + runner = "local:docker" + concurrent_builds = 1 + + [global.build_config] + enable_go_build_cache = false # see https://github.com/testground/testground/issues/1361 + # disable testground's goproxy which hangs on github runners. + go_proxy_mode = "remote" + go_proxy_url = "https://proxy.golang.org" + +{{ with (load_resource "./go.toml") }} + {{ with (index .groups 0) }} + [[groups]] + id = "go-latest-{{ .Id }}" + instances = { count = 1 } + builder = "docker:go" + + [groups.build] + selectors = ['{{ .Selector }}'] + + [groups.build_config] + path = "./go/" + build_base_image = 'golang:{{ .GoVersion }}-buster' + modfile = "{{ .Modfile }}" + {{ end }} + + {{ if eq $.Env.InteropTarget "go" }} + {{ if $.Env.GitReference }} + {{ with .custom }} + [[groups]] + id = "go-custom-{{ $.Env.GitReference }}" + instances = { count = 1 } + builder = "docker:go" + + [groups.build] + selectors = ['{{ .Selector }}'] + + [[groups.build.dependencies]] + module = "github.com/libp2p/go-libp2p" + version = "{{ $.Env.GitReference }}" + {{ if $.Env.GitTarget }} + target = "{{ $.Env.GitTarget }}" + {{ end }} + + [groups.build_config] + path = "./go/" + build_base_image = 'golang:{{ .GoVersion }}-buster' + modfile = "{{ .Modfile }}" + + [groups.build_config.dockerfile_extensions] + # deal with dependency changes in master until we create the new vx.y.z instance + pre_build = """ + RUN cd ${PLAN_DIR} && \ + go mod download github.com/libp2p/go-libp2p && \ + go mod tidy -compat={{ .GoVersion }} + """ + {{ end }} + {{ end }} + {{ end }} +{{ end }} + +{{ with (load_resource "./rust.toml") }} + {{ with (index .groups 0) }} + [[groups]] + id = "rust-latest-{{ .Id }}" + instances = { count = 1 } + builder = "docker:generic" + + [groups.build_config] + path = "./rust/" + + [groups.build_config.build_args] + CARGO_FEATURES = '{{ .CargoFeatures }}' + {{ end }} + + {{ if eq $.Env.InteropTarget "rust" }} + {{ if $.Env.GitReference }} + {{ with .custom }} + [[groups]] + id = "rust-custom-{{ $.Env.GitReference }}" + instances = { count = 1 } + builder = "docker:generic" + + [groups.build_config] + path = "./rust/" + + [groups.build_config.build_args] + CARGO_FEATURES = '{{ .CargoFeatures }}' + CARGO_REMOVE = '{{ .CargoFeatures }}' + CARGO_PATCH = """ + {{ .CargoFeatures }} = {package = "libp2p", git = "https://{{ or $.Env.GitTarget "github.com/libp2p/rust-libp2p" }}", rev = "{{ $.Env.GitReference }}", default_features = false, features = [ "websocket", "mplex", "yamux", "tcp", "ping", "noise", "dns", "async-std", "rsa" ], optional = true} + """ + {{ end }} + {{ end }} + {{ end }} +{{ end }} + +[[groups]] +id = "nim-latest" +instances = { count = 1 } +builder = "docker:generic" + +[groups.build_config] + path = "./nim/" diff --git a/ping/nim/Dockerfile b/ping/nim/Dockerfile index 05f28e1a7..12ee2a477 100644 --- a/ping/nim/Dockerfile +++ b/ping/nim/Dockerfile @@ -1,10 +1,11 @@ FROM nimlang/nim:alpine as builder -RUN nimble install -y "https://github.com/status-im/testground-nim-sdk@#9fba8111179c2ace7a2b595d8ed8cb10f0bf9c21" +RUN nimble install -y "https://github.com/status-im/testground-nim-sdk@#c282ff68c08ef85a7ca011e077e3e69eb1a6edec" RUN nimble install -y "libp2p" FROM builder -COPY . . +ARG PLAN_PATH="./" +COPY ./plan/${PLAN_PATH} ./plan RUN cd plan && nimble install -dy && nim c -d:chronicles_log_level=NOTICE main.nim ENTRYPOINT ["plan/main"] diff --git a/ping/nim/main.nim b/ping/nim/main.nim index bbf7d3308..6c2ef5845 100644 --- a/ping/nim/main.nim +++ b/ping/nim/main.nim @@ -5,19 +5,29 @@ import sequtils type PeerData = object - id: string - addrs: seq[string] + id {.serializedFieldName: "ID".}: string + addrs {.serializedFieldName: "Addrs".}: seq[string] testground(client): let addresses = getInterfaces().filterIt(it.name == "eth1").mapIt(it.addresses) if addresses.len < 1 or addresses[0].len < 1: quit "Can't find local ip!" + discard await client.signal("initialized_global") + let maxLatency = client.param(int, "max_latency_ms") rng = libp2p.newRng() address = addresses[0][0].host - switch = newStandardSwitch(addrs = MultiAddress.init(address).tryGet(), rng = rng) + switch = + SwitchBuilder + .new() + .withAddress(MultiAddress.init(address).tryGet()) + .withRng(rng) + .withYamux() + .withTcpTransport() + .withNoise() + .build() pingProtocol = Ping.new(rng = rng) switch.mount(pingProtocol) From 311e8d4f59ea263f7267e749c9d6b040cdf3645f Mon Sep 17 00:00:00 2001 From: Tanguy Date: Tue, 8 Nov 2022 14:16:10 +0100 Subject: [PATCH 3/7] Add nim toml --- ping/_compositions/all-interop-latest.toml | 36 ++++++++++++++++++---- ping/_compositions/nim.toml | 6 ++++ ping/nim/Dockerfile | 7 +++-- 3 files changed, 41 insertions(+), 8 deletions(-) create mode 100644 ping/_compositions/nim.toml diff --git a/ping/_compositions/all-interop-latest.toml b/ping/_compositions/all-interop-latest.toml index 507ddce39..22852dfcf 100644 --- a/ping/_compositions/all-interop-latest.toml +++ b/ping/_compositions/all-interop-latest.toml @@ -100,10 +100,34 @@ {{ end }} {{ end }} -[[groups]] -id = "nim-latest" -instances = { count = 1 } -builder = "docker:generic" +{{ with (load_resource "./nim.toml") }} + {{ with (index .groups 0) }} + [[groups]] + id = "nim-latest-{{ .Id }}" + instances = { count = 1 } + builder = "docker:generic" + + [groups.build_config] + path = "./nim/" + [groups.build_config.build_args] + Libp2pVersion = '{{ .Id }}' + NimVersion = '{{ .NimVersion }}' + {{ end }} + + {{ if eq $.Env.InteropTarget "nim" }} + {{ if $.Env.GitReference }} + {{ with .custom }} + [[groups]] + id = "nim-custom-{{ $.Env.GitReference }}" + instances = { count = 1 } + builder = "docker:generic" -[groups.build_config] - path = "./nim/" + [groups.build_config] + path = "./nim/" + [groups.build_config.build_args] + Libp2pVersion = '#{{ $.Env.GitReference }}' + NimVersion = '{{ .NimVersion }}' + {{ end }} + {{ end }} + {{ end }} +{{ end }} diff --git a/ping/_compositions/nim.toml b/ping/_compositions/nim.toml new file mode 100644 index 000000000..8354f5b2f --- /dev/null +++ b/ping/_compositions/nim.toml @@ -0,0 +1,6 @@ +[custom] +NimVersion = "1.6.8" + +[[groups]] +Id = "1.0.0" +NimVersion = "1.6.8" diff --git a/ping/nim/Dockerfile b/ping/nim/Dockerfile index 12ee2a477..afedf3c73 100644 --- a/ping/nim/Dockerfile +++ b/ping/nim/Dockerfile @@ -1,7 +1,10 @@ -FROM nimlang/nim:alpine as builder +ARG NimVersion="latest" +FROM nimlang/nim:${NimVersion}-alpine as builder RUN nimble install -y "https://github.com/status-im/testground-nim-sdk@#c282ff68c08ef85a7ca011e077e3e69eb1a6edec" -RUN nimble install -y "libp2p" + +ARG Libp2pVersion="#unstable" +RUN nimble install -y "libp2p@${Libp2pVersion}" FROM builder ARG PLAN_PATH="./" From 446cf46b7da4c233ba9abebecc8e6e88849a8816 Mon Sep 17 00:00:00 2001 From: Tanguy Date: Tue, 8 Nov 2022 14:28:51 +0100 Subject: [PATCH 4/7] Add CI --- .github/workflows/ping-interop-all.yml | 45 +++++ ping/_compositions/all-interop-latest.toml | 2 +- ping/_compositions/all-interop.toml | 186 +++++++++++++++++++++ 3 files changed, 232 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/ping-interop-all.yml create mode 100644 ping/_compositions/all-interop.toml diff --git a/.github/workflows/ping-interop-all.yml b/.github/workflows/ping-interop-all.yml new file mode 100644 index 000000000..afd3f91a5 --- /dev/null +++ b/.github/workflows/ping-interop-all.yml @@ -0,0 +1,45 @@ +on: + workflow_dispatch: + inputs: + testground_endpoint: + type: string + required: false + description: testground endpoint + custom_git_reference: + description: the git commit or branch we're going to use for the custom target + required: false + type: string + custom_git_target: + description: the custom git fork url we're going to use for the custom target (github.com/some-fork/rust-libp2p) + required: false + type: string + custom_interop_target: + description: in the case of cross-implementation testing, the implementation target (go | rust | nim) + required: false + type: string + push: + pull_request: + +name: libp2p ping - go and rust test (all) with testground. + +jobs: + run-all-ping-latest: + uses: "./.github/workflows/run-composition.yml" + with: + composition_file: "ping/_compositions/all-interop-latest.toml" + custom_git_target: ${{ github.event.inputs.custom_git_target }} # nothing or "some-fork/go-libp2p" + custom_git_reference: ${{ github.event.inputs.custom_git_reference }} # a git reference + custom_interop_target: ${{ github.event.inputs.custom_interop_target }} # go | rust + testground_endpoint: ${{ github.event.inputs.testground_endpoint }} + test_repository: ${{ (github.event.inputs && '') || github.repository }} + test_ref: ${{ (github.event.inputs && '') || github.event.pull_request.head.sha || github.sha }} + run-all-ping-all: + uses: "./.github/workflows/run-composition.yml" + with: + composition_file: "ping/_compositions/all-interop.toml" + custom_git_target: ${{ github.event.inputs.custom_git_target }} # nothing or "some-fork/go-libp2p" + custom_git_reference: ${{ github.event.inputs.custom_git_reference }} # a git reference + custom_interop_target: ${{ github.event.inputs.custom_interop_target }} # go | rust + testground_endpoint: ${{ github.event.inputs.testground_endpoint }} + test_repository: ${{ (github.event.inputs && '') || github.repository }} + test_ref: ${{ (github.event.inputs && '') || github.event.pull_request.head.sha || github.sha }} diff --git a/ping/_compositions/all-interop-latest.toml b/ping/_compositions/all-interop-latest.toml index 22852dfcf..c0f405160 100644 --- a/ping/_compositions/all-interop-latest.toml +++ b/ping/_compositions/all-interop-latest.toml @@ -1,5 +1,5 @@ [metadata] - name = "go-rust-cross-version-{{ or $.Env.InteropTarget "-" }}-{{ or $.Env.GitReference "" }}" + name = "all-latest-{{ or $.Env.InteropTarget "-" }}-{{ or $.Env.GitReference "" }}" [global] plan = "libp2p/ping" diff --git a/ping/_compositions/all-interop.toml b/ping/_compositions/all-interop.toml new file mode 100644 index 000000000..f57ef2c01 --- /dev/null +++ b/ping/_compositions/all-interop.toml @@ -0,0 +1,186 @@ +[metadata] + name = "all-cross-version" + +[global] + plan = "libp2p/ping" + case = "ping" + runner = "local:docker" + concurrent_builds = 1 + + [global.build_config] + enable_go_build_cache = false # see https://github.com/testground/testground/issues/1361 + # disable testground's goproxy which hangs on github runners. + go_proxy_mode = "remote" + go_proxy_url = "https://proxy.golang.org" + +{{ with (load_resource "./go.toml") }} + {{ range .groups }} + [[groups]] + id = "{{ .Id }}" + instances = { count = 1 } + builder = "docker:go" + + [groups.build] + selectors = ['{{ .Selector }}'] + + [groups.build_config] + path = "./go/" + build_base_image = 'golang:{{ .GoVersion }}-buster' + modfile = "{{ .Modfile }}" + {{ end }} + + {{ with .master }} + [[groups]] + id = "master" + instances = { count = 1 } + builder = "docker:go" + + [groups.build] + selectors = ['{{ .Selector }}'] + + [[groups.build.dependencies]] + module = "github.com/libp2p/go-libp2p" + version = "master" + + [groups.build_config] + path = "./go/" + build_base_image = 'golang:{{ .GoVersion }}-buster' + modfile = "{{ .Modfile }}" + + [groups.build_config.dockerfile_extensions] + # deal with dependency changes in master until we create the new vx.y.z instance + pre_build = """ + RUN cd ${PLAN_DIR} && \ + go mod download github.com/libp2p/go-libp2p && \ + go mod tidy -compat={{ .GoVersion }} + """ + {{ end }} + + {{ if eq $.Env.InteropTarget "go" }} + {{ if $.Env.GitReference }} + {{ with .custom }} + [[groups]] + id = "custom-go" + instances = { count = 1 } + builder = "docker:go" + + [groups.build] + selectors = ['{{ .Selector }}'] + + [[groups.build.dependencies]] + module = "github.com/libp2p/go-libp2p" + version = "{{ $.Env.GitReference }}" + {{ if $.Env.GitTarget }} + target = "{{ $.Env.GitTarget }}" + {{ end }} + + [groups.build_config] + path = "./go/" + build_base_image = 'golang:{{ .GoVersion }}-buster' + modfile = "{{ .Modfile }}" + + [groups.build_config.dockerfile_extensions] + # deal with dependency changes in master until we create the new vx.y.z instance + pre_build = """ + RUN cd ${PLAN_DIR} && \ + go mod download github.com/libp2p/go-libp2p && \ + go mod tidy -compat={{ .GoVersion }} + """ + {{ end }} + {{ end }} + {{ end }} +{{ end }} + +{{ with (load_resource "./rust.toml") }} + {{ range .groups }} + [[groups]] + id = "rust-{{ .Id }}" + instances = { count = 1 } + builder = "docker:generic" + + [groups.build_config] + path = "./rust/" + + [groups.build_config.build_args] + CARGO_FEATURES = '{{ .CargoFeatures }}' + {{ end }} + + {{ with .master }} + [[groups]] + id = "rust-master" + instances = { count = 1 } + builder = "docker:generic" + + [groups.build_config] + path = "./rust/" + + [groups.build_config.build_args] + CARGO_FEATURES = '{{ .CargoFeatures }}' + {{ end }} + + {{ if eq $.Env.InteropTarget "rust" }} + {{ if $.Env.GitReference }} + {{ with .custom }} + [[groups]] + id = "custom-rust" + instances = { count = 1 } + builder = "docker:generic" + + [groups.build_config] + path = "./rust/" + + [groups.build_config.build_args] + CARGO_FEATURES = '{{ .CargoFeatures }}' + CARGO_REMOVE = '{{ .CargoFeatures }}' + CARGO_PATCH = """ + {{ .CargoFeatures }} = {package = "libp2p", git = "https://{{ or $.Env.GitTarget "github.com/libp2p/rust-libp2p" }}", rev = "{{ $.Env.GitReference }}", default_features = false, features = [ "websocket", "mplex", "yamux", "tcp", "ping", "noise", "dns", "async-std", "rsa" ], optional = true} + """ + {{ end }} + {{ end }} + {{ end }} +{{ end }} + +{{ with (load_resource "./nim.toml") }} + {{ range .groups }} + [[groups]] + id = "nim-latest-{{ .Id }}" + instances = { count = 1 } + builder = "docker:generic" + + [groups.build_config] + path = "./nim/" + [groups.build_config.build_args] + Libp2pVersion = '{{ .Id }}' + NimVersion = '{{ .NimVersion }}' + {{ end }} + + {{ with .custom }} + [[groups]] + id = "nim-unstable" + instances = { count = 1 } + builder = "docker:generic" + + [groups.build_config] + path = "./nim/" + [groups.build_config.build_args] + Libp2pVersion = '#unstable' + NimVersion = '{{ .NimVersion }}' + {{ end }} + + {{ if eq $.Env.InteropTarget "nim" }} + {{ if $.Env.GitReference }} + {{ with .custom }} + [[groups]] + id = "nim-custom-{{ $.Env.GitReference }}" + instances = { count = 1 } + builder = "docker:generic" + + [groups.build_config] + path = "./nim/" + [groups.build_config.build_args] + Libp2pVersion = '#{{ $.Env.GitReference }}' + NimVersion = '{{ .NimVersion }}' + {{ end }} + {{ end }} + {{ end }} +{{ end }} From ec04210113d6ac25dc6842a5eb153084aa20cd78 Mon Sep 17 00:00:00 2001 From: Tanguy Date: Wed, 9 Nov 2022 11:33:45 +0100 Subject: [PATCH 5/7] fix workflow name --- .github/workflows/ping-interop-all.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ping-interop-all.yml b/.github/workflows/ping-interop-all.yml index afd3f91a5..e288a7062 100644 --- a/.github/workflows/ping-interop-all.yml +++ b/.github/workflows/ping-interop-all.yml @@ -20,7 +20,7 @@ on: push: pull_request: -name: libp2p ping - go and rust test (all) with testground. +name: libp2p ping - all tests with testground. jobs: run-all-ping-latest: From 4234e61492a49a85bacc7398e842877a57eec68f Mon Sep 17 00:00:00 2001 From: Tanguy Date: Mon, 21 Nov 2022 17:17:15 +0100 Subject: [PATCH 6/7] Delete go-rust specifics --- .github/workflows/ping-interop-all.yml | 45 ------ .github/workflows/ping-interop-latest.yml | 10 +- .github/workflows/ping-interop.yml | 14 +- .../_compositions/go-rust-interop-latest.toml | 101 ------------- ping/_compositions/go-rust-interop.toml | 141 ------------------ 5 files changed, 12 insertions(+), 299 deletions(-) delete mode 100644 .github/workflows/ping-interop-all.yml delete mode 100644 ping/_compositions/go-rust-interop-latest.toml delete mode 100644 ping/_compositions/go-rust-interop.toml diff --git a/.github/workflows/ping-interop-all.yml b/.github/workflows/ping-interop-all.yml deleted file mode 100644 index e288a7062..000000000 --- a/.github/workflows/ping-interop-all.yml +++ /dev/null @@ -1,45 +0,0 @@ -on: - workflow_dispatch: - inputs: - testground_endpoint: - type: string - required: false - description: testground endpoint - custom_git_reference: - description: the git commit or branch we're going to use for the custom target - required: false - type: string - custom_git_target: - description: the custom git fork url we're going to use for the custom target (github.com/some-fork/rust-libp2p) - required: false - type: string - custom_interop_target: - description: in the case of cross-implementation testing, the implementation target (go | rust | nim) - required: false - type: string - push: - pull_request: - -name: libp2p ping - all tests with testground. - -jobs: - run-all-ping-latest: - uses: "./.github/workflows/run-composition.yml" - with: - composition_file: "ping/_compositions/all-interop-latest.toml" - custom_git_target: ${{ github.event.inputs.custom_git_target }} # nothing or "some-fork/go-libp2p" - custom_git_reference: ${{ github.event.inputs.custom_git_reference }} # a git reference - custom_interop_target: ${{ github.event.inputs.custom_interop_target }} # go | rust - testground_endpoint: ${{ github.event.inputs.testground_endpoint }} - test_repository: ${{ (github.event.inputs && '') || github.repository }} - test_ref: ${{ (github.event.inputs && '') || github.event.pull_request.head.sha || github.sha }} - run-all-ping-all: - uses: "./.github/workflows/run-composition.yml" - with: - composition_file: "ping/_compositions/all-interop.toml" - custom_git_target: ${{ github.event.inputs.custom_git_target }} # nothing or "some-fork/go-libp2p" - custom_git_reference: ${{ github.event.inputs.custom_git_reference }} # a git reference - custom_interop_target: ${{ github.event.inputs.custom_interop_target }} # go | rust - testground_endpoint: ${{ github.event.inputs.testground_endpoint }} - test_repository: ${{ (github.event.inputs && '') || github.repository }} - test_ref: ${{ (github.event.inputs && '') || github.event.pull_request.head.sha || github.sha }} diff --git a/.github/workflows/ping-interop-latest.yml b/.github/workflows/ping-interop-latest.yml index 435e679a6..eb21d9b0b 100644 --- a/.github/workflows/ping-interop-latest.yml +++ b/.github/workflows/ping-interop-latest.yml @@ -14,22 +14,22 @@ on: required: false type: string custom_interop_target: - description: in the case of cross-implementation testing, the implementation target (go | rust | ...) + description: in the case of cross-implementation testing, the implementation target (go | rust | nim) required: false type: string push: pull_request: -name: libp2p ping - go + rust test (latest) with testground. +name: libp2p ping - go + rust + nim test (latest) with testground. jobs: run-ping-latest: uses: "./.github/workflows/run-composition.yml" with: - composition_file: "ping/_compositions/go-rust-interop-latest.toml" + composition_file: "ping/_compositions/all-interop-latest.toml" custom_git_target: ${{ github.event.inputs.custom_git_target }} # nothing or "some-fork/go-libp2p" custom_git_reference: ${{ github.event.inputs.custom_git_reference }} # a git reference - custom_interop_target: ${{ github.event.inputs.custom_interop_target }} # go | rust + custom_interop_target: ${{ github.event.inputs.custom_interop_target }} # go | rust | nim testground_endpoint: ${{ github.event.inputs.testground_endpoint }} test_repository: ${{ (github.event.inputs && '') || github.repository }} - test_ref: ${{ (github.event.inputs && '') || github.event.pull_request.head.sha || github.sha }} \ No newline at end of file + test_ref: ${{ (github.event.inputs && '') || github.event.pull_request.head.sha || github.sha }} diff --git a/.github/workflows/ping-interop.yml b/.github/workflows/ping-interop.yml index 8e2fa32ee..0f6b0fce6 100644 --- a/.github/workflows/ping-interop.yml +++ b/.github/workflows/ping-interop.yml @@ -14,32 +14,32 @@ on: required: false type: string custom_interop_target: - description: in the case of cross-implementation testing, the implementation target (go | rust | ...) + description: in the case of cross-implementation testing, the implementation target (go | rust | nim) required: false type: string push: pull_request: -name: libp2p ping - go and rust test (all) with testground. +name: libp2p ping - go, rust and nim test (all) with testground. jobs: run-ping-latest: uses: "./.github/workflows/run-composition.yml" with: - composition_file: "ping/_compositions/go-rust-interop-latest.toml" + composition_file: "ping/_compositions/all-interop-latest.toml" custom_git_target: ${{ github.event.inputs.custom_git_target }} # nothing or "some-fork/go-libp2p" custom_git_reference: ${{ github.event.inputs.custom_git_reference }} # a git reference - custom_interop_target: ${{ github.event.inputs.custom_interop_target }} # go | rust + custom_interop_target: ${{ github.event.inputs.custom_interop_target }} # go | rust | nim testground_endpoint: ${{ github.event.inputs.testground_endpoint }} test_repository: ${{ (github.event.inputs && '') || github.repository }} test_ref: ${{ (github.event.inputs && '') || github.event.pull_request.head.sha || github.sha }} run-ping-all: uses: "./.github/workflows/run-composition.yml" with: - composition_file: "ping/_compositions/go-rust-interop.toml" + composition_file: "ping/_compositions/all-interop.toml" custom_git_target: ${{ github.event.inputs.custom_git_target }} # nothing or "some-fork/go-libp2p" custom_git_reference: ${{ github.event.inputs.custom_git_reference }} # a git reference - custom_interop_target: ${{ github.event.inputs.custom_interop_target }} # go | rust + custom_interop_target: ${{ github.event.inputs.custom_interop_target }} # go | rust | nim testground_endpoint: ${{ github.event.inputs.testground_endpoint }} test_repository: ${{ (github.event.inputs && '') || github.repository }} - test_ref: ${{ (github.event.inputs && '') || github.event.pull_request.head.sha || github.sha }} \ No newline at end of file + test_ref: ${{ (github.event.inputs && '') || github.event.pull_request.head.sha || github.sha }} diff --git a/ping/_compositions/go-rust-interop-latest.toml b/ping/_compositions/go-rust-interop-latest.toml deleted file mode 100644 index b34240d64..000000000 --- a/ping/_compositions/go-rust-interop-latest.toml +++ /dev/null @@ -1,101 +0,0 @@ -[metadata] - name = "go-rust-cross-version-{{ or $.Env.InteropTarget "-" }}-{{ or $.Env.GitReference "" }}" - -[global] - plan = "libp2p/ping" - case = "ping" - runner = "local:docker" - concurrent_builds = 1 - - [global.build_config] - enable_go_build_cache = false # see https://github.com/testground/testground/issues/1361 - # disable testground's goproxy which hangs on github runners. - go_proxy_mode = "remote" - go_proxy_url = "https://proxy.golang.org" - -{{ with (load_resource "./go.toml") }} - {{ with (index .groups 0) }} - [[groups]] - id = "go-latest-{{ .Id }}" - instances = { count = 1 } - builder = "docker:go" - - [groups.build] - selectors = ['{{ .Selector }}'] - - [groups.build_config] - path = "./go/" - build_base_image = 'golang:{{ .GoVersion }}-buster' - modfile = "{{ .Modfile }}" - {{ end }} - - {{ if eq $.Env.InteropTarget "go" }} - {{ if $.Env.GitReference }} - {{ with .custom }} - [[groups]] - id = "go-custom-{{ $.Env.GitReference }}" - instances = { count = 1 } - builder = "docker:go" - - [groups.build] - selectors = ['{{ .Selector }}'] - - [[groups.build.dependencies]] - module = "github.com/libp2p/go-libp2p" - version = "{{ $.Env.GitReference }}" - {{ if $.Env.GitTarget }} - target = "{{ $.Env.GitTarget }}" - {{ end }} - - [groups.build_config] - path = "./go/" - build_base_image = 'golang:{{ .GoVersion }}-buster' - modfile = "{{ .Modfile }}" - - [groups.build_config.dockerfile_extensions] - # deal with dependency changes in master until we create the new vx.y.z instance - pre_build = """ - RUN cd ${PLAN_DIR} && \ - go mod download github.com/libp2p/go-libp2p && \ - go mod tidy -compat={{ .GoVersion }} - """ - {{ end }} - {{ end }} - {{ end }} -{{ end }} - -{{ with (load_resource "./rust.toml") }} - {{ with (index .groups 0) }} - [[groups]] - id = "rust-latest-{{ .Id }}" - instances = { count = 1 } - builder = "docker:generic" - - [groups.build_config] - path = "./rust/" - - [groups.build_config.build_args] - CARGO_FEATURES = '{{ .CargoFeatures }}' - {{ end }} - - {{ if eq $.Env.InteropTarget "rust" }} - {{ if $.Env.GitReference }} - {{ with .custom }} - [[groups]] - id = "rust-custom-{{ $.Env.GitReference }}" - instances = { count = 1 } - builder = "docker:generic" - - [groups.build_config] - path = "./rust/" - - [groups.build_config.build_args] - CARGO_FEATURES = '{{ .CargoFeatures }}' - CARGO_REMOVE = '{{ .CargoFeatures }}' - CARGO_PATCH = """ - {{ .CargoFeatures }} = {package = "libp2p", git = "https://{{ or $.Env.GitTarget "github.com/libp2p/rust-libp2p" }}", rev = "{{ $.Env.GitReference }}", default_features = false, features = [ "websocket", "mplex", "yamux", "tcp", "ping", "noise", "dns", "async-std", "rsa" ], optional = true} - """ - {{ end }} - {{ end }} - {{ end }} -{{ end }} diff --git a/ping/_compositions/go-rust-interop.toml b/ping/_compositions/go-rust-interop.toml deleted file mode 100644 index 83d58c204..000000000 --- a/ping/_compositions/go-rust-interop.toml +++ /dev/null @@ -1,141 +0,0 @@ -[metadata] - name = "go-rust-cross-version" - -[global] - plan = "libp2p/ping" - case = "ping" - runner = "local:docker" - concurrent_builds = 1 - - [global.build_config] - enable_go_build_cache = false # see https://github.com/testground/testground/issues/1361 - # disable testground's goproxy which hangs on github runners. - go_proxy_mode = "remote" - go_proxy_url = "https://proxy.golang.org" - -{{ with (load_resource "./go.toml") }} - {{ range .groups }} - [[groups]] - id = "{{ .Id }}" - instances = { count = 1 } - builder = "docker:go" - - [groups.build] - selectors = ['{{ .Selector }}'] - - [groups.build_config] - path = "./go/" - build_base_image = 'golang:{{ .GoVersion }}-buster' - modfile = "{{ .Modfile }}" - {{ end }} - - {{ with .master }} - [[groups]] - id = "master" - instances = { count = 1 } - builder = "docker:go" - - [groups.build] - selectors = ['{{ .Selector }}'] - - [[groups.build.dependencies]] - module = "github.com/libp2p/go-libp2p" - version = "master" - - [groups.build_config] - path = "./go/" - build_base_image = 'golang:{{ .GoVersion }}-buster' - modfile = "{{ .Modfile }}" - - [groups.build_config.dockerfile_extensions] - # deal with dependency changes in master until we create the new vx.y.z instance - pre_build = """ - RUN cd ${PLAN_DIR} && \ - go mod download github.com/libp2p/go-libp2p && \ - go mod tidy -compat={{ .GoVersion }} - """ - {{ end }} - - {{ if eq $.Env.InteropTarget "go" }} - {{ if $.Env.GitReference }} - {{ with .custom }} - [[groups]] - id = "custom-go" - instances = { count = 1 } - builder = "docker:go" - - [groups.build] - selectors = ['{{ .Selector }}'] - - [[groups.build.dependencies]] - module = "github.com/libp2p/go-libp2p" - version = "{{ $.Env.GitReference }}" - {{ if $.Env.GitTarget }} - target = "{{ $.Env.GitTarget }}" - {{ end }} - - [groups.build_config] - path = "./go/" - build_base_image = 'golang:{{ .GoVersion }}-buster' - modfile = "{{ .Modfile }}" - - [groups.build_config.dockerfile_extensions] - # deal with dependency changes in master until we create the new vx.y.z instance - pre_build = """ - RUN cd ${PLAN_DIR} && \ - go mod download github.com/libp2p/go-libp2p && \ - go mod tidy -compat={{ .GoVersion }} - """ - {{ end }} - {{ end }} - {{ end }} -{{ end }} - -{{ with (load_resource "./rust.toml") }} - {{ range .groups }} - [[groups]] - id = "rust-{{ .Id }}" - instances = { count = 1 } - builder = "docker:generic" - - [groups.build_config] - path = "./rust/" - - [groups.build_config.build_args] - CARGO_FEATURES = '{{ .CargoFeatures }}' - {{ end }} - - {{ with .master }} - [[groups]] - id = "rust-master" - instances = { count = 1 } - builder = "docker:generic" - - [groups.build_config] - path = "./rust/" - - [groups.build_config.build_args] - CARGO_FEATURES = '{{ .CargoFeatures }}' - {{ end }} - - {{ if eq $.Env.InteropTarget "rust" }} - {{ if $.Env.GitReference }} - {{ with .custom }} - [[groups]] - id = "custom-rust" - instances = { count = 1 } - builder = "docker:generic" - - [groups.build_config] - path = "./rust/" - - [groups.build_config.build_args] - CARGO_FEATURES = '{{ .CargoFeatures }}' - CARGO_REMOVE = '{{ .CargoFeatures }}' - CARGO_PATCH = """ - {{ .CargoFeatures }} = {package = "libp2p", git = "https://{{ or $.Env.GitTarget "github.com/libp2p/rust-libp2p" }}", rev = "{{ $.Env.GitReference }}", default_features = false, features = [ "websocket", "mplex", "yamux", "tcp", "ping", "noise", "dns", "async-std", "rsa" ], optional = true} - """ - {{ end }} - {{ end }} - {{ end }} -{{ end }} From c535e02fbf83682c778324f91c9bdccb6fdffcce Mon Sep 17 00:00:00 2001 From: Tanguy Date: Wed, 23 Nov 2022 21:03:51 +0100 Subject: [PATCH 7/7] Update .github/workflows/ping-interop-latest.yml Co-authored-by: Max Inden --- .github/workflows/ping-interop-latest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ping-interop-latest.yml b/.github/workflows/ping-interop-latest.yml index eb21d9b0b..1f3c2348e 100644 --- a/.github/workflows/ping-interop-latest.yml +++ b/.github/workflows/ping-interop-latest.yml @@ -20,7 +20,7 @@ on: push: pull_request: -name: libp2p ping - go + rust + nim test (latest) with testground. +name: libp2p ping - go, rust and nim test (latest) with testground. jobs: run-ping-latest: