Skip to content

Commit 1080fb6

Browse files
author
nareshmmr
committed
base 3 commit
1 parent 7c17584 commit 1080fb6

File tree

76 files changed

+1095
-246
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+1095
-246
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# This pipeline aggregates summary of Dependabot PRs for all our dependants
2+
# Used to analyze major and alpha releases
3+
name: Consumers Dependabot Updates
4+
5+
on:
6+
schedule:
7+
- cron: '0 10 * * *'
8+
workflow_dispatch:
9+
10+
jobs:
11+
find_dependabot_prs:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
- name: Set up jq for JSON parsing
17+
run: |
18+
sudo apt-get install -y jq
19+
- name: Find Dependabot PRs
20+
env:
21+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22+
run: |
23+
# Define the list of repositories
24+
repos=(
25+
"goplugin/pluginv3.0"
26+
"goplugin/plugin-solana"
27+
"goplugin/plugin-cosmos"
28+
"goplugin/plugin-starknet"
29+
"goplugin/.github"
30+
"goplugin/ccip"
31+
)
32+
33+
# Define the list of packages to search for
34+
pkgs=(
35+
"github.com/goplugin/plugin-testing-framework/lib"
36+
"github.com/goplugin/plugin-testing-framework/wasp"
37+
"github.com/goplugin/plugin-testing-framework/havoc"
38+
"github.com/goplugin/plugin-testing-framework/seth"
39+
"github.com/goplugin/plugin-testing-framework/k8s-test-runner"
40+
)
41+
42+
# Initialize the summary with a heading
43+
echo "# Dependabot PRs for Bumping Dependencies" >> "$GITHUB_STEP_SUMMARY"
44+
45+
# Loop through each repository and package
46+
for repo in "${repos[@]}"; do
47+
for pkg in "${pkgs[@]}"; do
48+
# Construct the title pattern to search for
49+
title_pattern="Bump $pkg from"
50+
51+
# Print the repository and package in the summary
52+
echo "### Repository: ${repo}, Dependent: ${pkg}" >> "$GITHUB_STEP_SUMMARY"
53+
54+
# Search for PRs matching the pattern
55+
prs=$(gh pr list --repo "$repo" --search "$title_pattern" --json title,url)
56+
57+
# If no PRs found, print a message
58+
if [ -z "$prs" ]; then
59+
echo "No PRs found for $pkg in $repo" >> "$GITHUB_STEP_SUMMARY"
60+
else
61+
# Print the PRs in the summary
62+
echo "$prs" | jq -r '.[] | "- [\(.title)](\(.url))"' >> "$GITHUB_STEP_SUMMARY"
63+
fi
64+
done
65+
done
66+
67+
- name: Print Summary
68+
run: cat "$GITHUB_STEP_SUMMARY"
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Main branch breaking changes check
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
breaking-changes:
10+
name: Check "main" for breaking changes before release
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v3
16+
with:
17+
fetch-depth: 0
18+
fetch-tags: true
19+
- name: Set up Go 1.22.6
20+
uses: actions/setup-go@v4
21+
with:
22+
go-version: '1.22.6'
23+
- name: Install gorelease tool
24+
run: |
25+
go install golang.org/x/exp/cmd/gorelease@latest
26+
- name: Run Breaking Changes Script
27+
run: |
28+
go run ./tools/breakingchanges/cmd/main.go --ignore tools
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
# Common release pipeline that triggers on package tags:
2+
# - Prepare a release for a package $pkg/vX.X.X, collect commits info and changelog
3+
# - Create a GitHub release and combine all release notes
4+
# - Builds a binary for common platforms if package have "cmd" directory
5+
name: Release Go module
6+
on:
7+
push:
8+
tags:
9+
- '*/v*.*.*' # Trigger only on tags with the format $package/vX.X.X
10+
11+
permissions:
12+
contents: write
13+
packages: write
14+
15+
jobs:
16+
release_binaries:
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
platform: ['linux', 'darwin']
21+
goarch: ['amd64', 'arm64']
22+
name: Release multi-platform
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v3
26+
with:
27+
fetch-depth: 0
28+
fetch-tags: true
29+
- name: Extract Package Name from Tag
30+
id: extract_package_name
31+
run: |
32+
TAG_REF="${GITHUB_REF#refs/tags/}"
33+
PACKAGE_NAME=$(echo "$TAG_REF" | cut -d'/' -f1)
34+
VERSION=$(echo "$TAG_REF" | cut -d'/' -f2)
35+
echo "Tag Reference: $TAG_REF"
36+
echo "Package Name: $PACKAGE_NAME"
37+
echo "Version: $VERSION"
38+
39+
echo "PACKAGE_NAME=$PACKAGE_NAME" >> "$GITHUB_ENV"
40+
echo "VERSION=$VERSION" >> "$GITHUB_ENV"
41+
- name: Find Last Tag for Package and Generate Release Notes
42+
id: generate_release_notes
43+
run: |
44+
# Extract the package name and version from the tag
45+
TAG_REF="${GITHUB_REF#refs/tags/}"
46+
PACKAGE_NAME=$(echo "$TAG_REF" | cut -d'/' -f1)
47+
VERSION=$(echo "$TAG_REF" | cut -d'/' -f2)
48+
49+
# Find the latest tag for the same package that is not the current tag
50+
LAST_TAG=$(git describe --abbrev=0 --match "$PACKAGE_NAME/v*" --tags $(git rev-list --tags --skip=1 --max-count=1))
51+
echo "Last tag: ${LAST_TAG}"
52+
53+
# If no previous tag is found, use the initial commit as the reference
54+
if [ -z "$LAST_TAG" ]; then
55+
LAST_TAG=$(git rev-list --max-parents=0 HEAD)
56+
fi
57+
58+
# Extract the version part of the last tag
59+
LAST_TAG_VERSION=$(echo "$LAST_TAG" | cut -d'/' -f2)
60+
echo "Last tag version: $LAST_TAG_VERSION"
61+
echo "LAST_TAG_VERSION=${LAST_TAG_VERSION}" >> "$GITHUB_ENV"
62+
63+
# Get the commits between the last tag and the current tag that are in the directory scope
64+
COMMITS=$(git log "$LAST_TAG..$PACKAGE_NAME/$VERSION" --pretty=format:"- %s (%h)" -- "$PACKAGE_NAME")
65+
66+
# Output the release notes
67+
echo "Commits:"
68+
echo "$COMMITS"
69+
70+
# Safely set the release notes as an environment variable using heredoc and EOF
71+
echo "COMMITS<<EOF" >> "$GITHUB_ENV"
72+
echo "$COMMITS" >> "$GITHUB_ENV"
73+
echo "EOF" >> "$GITHUB_ENV"
74+
- name: Set up Go
75+
uses: actions/setup-go@v5
76+
with:
77+
go-version: '1.22.6'
78+
- name: Install gorelease tool
79+
run: |
80+
go install golang.org/x/exp/cmd/gorelease@latest
81+
- name: Run gorelease to check for breaking changes
82+
working-directory: ${{ env.PACKAGE_NAME }}
83+
id: check_breaking_changes
84+
run: |
85+
set +e # Disable exit on error to capture output even if the command fails
86+
echo "Last tag version: ${{ env.LAST_TAG_VERSION }}"
87+
echo "Current tag version: ${VERSION}"
88+
BREAKING_CHANGES=$(gorelease -base=${{ env.LAST_TAG_VERSION }} -version=${VERSION} 2>&1)
89+
echo "Breaking changes: ${BREAKING_CHANGES}"
90+
set -e # Re-enable exit on error for the subsequent steps
91+
echo "BREAKING_CHANGES<<EOF" >> "$GITHUB_ENV"
92+
echo "$BREAKING_CHANGES" >> "$GITHUB_ENV"
93+
echo "EOF" >> "$GITHUB_ENV"
94+
- name: Read Additional Release Notes from File
95+
if: always()
96+
working-directory: ${{ env.PACKAGE_NAME }}
97+
id: read_additional_notes
98+
run: |
99+
# Check if the .changeset directory exists and the file for the current version is present
100+
if [ -f ".changeset/${{ env.VERSION }}.md" ]; then
101+
# Read the content of the file
102+
RELEASE_NOTES=$(cat ".changeset/${{ env.VERSION }}.md")
103+
104+
# Format the release notes and breaking changes into FULL_RELEASE_NOTES
105+
echo "FULL_RELEASE_NOTES<<EOF" >> "$GITHUB_ENV"
106+
echo "## Release notes:" >> "$GITHUB_ENV"
107+
echo "$RELEASE_NOTES" >> "$GITHUB_ENV"
108+
echo "" >> "$GITHUB_ENV"
109+
echo "## Commits:" >> "$GITHUB_ENV"
110+
echo "${{ env.COMMITS }}" >> "$GITHUB_ENV"
111+
echo "" >> $GITHUB_ENV
112+
echo "## Breaking changes:" >> "$GITHUB_ENV"
113+
echo "${{ env.BREAKING_CHANGES }}" >> "$GITHUB_ENV"
114+
echo "EOF" >> "$GITHUB_ENV"
115+
else
116+
# Print error message and fail the pipeline if the file is not found
117+
echo "Error: Release notes file '.changeset/${{ env.VERSION }}.md' not found."
118+
exit 1
119+
fi
120+
121+
- name: Create GitHub Release
122+
env:
123+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
124+
run: |
125+
sudo apt-get install -y gh
126+
gh release create "${{ env.PACKAGE_NAME }}-${{ env.VERSION }}" --title "${{ env.PACKAGE_NAME }} ${{ env.VERSION }}" --notes "${{ env.FULL_RELEASE_NOTES }}" || true
127+
- name: Check if 'cmd' directory exists and set environment variable
128+
run: |
129+
if [ -f "$GITHUB_WORKSPACE/${{ env.PACKAGE_NAME }}/cmd/main.go" ]; then
130+
echo "CMD_ENTRYPOINT_EXISTS=true" >> "$GITHUB_ENV"
131+
else
132+
echo "CMD_ENTRYPOINT_EXISTS=false" >> "$GITHUB_ENV"
133+
fi
134+
- name: Build binary release
135+
uses: wangyoucao577/go-release-action@v1
136+
if: env.CMD_ENTRYPOINT_EXISTS == 'true'
137+
with:
138+
github_token: ${{ secrets.GITHUB_TOKEN }}
139+
goversion: '1.22.6'
140+
goos: ${{ matrix.platform }}
141+
goarch: ${{ matrix.goarch }}
142+
binary_name: ${{ env.PACKAGE_NAME }}
143+
release_name: ${{ env.PACKAGE_NAME }}
144+
release_tag: ${{ env.PACKAGE_NAME}}-${{ env.VERSION }}
145+
project_path: ${{ env.PACKAGE_NAME }}/cmd
146+
asset_name: ${{ env.PACKAGE_NAME }}-${{ env.VERSION }}-${{ matrix.platform }}-${{ matrix.goarch }}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,6 @@ __debug*
7676

