Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ci): Add a markdown test report to interchaintests #3489

Merged
merged 1 commit into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
45 changes: 40 additions & 5 deletions .github/workflows/interchain-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
echo "tag_name=${{ github.event.client_payload.tag_name }}" | tee -a $GITHUB_OUTPUT
else
echo "ref_name=${{ github.ref_name }}" | tee -a $GITHUB_OUTPUT
echo "tag_name=${{ github.ref_name }}" | tee -a $GITHUB_OUTPUT
echo "tag_name=${{ github.ref_name }}" | sed 's~/~-~g' | tee -a $GITHUB_OUTPUT
fi
- name: Check out repository code
uses: actions/checkout@v4
Expand Down Expand Up @@ -57,8 +57,43 @@ jobs:
TEST_NEW_GAIA_IMAGE_VERSION: "${{ matrix.test_version }}"
TEST_UPGRADE_NAME: "${{ matrix.upgrade_name }}"
run: |
# This docker pull/tag is a quick hack only necessary for v19, since there were no official v18 images built.
# Once we're testing 19 -> 20 this can be removed
docker pull "ghcr.io/hyphacoop/gaia:v18.1.0" && docker tag "ghcr.io/hyphacoop/gaia:v18.1.0" "ghcr.io/${{ github.repository_owner }}/gaia:v18.1.0"
cd ./tests/interchain
go test -v ./... -failfast -p 1 -timeout 5h -run="^${{ matrix.test_name }}"
go install github.com/mfridman/tparse@latest
set -o pipefail
go test -v ./... -failfast -p 1 -timeout 5h -run="^${{ matrix.test_name }}" -json | tee ../../output-${{ matrix.previous_version }}-${{ matrix.test_name }}.json | tparse -follow -all
- name: Upload output
uses: actions/upload-artifact@v4
if: always()
with:
name: output-${{ matrix.previous_version }}-${{ matrix.test_name }}
path: output-${{ matrix.previous_version }}-${{ matrix.test_name }}.json
test-report:
needs: [test, prepare-matrix]
if: always()
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: ./outputs
- name: Setup go
uses: actions/setup-go@v5
- name: Prep report
env:
TEST_MATRIX: ${{ needs.prepare-matrix.outputs.matrix }}
run: |
go install github.com/becheran/go-testreport@latest
TEST_VERSION=$(echo "$TEST_MATRIX" | jq -r '.test_version[0]')
UPGRADE_NAME=$(echo "$TEST_MATRIX" | jq -r '.upgrade_name[0]')
echo "$TEST_MATRIX" | jq -r '.previous_version[]' | while read PREV_VERSION; do
cat ./outputs/output-${PREV_VERSION}-*/*.json > combined-${PREV_VERSION}.json
go-testreport -vars="Title:${PREV_VERSION} -> ${UPGRADE_NAME} (${TEST_VERSION})" "test-report-${PREV_VERSION}.md" < "combined-${PREV_VERSION}.json" || true
echo '' >> test-report-${PREV_VERSION}.md
done
cat test-report-*.md > test-report.md
cat test-report.md > $GITHUB_STEP_SUMMARY
- name: Upload output
uses: actions/upload-artifact@v4
with:
name: test-report
path: test-report.md
10 changes: 6 additions & 4 deletions tests/interchain/matrix_tool/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func GetPreviousMajorMinor(ctx context.Context, testVersion string) (previousVer
org = "cosmos"
}
client := github.NewClient(nil)
releaes, _, err := client.Repositories.ListReleases(ctx, org, "gaia", nil)
releases, _, err := client.Repositories.ListReleases(ctx, org, "gaia", nil)
if err != nil {
err = fmt.Errorf("ListReleases failed: %w", err)
return
Expand All @@ -40,8 +40,8 @@ func GetPreviousMajorMinor(ctx context.Context, testVersion string) (previousVer
err = fmt.Errorf("failed to parse major version: %w", err)
return
}
semvers := make([]string, 0, len(releaes))
for _, release := range releaes {
semvers := make([]string, 0, len(releases))
for _, release := range releases {
semvers = append(semvers, release.GetTagName())
}
var previousMinor, previousRc bool
Expand Down Expand Up @@ -97,6 +97,7 @@ func GetSemverForBranch() (string, error) {

func GetTestList() ([]string, error) {
retval := []string{}
uniq := map[string]bool{}
cmd := exec.Command("go", "test", "-list=.", "./...")
out, err := cmd.Output()
if err != nil {
Expand All @@ -105,8 +106,9 @@ func GetTestList() ([]string, error) {
}
lines := strings.Split(string(out), "\n")
for _, line := range lines {
if strings.HasPrefix(line, "Test") {
if strings.HasPrefix(line, "Test") && !uniq[line] {
retval = append(retval, line)
uniq[line] = true
}
}
rand.Shuffle(len(retval), func(i, j int) {
Expand Down
Loading