This commit is contained in:
Tanguy 2022-11-08 14:28:51 +01:00
parent 311e8d4f59
commit 446cf46b7d
No known key found for this signature in database
GPG Key ID: 7DD8EC6B6CE6C45E
3 changed files with 232 additions and 1 deletions

45
.github/workflows/ping-interop-all.yml vendored Normal file
View File

@ -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 }}

View File

@ -1,5 +1,5 @@
[metadata] [metadata]
name = "go-rust-cross-version-{{ or $.Env.InteropTarget "-" }}-{{ or $.Env.GitReference "" }}" name = "all-latest-{{ or $.Env.InteropTarget "-" }}-{{ or $.Env.GitReference "" }}"
[global] [global]
plan = "libp2p/ping" plan = "libp2p/ping"

View File

@ -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 }}