7777
# asdf
7878
.tool-versions
79+
80+
import_keys_test.go
81+
tag.py

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
# Plugin Testing Framework
44

5+
[![Main branch breaking changes check](https://github.com/goplugin/plugin-testing-framework/actions/workflows/rc-breaking-changes.yaml/badge.svg)](https://github.com/goplugin/plugin-testing-framework/actions/workflows/rc-breaking-changes.yaml)
56
[![Lib tag](https://img.shields.io/github/v/tag/goplugin/plugin-testing-framework?filter=%2Alib%2A)](https://github.com/goplugin/plugin-testing-framework/tags)
67
[![WASP tag](https://img.shields.io/github/v/tag/goplugin/plugin-testing-framework?filter=%2Awasp%2A)](https://github.com/goplugin/plugin-testing-framework/tags)
78
[![Seth tag](https://img.shields.io/github/v/tag/goplugin/plugin-testing-framework?filter=%2Aseth%2A)](https://github.com/goplugin/plugin-testing-framework/tags)
@@ -22,6 +23,7 @@ If you're looking to implement a new chain integration for the testing framework
2223
# Content
2324

2425
1. [Libraries](#libraries)
26+
2. [Releasing](#releasing)
2527

2628
## Libraries
2729

@@ -30,4 +32,8 @@ CTF monorepository contains a set of libraries:
3032
- [Harness](lib/README.md) - Library to interact with different blockchains, create CL node jobs and use k8s and docker.
3133
- [WASP](wasp/README.md) - Scalable protocol-agnostic load testing library for `Go`
3234
- [Havoc](havoc/README.md) - Chaos testing library
33-
- [Seth](seth/README.md) - Ethereum client library with transaction tracing and gas bumping
35+
- [Seth](seth/README.md) - Ethereum client library with transaction tracing and gas bumping
36+
37+
## Releasing
38+
39+
We follow [SemVer](https://semver.org/) and follow best Go practices for releasing our modules, please follow the [instruction](RELEASE.md)

RELEASE.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
## Releasing Go modules
2+
3+
The Plugin Testing Framework (CTF) repository contains multiple independent modules. To release any of them, we follow some best practices about breaking changes.
4+
5+
### Release strategy
6+
7+
Use only [lightweight tags](https://git-scm.com/book/en/v2/Git-Basics-Tagging)
8+
9+
**Do not move tags between commits. If something need to be fixed increment patch or minor version.**
10+
11+
Steps to release:
12+
- When all your PRs are merged to `main` check the `main` branch [breaking changes badge](https://github.com/goplugin/plugin-testing-framework/actions/workflows/rc-breaking-changes.yaml)
13+
- If there are no breaking changes for external methods, create a branch and explain all your module changes in `vX.X.X.md` committed under `.changeset` dir in your module. If changes are really short, and you run the [script](#check-breaking-changes-locally) locally you can push `.changeset` as a part of your final feature PR
14+
- If there are accidental breaking changes, and it is possible to make them backward compatible - fix them
15+
- If there are breaking changes, and we must release them change `go.mod` path, add prefix `/vX`, merge your PR(s)
16+
- When all the changes are merged, and there are no breaking changes in the [pipeline](https://github.com/goplugin/plugin-testing-framework/actions/workflows/rc-breaking-changes.yaml) then proceed with releasing
17+
- Tag `main` branch in format `$pkg/$subpkg/vX.X.X` according to your changes and push it, example:
18+
```
19+
git tag $pkg/$subpkg/v1.1.0 && git push --tags
20+
git tag $pkg/$subpkg/v1.1.1 && git push --tags
21+
git tag $pkg/$subpkg/v2.0.0 && git push --tags
22+
```
23+
- Check the [release page](https://github.com/goplugin/plugin-testing-framework/releases)
24+
- To check how dependency changes can affect other repositories check dependabot [summary pipeline](https://github.com/goplugin/plugin-testing-framework/actions/workflows/dependabot-consumers-summary.yaml)
25+
26+
### Binary releases
27+
If your module have `cmd/main.go` we build binary automatically for various platforms and attach it to the release page.
28+
29+
## Debugging release pipeline and `gorelease` tool
30+
Checkout `dummy-release-branch` and release it:
31+
- `git tag dummy-module/v0.X.0`
32+
- Add `vX.X.X.md` in `.changeset`
33+
- `git push --no-verify --force && git push --tags`
34+
- Check [releases](https://github.com/goplugin/plugin-testing-framework/releases)
35+
36+
Pipelines:
37+
- [Main branch breaking changes](https://github.com/goplugin/plugin-testing-framework/actions/workflows/rc-breaking-changes.yaml)
38+
- [Pipeline for releasing Go modules](.github/workflows/release-go-module.yml)
39+
- [Dependabot summary pipeline](.github/workflows/dependabot-consumers-summary.yaml)
40+
41+
## Check breaking changes locally
42+
We have a simple wrapper to check breaking changes for all the packages. Commit all your changes and run:
43+
```
44+
go run ./tools/breakingchanges/cmd/main.go
45+
go run ./tools/breakingchanges/cmd/main.go --subdir wasp # check recursively starting with subdir
46+
go run ./tools/breakingchanges/cmd/main.go --ignore tools,wasp,havoc,seth # to ignore some packages
47+
```

havoc/.changeset/.gitkeep

Whitespace-only changes.

havoc/go.mod

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@ require (
88
github.com/chaos-mesh/chaos-mesh/api v0.0.0-20240821051457-da69c6d9617a
99
github.com/pkg/errors v0.9.1
1010
github.com/rs/zerolog v1.33.0
11-
//github.com/goplugin/plugin-testing-framework/lib/grafana v0.1.0
12-
github.com/goplugin/plugin-testing-framework/lib/grafana v0.0.1 //plugin latest update
13-
k8s.io/api v0.31.0
11+
//github.com/goplugin/plugin-testing-framework/lib/grafana v1.50.0
12+
github.com/goplugin/plugin-testing-framework/lib/grafana v0.1.1 //plugin update changes
1413
k8s.io/client-go v0.31.0
1514
sigs.k8s.io/controller-runtime v0.16.2
1615
)
@@ -78,3 +77,5 @@ require (
7877
)
7978

8079
replace sigs.k8s.io/controller-runtime => sigs.k8s.io/controller-runtime v0.19.0
80+
81+
retract [v1.999.0-test-release, v1.999.999-test-release]

havoc/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99
117117
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
118118
github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8=
119119
github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss=
120-
github.com/goplugin/plugin-testing-framework/lib/grafana v0.1.0 h1:gHX1EO+3lWcp7I3g9Om4fYvma+Cw1OZJzM4eteCsD5I=
121-
github.com/goplugin/plugin-testing-framework/lib/grafana v0.1.0/go.mod h1:WMcNL0ckaJbNrNbJJKxemhu3MMthJI7m2yBSsbQsyjI=
120+
github.com/goplugin/plugin-testing-framework/lib/grafana v1.50.0 h1:VIxK8u0Jd0Q/VuhmsNm6Bls6Tb31H/sA3A/rbc5hnhg=
121+
github.com/goplugin/plugin-testing-framework/lib/grafana v1.50.0/go.mod h1:lyAu+oMXdNUzEDScj2DXB2IueY+SDXPPfyl/kb63tMM=
122122
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
123123
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
124124
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=

k8s-test-runner/.changeset/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)