Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
6548fa1
ping/go: fix composition name
laurentsenta Jul 6, 2022
6505fbe
ping/rust: introduce the ping/rust test
laurentsenta Jun 14, 2022
8db58ae
ping/rust: experiment with master & current groups
laurentsenta Jul 7, 2022
ce08c04
ping/rust/src/main: Simplify import across versions
mxinden Jul 13, 2022
62c913f
ping/rust/src/main: Remove commented out code
mxinden Jul 13, 2022
b166cfa
ping/rust/src/main: Clean up
mxinden Jul 14, 2022
da17abb
ping/rust/Dockerfile: Update crates.io index in separate step
mxinden Jul 14, 2022
338e22a
ping/rust/Dockerfile: Don't both build and install
mxinden Jul 14, 2022
4c36fec
ping/rust/src/main: Clean up log lines
mxinden Jul 14, 2022
2f30015
ping/rust: Implement iterations with latency
mxinden Jul 18, 2022
e94f268
ping/rust/src/main: Extract signal and wait logic into fn
mxinden Jul 20, 2022
facd46e
ping/rust/Dockerfile: import caching fixes
laurentsenta Jul 21, 2022
b30658e
ping/: add cross-version composition
laurentsenta Jul 20, 2022
05fa641
ping/rust: add json payloads fix
laurentsenta Jul 26, 2022
a9102c5
ping/rust: match iterations id with go
laurentsenta Jul 29, 2022
f630758
ping/rust/Dockerfile: improve caching
laurentsenta Aug 3, 2022
bbcd949
ci: introduce workflow ping-interop-rust
laurentsenta Aug 3, 2022
646748b
ping/interop: update latest versions
laurentsenta Aug 3, 2022
21f3a58
ping/_compositions: add full ping interop
laurentsenta Aug 3, 2022
d0a8b8f
ci: resolve git reference to sha
laurentsenta Aug 5, 2022
631215e
ping/rust/Dockerfile: drop cargo output
laurentsenta Aug 5, 2022
706bd1b
ping/rust: drop version indirection
laurentsenta Aug 5, 2022
2dac3be
ping/rust/Dockerfile: fix features to support caching
laurentsenta Aug 5, 2022
5c1c716
ping/rust/Dockerfile: do not cache the rewritten package
laurentsenta Aug 5, 2022
152d14b
ping/_compositions/*: use concurrent_builds
laurentsenta Aug 9, 2022
a547468
ping/_compositions/*: drop test_instances count
laurentsenta Aug 9, 2022
23568b2
ci: build composition then run
laurentsenta Aug 9, 2022
1f723c0
ping: introduce InteropTarget option
laurentsenta Aug 10, 2022
38f0f14
ci: fix interop target & build
laurentsenta Aug 11, 2022
3e9439c
ping/_compositions/*: introduce load_resource
laurentsenta Aug 11, 2022
92c9e63
ci: 10 minutes timeout for the run step
laurentsenta Aug 11, 2022
4e05400
README: add update instruction for rust & clean go
laurentsenta Aug 11, 2022
ef66b36
ping/rust/Dockerfile: add protocol buffer compiler
laurentsenta Aug 18, 2022
4ae0020
ping/rust/Cargo.lock: cargo update packages
laurentsenta Aug 19, 2022
dcce2f5
.github: increase testground timeout
laurentsenta Aug 19, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/setup-testground/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ runs:
cat <<EOF >> ~/testground/.env.toml

[daemon.scheduler]
task_timeout_min = 30
task_timeout_min = 60
EOF
testground daemon > testground.out 2> testground.err &
fi;
2 changes: 1 addition & 1 deletion .github/workflows/ping-interop-go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ jobs:
with:
composition_file: "ping/_compositions/go-cross-versions.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_git_reference: ${{ github.event.inputs.custom_git_reference }} # a git branch
testground_endpoint: ${{ github.event.inputs.testground_endpoint }}
30 changes: 30 additions & 0 deletions .github/workflows/ping-interop-rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
on:
workflow_dispatch:
inputs:
testground_endpoint:
type: string
required: false
description: testground endpoint
custom_git_reference:
type: string
required: false
description: rust ref
custom_git_target:
type: string
required: false
description: repository to use as replace target
default: github.com/libp2p/rust-libp2p

name: rust-libp2p ping - rust test with testground.

jobs:
run-libp2p-test-plans:
# If you intend to use this workflow from another repo,
# you need to pass the repo and the version:
# uses: "libp2p/test-plans/.github/workflows/run-composition.yml@master"
uses: "./.github/workflows/run-composition.yml"
with:
composition_file: "ping/_compositions/rust-cross-versions.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
testground_endpoint: ${{ github.event.inputs.testground_endpoint }}
39 changes: 39 additions & 0 deletions .github/workflows/ping-interop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
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 | ...)
required: false
type: string

name: libp2p ping - go and rust test with testground.

jobs:
run-ping-latest:
uses: "./.github/workflows/run-composition.yml"
with:
composition_file: "ping/_compositions/go-rust-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 }}
run-ping-all:
uses: "./.github/workflows/run-composition.yml"
with:
composition_file: "ping/_compositions/go-rust-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 }}
34 changes: 30 additions & 4 deletions .github/workflows/run-composition.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,19 @@ on:
workflow_call:
inputs:
composition_file:
description: the workflow we're going to run
required: true
type: string
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 | ...)
required: false
type: string
testground_endpoint:
Expand Down Expand Up @@ -39,20 +46,39 @@ jobs:
working-directory: ./test-plans
run: |
testground plan import --from ./ --name libp2p
- name: Resolve the git references
if: ${{ inputs.custom_git_reference && inputs.custom_git_target }}
id: resolve_reference
working-directory: ./test-plans
run: |
git fetch https://${{ inputs.custom_git_target }} ${{ inputs.custom_git_reference }}
SHA=`git log FETCH_HEAD -n 1 --pretty=format:"%H"`
echo "::set-output name=custom_git_sha::${SHA}"
- name: Build the composition file
working-directory: ./test-plans
run: |
testground build composition \
-f ${{ inputs.composition_file }} \
--wait
env:
GitReference: ${{ steps.resolve_reference.outputs.custom_git_sha || inputs.custom_git_reference }}
GitTarget: ${{ inputs.custom_git_target }}
InteropTarget: ${{ inputs.custom_interop_target }}
- name: Run the composition file
working-directory: ./test-plans
timeout-minutes: 10
run: |
GitReference=${{ inputs.custom_git_reference }} \
GitTarget=${{ inputs.custom_git_target }} \
testground run composition \
testground run composition \
-f ${{ inputs.composition_file }} \
--metadata-repo "${GITHUB_REPOSITORY}" \
--metadata-branch "${GITHUB_REF#refs/heads/}" \
--metadata-commit "${GITHUB_SHA}" \
--collect-file ./result.tgz \
--collect --wait
env:
GitReference: ${{ inputs.custom_git_reference }}
GitReference: ${{ steps.resolve_reference.outputs.custom_git_sha || inputs.custom_git_reference }}
GitTarget: ${{ inputs.custom_git_target }}
InteropTarget: ${{ inputs.custom_interop_target }}
- uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
Expand Down
26 changes: 20 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ This repository contains Testground test plans for libp2p components.

When a new version of libp2p is released, we want to make it permanent in the `ping/go` test folder.

1. In the `ping/_compositions/go-cross-versions.toml` file,
- Find the group for the latest version (`v0.20` for example) and copy it into a new group (`v0.21` for example).
- Update the `selectors` (go tags) and `modfile` options. Update the `build_base_image` if needed.
- Increment the `total_instances` flag (near line 7).
1. In the `ping/_compositions/go.toml` file,
- copy the `[master]` section and turn it into a `[[groups]]` item
- update the `[master]` section with the future version
2. In the `ping/go` folder,
- Add a new compatibility shim in `compat/` if needed, or add your new selector to the latest shim (see `compat/libp2p.v0.17.go` for example).
- Create the new mod and sum files (`go.v0.21.mod` for example). Assuming you're updating from `v$A` to `v$B`, a simple way to do this is to:
Expand All @@ -21,8 +20,23 @@ When a new version of libp2p is released, we want to make it permanent in the `p
- update the `go-libp2p` version, go version, and update the code if needed.
- then `go get -tags v$B && go mod tidy`
3. Run the test on your machine
- Import the test-plans with `testground plan import ./ --name libp2p` (once, from the test-plans root)
- Run with `testground run composition -f ping/_compositions/go-cross-versions.toml --wait`
- Do once, from the test-plans root: import the test-plans with `testground plan import ./ --name libp2p`
- Run the test with `testground run composition -f ping/_compositions/go-cross-versions.toml --wait`

## How to add a new version to ping/rust
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀


When a new version of libp2p is released, we want to make it permanent in the `ping/rust` test folder.

1. In the `ping/_compositions/rust.toml` file,
- Copy the `[master]` section and turn it into a item in the `[[groups]]` array
- Update the `[master]` section with the new master version
2. In the `ping/rust` folder,
- `Cargo.toml`: update the feature flags `libp2pvxxx` to fix the released version and add the new `master`
- `src/main.rs`: Update the `mod libp2p` definition with the new master
- Run `cargo update` if needed. Try to build with `cargo build --features libp2pvxxx`
3. Run the test on your machine
- Do once, from the test-plans root: import the test-plans with `testground plan import ./ --name libp2p`
- Run the test with `testground run composition -f ping/_compositions/rust-cross-versions.toml --wait`

## License

Expand Down
175 changes: 69 additions & 106 deletions ping/_compositions/go-cross-versions.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
[metadata]
name = "go-cross-versions {{ .Env.Reference }}"
name = "go-cross-versions {{ .Env.GitReference }}"

[global]
plan = "libp2p/ping/go"
case = "ping"
total_instances = {{ if .Env.GitReference }}7{{ else }}6{{ end }}
builder = "docker:go"
runner = "local:docker"

Expand All @@ -14,108 +13,72 @@
go_proxy_mode = "remote"
go_proxy_url = "https://proxy.golang.org"

[[groups]]
id = "v0.11"
instances = { count = 1 }

[groups.build]
selectors = ['v0.11']

[groups.build_config]
build_base_image = 'golang:1.14-buster'
modfile = "go.v0.11.mod"

[[groups]]
id = "v0.17"
instances = { count = 1 }

[groups.build]
selectors = ['v0.17']

[groups.build_config]
build_base_image = 'golang:1.16-buster'
modfile = "go.v0.17.mod"

[[groups]]
id = "v0.19"
instances = { count = 1 }

[groups.build]
selectors = ['v0.19']

[groups.build_config]
build_base_image = 'golang:1.17-buster'
modfile = "go.v0.19.mod"

[[groups]]
id = "v0.20"
instances = { count = 1 }

[groups.build]
selectors = ['v0.20']

[groups.build_config]
build_base_image = 'golang:1.18-buster'
modfile = "go.v0.20.mod"

[[groups]]
id = "v0.21"
instances = { count = 1 }

[groups.build]
selectors = ['v0.21']

[groups.build_config]
build_base_image = 'golang:1.18-buster'
modfile = "go.v0.21.mod"

[[groups]]
id = "master"
instances = { count = 1 }

[groups.build]
selectors = ['v0.21']

[[groups.build.dependencies]]
module = "github.com/libp2p/go-libp2p"
version = "master"

[groups.build_config]
build_base_image = 'golang:1.18-buster'
modfile = "go.v0.21.mod"

[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=1.18
"""

{{ if .Env.GitReference }}
[[groups]]
id = "custom"
instances = { count = 1 }

[groups.build]
selectors = ['v0.20']

[[groups.build.dependencies]]
module = "github.com/libp2p/go-libp2p"
version = "{{ .Env.GitReference }}"
{{ if .Env.GitTarget }}
target = "{{ .Env.GitTarget }}"
{{ end }}

[groups.build_config]
build_base_image = 'golang:1.18-buster'
modfile = "go.v0.20.mod"

[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=1.18
"""
{{ with (load_resource "./go.toml" ) }}
{{ range .groups }}
[[groups]]
id = "{{ .Id }}"
instances = { count = 1 }

[groups.build]
selectors = ['{{ .Selector }}']

[groups.build_config]
build_base_image = 'golang:{{ .GoVersion }}-buster'
modfile = "{{ .Modfile }}"
{{ end }}

{{ with .master }}
[[groups]]
id = "master"
instances = { count = 1 }

[groups.build]
selectors = ['{{ .Selector }}']

[[groups.build.dependencies]]
module = "github.com/libp2p/go-libp2p"
version = "master"

[groups.build_config]
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 $.Env.GitReference }}
{{ with .custom }}
[[groups]]
id = "custom"
instances = { count = 1 }

[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]
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 }}
Loading