From 47be6be7dc21572a7502eee51f85f38ab8202f01 Mon Sep 17 00:00:00 2001 From: Cian Hatton Date: Mon, 4 Jul 2022 10:56:27 +0100 Subject: [PATCH 01/22] feat(e2e): adding script to dynamically generate list of e2e tests --- .github/scripts/build_test_matrix.go | 127 ++++++++++++++++++++ .github/scripts/build_test_matrix_test.go | 139 ++++++++++++++++++++++ .github/workflows/test.yml | 2 +- Makefile | 2 +- 4 files changed, 268 insertions(+), 2 deletions(-) create mode 100644 .github/scripts/build_test_matrix.go create mode 100644 .github/scripts/build_test_matrix_test.go diff --git a/.github/scripts/build_test_matrix.go b/.github/scripts/build_test_matrix.go new file mode 100644 index 00000000000..8e736cf341c --- /dev/null +++ b/.github/scripts/build_test_matrix.go @@ -0,0 +1,127 @@ +package main + +import ( + "encoding/json" + "fmt" + "go/ast" + "go/parser" + "go/token" + "io/fs" + "os" + "path/filepath" + "strings" +) + +const ( + testNamePrefix = "Test" + testFileNameSuffix = "_test.go" + e2eTestDirectory = "e2e" +) + +// GithubActionTestMatrix represents +type GithubActionTestMatrix struct { + Include []TestSuitePair `json:"include"` +} + +type TestSuitePair struct { + Test string `json:"test"` + Suite string `json:"suite"` +} + +func main() { + githubActionMatrix, err := getGithubActionMatrixForTests(e2eTestDirectory) + if err != nil { + fmt.Printf("error generating github action json: %s", err) + os.Exit(1) + } + + ghBytes, err := json.Marshal(githubActionMatrix) + if err != nil { + fmt.Printf("error marshalling github action json: %s", err) + os.Exit(1) + } + fmt.Println(string(ghBytes)) +} + +// getGithubActionMatrixForTests returns a json string representing the contents that should go in the matrix +// field in a github action workflow. This string can be used with `fromJSON(str)` to dynamically build +// the workflow matrix to include all E2E tests under the e2eRootDirectory directory. +func getGithubActionMatrixForTests(e2eRootDirectory string) (GithubActionTestMatrix, error) { + testSuiteMapping := map[string][]string{} + fset := token.NewFileSet() + err := filepath.Walk(e2eRootDirectory, func(path string, info fs.FileInfo, err error) error { + // only look at test files + if !strings.HasSuffix(path, testFileNameSuffix) { + return nil + } + + f, err := parser.ParseFile(fset, path, nil, 0) + if err != nil { + return fmt.Errorf("failed parsing file: %s", err) + } + + suiteNameForFile, testCases, err := extractSuiteAndTestNames(f) + if err != nil { + return fmt.Errorf("failed extracting test suite name and test cases: %s", err) + } + + testSuiteMapping[suiteNameForFile] = testCases + + return nil + }) + + if err != nil { + return GithubActionTestMatrix{}, err + } + + gh := GithubActionTestMatrix{ + Include: []TestSuitePair{}, + } + + for testSuiteName, testCases := range testSuiteMapping { + for _, testCaseName := range testCases { + gh.Include = append(gh.Include, TestSuitePair{ + Test: testCaseName, + Suite: testSuiteName, + }) + } + } + + return gh, nil +} + +// extractSuiteAndTestNames extracts the name of the test suite function as well +// as all tests associated with it in the same file. +func extractSuiteAndTestNames(file *ast.File) (string, []string, error) { + var suiteNameForFile string + var testCases []string + + for _, d := range file.Decls { + if f, ok := d.(*ast.FuncDecl); ok { + functionName := f.Name.Name + if isTestSuiteMethod(f) { + suiteNameForFile = functionName + continue + } + if isTestFunction(f) { + testCases = append(testCases, functionName) + } + } + } + if suiteNameForFile == "" { + return "", nil, fmt.Errorf("file %s had no test suite test case", file.Name.Name) + } + return suiteNameForFile, testCases, nil +} + +// isTestSuiteMethod returns true if the function is a test suite function. +// e.g. func TestFeeMiddlewareTestSuite(t *testing.T) { ... } +func isTestSuiteMethod(f *ast.FuncDecl) bool { + return strings.HasPrefix(f.Name.Name, testNamePrefix) && len(f.Type.Params.List) == 1 +} + +// isTestFunction returns true if the function name starts with "Test" and has no parameters. +// as test suite functions to not accept a testing.T. +func isTestFunction(f *ast.FuncDecl) bool { + return strings.HasPrefix(f.Name.Name, testNamePrefix) && len(f.Type.Params.List) == 0 +} diff --git a/.github/scripts/build_test_matrix_test.go b/.github/scripts/build_test_matrix_test.go new file mode 100644 index 00000000000..82445fd7da6 --- /dev/null +++ b/.github/scripts/build_test_matrix_test.go @@ -0,0 +1,139 @@ +package main + +import ( + "os" + "path" + "sort" + "strings" + "testing" + + "github.com/stretchr/testify/assert" +) + +const ( + nonTestFile = "not_test_file.go" + goTestFileNameOne = "first_go_file_test.go" + goTestFileNameTwo = "second_go_file_test.go" +) + +func TestGetGithubActionMatrixForTests(t *testing.T) { + t.Run("empty dir does not fail", func(t *testing.T) { + testingDir := t.TempDir() + _, err := getGithubActionMatrixForTests(testingDir) + assert.NoError(t, err) + }) + + t.Run("only test functions are picked up", func(t *testing.T) { + testingDir := t.TempDir() + createFileWithTestSuiteAndTests(t, "TestFeeMiddlewareTestSuite", "TestA", "TestB", testingDir, goTestFileNameOne) + + gh, err := getGithubActionMatrixForTests(testingDir) + assert.NoError(t, err) + + expected := GithubActionTestMatrix{ + Include: []TestSuitePair{ + { + Suite: "TestFeeMiddlewareTestSuite", + Test: "TestA", + }, + { + Suite: "TestFeeMiddlewareTestSuite", + Test: "TestB", + }, + }, + } + assertGithubActionTestMatricesEqual(t, expected, gh) + }) + + t.Run("all files are picked up", func(t *testing.T) { + testingDir := t.TempDir() + createFileWithTestSuiteAndTests(t, "TestFeeMiddlewareTestSuite", "TestA", "TestB", testingDir, goTestFileNameOne) + createFileWithTestSuiteAndTests(t, "TestTransferTestSuite", "TestC", "TestD", testingDir, goTestFileNameTwo) + + gh, err := getGithubActionMatrixForTests(testingDir) + assert.NoError(t, err) + + expected := GithubActionTestMatrix{ + Include: []TestSuitePair{ + { + Suite: "TestTransferTestSuite", + Test: "TestC", + }, + { + Suite: "TestFeeMiddlewareTestSuite", + Test: "TestA", + }, + { + Suite: "TestFeeMiddlewareTestSuite", + Test: "TestB", + }, + { + Suite: "TestTransferTestSuite", + Test: "TestD", + }, + }, + } + + assertGithubActionTestMatricesEqual(t, expected, gh) + }) + + t.Run("non test files are not picked up", func(t *testing.T) { + testingDir := t.TempDir() + createFileWithTestSuiteAndTests(t, "TestFeeMiddlewareTestSuite", "TestA", "TestB", testingDir, nonTestFile) + + gh, err := getGithubActionMatrixForTests(testingDir) + assert.NoError(t, err) + assert.Empty(t, gh.Include) + }) +} + +func assertGithubActionTestMatricesEqual(t *testing.T, expected, actual GithubActionTestMatrix) { + // sort by both suite and test as the order of the end result does not matter as + // all tests will be run. + sort.SliceStable(expected.Include, func(i, j int) bool { + memberI := expected.Include[i] + memberJ := expected.Include[j] + if memberI.Suite == memberJ.Suite { + return memberI.Test < memberJ.Test + } + return memberI.Suite < memberJ.Suite + }) + + sort.SliceStable(actual.Include, func(i, j int) bool { + memberI := actual.Include[i] + memberJ := actual.Include[j] + if memberI.Suite == memberJ.Suite { + return memberI.Test < memberJ.Test + } + return memberI.Suite < memberJ.Suite + }) + assert.Equal(t, expected.Include, actual.Include) +} + +func goTestFileContents(suiteName, fnName1, fnName2 string) string { + + replacedSuiteName := strings.ReplaceAll(`package foo + +func SuiteName(t *testing.T) { + suite.Run(t, new(FeeMiddlewareTestSuite)) +} + +type SuiteName struct {} + +func (s *SuiteName) fnName1() {} +func (s *SuiteName) fnName2() {} + +func (s *SuiteName) suiteHelper() {} + +func helper() {} +`, "SuiteName", suiteName) + + replacedFn1Name := strings.ReplaceAll(replacedSuiteName, "fnName1", fnName1) + return strings.ReplaceAll(replacedFn1Name, "fnName2", fnName2) +} + +func createFileWithTestSuiteAndTests(t *testing.T, suiteName, fn1Name, fn2Name, dir, filename string) { + goFileContents := goTestFileContents(suiteName, fn1Name, fn2Name) + err := os.WriteFile(path.Join(dir, filename), []byte(goFileContents), os.FileMode(777)) + assert.NoError(t, err) +} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c915db779cd..ff8ed4d65d9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -63,7 +63,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: Create a file with all the pkgs - run: go list ./... > pkgs.txt + run: go list ./... ./.github/scripts > pkgs.txt - name: Split pkgs into 4 files run: split -d -n l/4 pkgs.txt pkgs.txt.part. # cache multiple diff --git a/Makefile b/Makefile index 0ea7f0c10c5..9beb4ab61bc 100644 --- a/Makefile +++ b/Makefile @@ -216,7 +216,7 @@ view-docs: test: test-unit test-all: test-unit test-ledger-mock test-race test-cover -TEST_PACKAGES=./... +TEST_PACKAGES=./... ./.github/scripts TEST_TARGETS := test-unit test-unit-amino test-unit-proto test-ledger-mock test-race test-ledger test-race # Test runs-specific rules. To add a new test target, just add From ce804118a10783d166c484121e67773773effdc6 Mon Sep 17 00:00:00 2001 From: Cian Hatton Date: Mon, 4 Jul 2022 11:27:49 +0100 Subject: [PATCH 02/22] feat(e2e): adding github CI to run E2E tests --- .github/workflows/test.yml | 89 +++++++++++++++++++++++++++++++++++--- 1 file changed, 82 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ff8ed4d65d9..43fa59bcc77 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,6 +6,10 @@ on: push: branches: - main +env: + REGISTRY: ghcr.io + IMAGE_NAME: ibc-go-simd-e2e + jobs: cleanup-runs: runs-on: ubuntu-latest @@ -51,13 +55,6 @@ jobs: - name: Build run: GOARCH=${{ matrix.go-arch }} LEDGER_ENABLED=false make build - docker-build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Docker Build - run: docker build . --no-cache - split-test-files: runs-on: ubuntu-latest steps: @@ -161,3 +158,81 @@ jobs: with: file: ./coverage.txt if: env.GIT_DIFF + + + docker-build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Log in to the Container registry + uses: docker/login-action@49ed152c8eca782a232dede0303416e8f356c37b + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@69f6fc9d46f2f8bf0d5491e4aabe0bb8c6a4678a + with: + images: ${{ env.REGISTRY }}/cosmos/${{ env.IMAGE_NAME }} + + - name: Build and push Docker image + uses: docker/build-push-action@e551b19e49efd4e98792db7592c17c09b89db8d8 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + + + # dynamically build a matrix of test/test suite pairs to run + build-test-matrix: + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v3 + with: + go-version: 1.18 + - id: set-matrix + run: echo "::set-output name=matrix::$(go run .github/scripts/build_test_matrix.go)" + + + # the tag of the image will differ if this is a PR or the branch is being merged into main. + # we store the tag as an environment variable and use it in the E2E tests to determine the tag. + determine-image-tag: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + # if the PR is not yet merged, the tag will look like "pr-1234" + - if: github.event.pull_request.merged != 'true' + run: echo "SIMD_TAG=pr-${{ github.event.number }}" >> $GITHUB_ENV + # the tag will be "main" when a PR is merged + - if: github.event.pull_request.merged == 'true' >> $GITHUB_ENV + run: echo "SIMD_TAG=main" + + e2e: + runs-on: ubuntu-latest + needs: + - build-test-matrix + - determine-image-tag + - docker-build + env: + SIMD_TAG: ${{ env.SIMD_TAG }} + SIMD_IMAGE: ghcr.io/cosmos/ibc-go-simd-e2e + strategy: + fail-fast: false + matrix: ${{ fromJSON(needs.build-test-matrix.outputs.matrix) }} + steps: + - uses: actions/checkout@v3 + - name: Log in to the Container registry + uses: docker/login-action@49ed152c8eca782a232dede0303416e8f356c37b + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Run e2e Test + run: | + make e2e-test suite=${{ matrix.suite }} test=${{ matrix.test }} From bfbba0323fda1df561679b14d20cfd5e81c587b7 Mon Sep 17 00:00:00 2001 From: Cian Hatton Date: Mon, 4 Jul 2022 11:30:34 +0100 Subject: [PATCH 03/22] feat(e2e) adding placeholder test for github action to execute --- e2e/fee_middleware_test.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 e2e/fee_middleware_test.go diff --git a/e2e/fee_middleware_test.go b/e2e/fee_middleware_test.go new file mode 100644 index 00000000000..58d66f7fd96 --- /dev/null +++ b/e2e/fee_middleware_test.go @@ -0,0 +1,20 @@ +package e2e + +import ( + "testing" + + "github.com/stretchr/testify/suite" +) + +func TestFeeMiddlewareTestSuite(t *testing.T) { + suite.Run(t, new(FeeMiddlewareTestSuite)) +} + +type FeeMiddlewareTestSuite struct { + suite.Suite +} + +func (s *FeeMiddlewareTestSuite) TestPlaceholder() { + s.T().Logf("Placeholder test") + s.Require().True(true) +} From 4569fa56e8e37824fc8a38c110ea2ccfc76bedda Mon Sep 17 00:00:00 2001 From: Cian Hatton Date: Mon, 4 Jul 2022 11:41:56 +0100 Subject: [PATCH 04/22] wip: extracting correct tag for image --- .github/workflows/test.yml | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 43fa59bcc77..3c9af80bcb3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -199,19 +199,23 @@ jobs: - id: set-matrix run: echo "::set-output name=matrix::$(go run .github/scripts/build_test_matrix.go)" + - name: Dump GitHub context + env: + GITHUB_CONTEXT: ${{ toJson(github) }} + run: echo "$GITHUB_CONTEXT" # the tag of the image will differ if this is a PR or the branch is being merged into main. # we store the tag as an environment variable and use it in the E2E tests to determine the tag. - determine-image-tag: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - # if the PR is not yet merged, the tag will look like "pr-1234" - - if: github.event.pull_request.merged != 'true' - run: echo "SIMD_TAG=pr-${{ github.event.number }}" >> $GITHUB_ENV - # the tag will be "main" when a PR is merged - - if: github.event.pull_request.merged == 'true' >> $GITHUB_ENV - run: echo "SIMD_TAG=main" +# determine-image-tag: +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v3 +# # if the PR is not yet merged, the tag will look like "pr-1234" +# - if: github.event.pull_request.merged != 'true' +# run: echo "SIMD_TAG=pr-${{ github.event.number }}" >> $GITHUB_ENV +# # the tag will be "main" when a PR is merged +# - if: github.event.pull_request.merged == 'true' >> $GITHUB_ENV +# run: echo "SIMD_TAG=main" e2e: runs-on: ubuntu-latest @@ -220,7 +224,7 @@ jobs: - determine-image-tag - docker-build env: - SIMD_TAG: ${{ env.SIMD_TAG }} + SIMD_TAG: ${{ github.event.pull_request.number || github.event.push.ref }} SIMD_IMAGE: ghcr.io/cosmos/ibc-go-simd-e2e strategy: fail-fast: false From 272ad61cde08e33275a065533ef6503be5885b21 Mon Sep 17 00:00:00 2001 From: Cian Hatton Date: Mon, 4 Jul 2022 11:43:18 +0100 Subject: [PATCH 05/22] wip: extracting correct tag for image --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3c9af80bcb3..dd5518c7c89 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,6 +6,7 @@ on: push: branches: - main + env: REGISTRY: ghcr.io IMAGE_NAME: ibc-go-simd-e2e From 6afe90c5a474bbd418ba3cc694cf790aa1cdf6a8 Mon Sep 17 00:00:00 2001 From: Cian Hatton Date: Mon, 4 Jul 2022 11:44:58 +0100 Subject: [PATCH 06/22] wip: corrected workflow syntax --- .github/workflows/test.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index dd5518c7c89..de15953c4af 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -200,10 +200,13 @@ jobs: - id: set-matrix run: echo "::set-output name=matrix::$(go run .github/scripts/build_test_matrix.go)" - - name: Dump GitHub context - env: - GITHUB_CONTEXT: ${{ toJson(github) }} - run: echo "$GITHUB_CONTEXT" + dump-github-context: + runs-on: ubuntu-latest + steps: + - name: Dump GitHub context + env: + GITHUB_CONTEXT: ${{ toJson(github) }} + run: echo "$GITHUB_CONTEXT" # the tag of the image will differ if this is a PR or the branch is being merged into main. # we store the tag as an environment variable and use it in the E2E tests to determine the tag. From 7497574cdb6bfe9854eaacef7c6a2f725fd8ab09 Mon Sep 17 00:00:00 2001 From: Cian Hatton Date: Mon, 4 Jul 2022 11:45:47 +0100 Subject: [PATCH 07/22] wip: corrected workflow syntax --- .github/workflows/test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index de15953c4af..cf010d26f03 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -202,11 +202,11 @@ jobs: dump-github-context: runs-on: ubuntu-latest + env: + GITHUB_CONTEXT: ${{ toJson(github) }} steps: - name: Dump GitHub context - env: - GITHUB_CONTEXT: ${{ toJson(github) }} - run: echo "$GITHUB_CONTEXT" + run: echo "$GITHUB_CONTEXT" # the tag of the image will differ if this is a PR or the branch is being merged into main. # we store the tag as an environment variable and use it in the E2E tests to determine the tag. From 7091fbc64fa4874dadefeff1d9023609ae087e1f Mon Sep 17 00:00:00 2001 From: Cian Hatton Date: Mon, 4 Jul 2022 11:46:22 +0100 Subject: [PATCH 08/22] removed unreferenced job --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cf010d26f03..4184b5af718 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -225,7 +225,7 @@ jobs: runs-on: ubuntu-latest needs: - build-test-matrix - - determine-image-tag +# - determine-image-tag - docker-build env: SIMD_TAG: ${{ github.event.pull_request.number || github.event.push.ref }} From 6ebcc6d5c9190807db70b59efbe275ab9bab380a Mon Sep 17 00:00:00 2001 From: Cian Hatton Date: Mon, 4 Jul 2022 11:49:15 +0100 Subject: [PATCH 09/22] wip: adding makefile --- Makefile | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Makefile b/Makefile index 9beb4ab61bc..df259c5a477 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,7 @@ MOCKS_DIR = $(CURDIR)/tests/mocks HTTPS_GIT := https://github.com/cosmos/ibc-go.git DOCKER := $(shell which docker) DOCKER_BUF := $(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace bufbuild/buf:1.0.0-rc8 +TEST_CONTAINERS=$(shell docker ps --filter "label=ibc-test" -a -q) export GO111MODULE = on @@ -324,6 +325,15 @@ benchmark: @go test -mod=readonly -bench=. $(PACKAGES_NOSIMULATION) .PHONY: benchmark +cleanup-ibc-test-containers: + for id in $(TEST_CONTAINERS) ; do \ + $(DOCKER) stop $$id ; \ + $(DOCKER) rm $$id ; \ + done + +e2e-test: cleanup-ibc-test-containers + @go test -v ./e2e --run $(suite) -testify.m ^$(test)$$ + ############################################################################### ### Linting ### ############################################################################### From 05d9a45ac9dee868ac6c40bedb663fe66569c6c2 Mon Sep 17 00:00:00 2001 From: Cian Hatton Date: Mon, 4 Jul 2022 11:55:32 +0100 Subject: [PATCH 10/22] wip: displaying env vars in placeholder test --- .github/workflows/test.yml | 2 +- e2e/fee_middleware_test.go | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4184b5af718..61b4926a91c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -228,7 +228,7 @@ jobs: # - determine-image-tag - docker-build env: - SIMD_TAG: ${{ github.event.pull_request.number || github.event.push.ref }} + SIMD_TAG: ${{ github.event.push.ref}} || pr-${{ github.event.pull_request.number }} SIMD_IMAGE: ghcr.io/cosmos/ibc-go-simd-e2e strategy: fail-fast: false diff --git a/e2e/fee_middleware_test.go b/e2e/fee_middleware_test.go index 58d66f7fd96..33327ecfb15 100644 --- a/e2e/fee_middleware_test.go +++ b/e2e/fee_middleware_test.go @@ -1,6 +1,7 @@ package e2e import ( + "os" "testing" "github.com/stretchr/testify/suite" @@ -15,6 +16,14 @@ type FeeMiddlewareTestSuite struct { } func (s *FeeMiddlewareTestSuite) TestPlaceholder() { + tag, ok := os.LookupEnv("SIMD_TAG") + s.Require().True(ok) + s.T().Logf("SIMD_TAG=%s", tag) + + image, ok := os.LookupEnv("SIMD_IMAGE") + s.Require().True(ok) + s.T().Logf("SIMD_IMAGE=%s", image) + s.T().Logf("Placeholder test") s.Require().True(true) } From 308eb0ff2845ad36c7e3de9803e54d61c0070da7 Mon Sep 17 00:00:00 2001 From: Cian Hatton Date: Mon, 4 Jul 2022 12:14:36 +0100 Subject: [PATCH 11/22] wip: adding go script to determine simd tag --- .github/scripts/determine_simd_tag.go | 33 +++++++++++++++++++++++++++ .github/workflows/test.yml | 25 ++++++++++++++------ 2 files changed, 51 insertions(+), 7 deletions(-) create mode 100644 .github/scripts/determine_simd_tag.go diff --git a/.github/scripts/determine_simd_tag.go b/.github/scripts/determine_simd_tag.go new file mode 100644 index 00000000000..804cef7a870 --- /dev/null +++ b/.github/scripts/determine_simd_tag.go @@ -0,0 +1,33 @@ +package main + +import ( + "fmt" + "os" + "strconv" +) + +func main() { + args := os.Args + if len(args) != 3 { + fmt.Println("must specify exactly 2 args, ref and PR number") + os.Exit(1) + } + + tag, err := determineSimdTag(args[1], args[2]) + if err != nil { + fmt.Printf("failed to determine tag: %s", err) + os.Exit(1) + } + fmt.Println(tag) +} + +func determineSimdTag(ref, prNumber string) (string, error) { + if ref != "" { + return ref, nil + } + prNumm, err := strconv.Atoi(prNumber) + if err != nil { + return "", err + } + return fmt.Sprintf("pr-%d", prNumm), nil +} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 61b4926a91c..e2276e6ee98 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -106,7 +106,7 @@ jobs: if: env.GIT_DIFF - name: test & coverage report creation run: | - cat pkgs.txt.part.${{ matrix.part }} | xargs go test -race -mod=readonly -timeout 30m -coverprofile=${{ matrix.part }}profile.out -covermode=atomic -tags='ledger test_ledger_mock' + cat pkgs.txt.part.${{ matrix.part }} | xargs go test $(go list ./... | grep -v e2e) -race -mod=readonly -timeout 30m -coverprofile=${{ matrix.part }}profile.out -covermode=atomic -tags='ledger test_ledger_mock' if: env.GIT_DIFF - uses: actions/upload-artifact@v3 with: @@ -210,10 +210,18 @@ jobs: # the tag of the image will differ if this is a PR or the branch is being merged into main. # we store the tag as an environment variable and use it in the E2E tests to determine the tag. -# determine-image-tag: -# runs-on: ubuntu-latest -# steps: -# - uses: actions/checkout@v3 + determine-image-tag: + runs-on: ubuntu-latest + outputs: + simd-tag: ${{ steps.set-matrix.outputs.matrix }} + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v3 + with: + go-version: 1.18 + - id: get-tag + run: echo "::set-output name=simd-tag::$(go run .github/scripts/determine_simd_tag.go ${{ github.event.push.ref}} ${{ github.event.pull_request.number }} )" + # # if the PR is not yet merged, the tag will look like "pr-1234" # - if: github.event.pull_request.merged != 'true' # run: echo "SIMD_TAG=pr-${{ github.event.number }}" >> $GITHUB_ENV @@ -221,14 +229,17 @@ jobs: # - if: github.event.pull_request.merged == 'true' >> $GITHUB_ENV # run: echo "SIMD_TAG=main" + +# ${{ github.event.push.ref}} || pr-${{ github.event.pull_request.number }} + e2e: runs-on: ubuntu-latest needs: - build-test-matrix -# - determine-image-tag + - determine-image-tag - docker-build env: - SIMD_TAG: ${{ github.event.push.ref}} || pr-${{ github.event.pull_request.number }} + SIMD_TAG: ${{ needs.determine-image-tag.outputs.simd-tag }} SIMD_IMAGE: ghcr.io/cosmos/ibc-go-simd-e2e strategy: fail-fast: false From 9ebacd70b421800ecc415dc788af746c09eab384 Mon Sep 17 00:00:00 2001 From: Cian Hatton Date: Mon, 4 Jul 2022 12:17:26 +0100 Subject: [PATCH 12/22] fix: corrected outputs name in test.yml --- .github/scripts/determine_simd_tag.go | 4 ++++ .github/workflows/test.yml | 11 +---------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/.github/scripts/determine_simd_tag.go b/.github/scripts/determine_simd_tag.go index 804cef7a870..7c54dcc1acc 100644 --- a/.github/scripts/determine_simd_tag.go +++ b/.github/scripts/determine_simd_tag.go @@ -21,6 +21,10 @@ func main() { fmt.Println(tag) } +// determineSimdTag returns the tag which should be used for the E2E test image. +// when a ref is specified, this will usually be "main" which is the tag that should be +// used once a branch has been merged to main. If a PR number is specified, then the format +// of the tag will be "pr-1234". func determineSimdTag(ref, prNumber string) (string, error) { if ref != "" { return ref, nil diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e2276e6ee98..4c44d61f7b9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -213,7 +213,7 @@ jobs: determine-image-tag: runs-on: ubuntu-latest outputs: - simd-tag: ${{ steps.set-matrix.outputs.matrix }} + simd-tag: ${{ steps.get-tag.outputs.matrix }} steps: - uses: actions/checkout@v3 - uses: actions/setup-go@v3 @@ -222,15 +222,6 @@ jobs: - id: get-tag run: echo "::set-output name=simd-tag::$(go run .github/scripts/determine_simd_tag.go ${{ github.event.push.ref}} ${{ github.event.pull_request.number }} )" -# # if the PR is not yet merged, the tag will look like "pr-1234" -# - if: github.event.pull_request.merged != 'true' -# run: echo "SIMD_TAG=pr-${{ github.event.number }}" >> $GITHUB_ENV -# # the tag will be "main" when a PR is merged -# - if: github.event.pull_request.merged == 'true' >> $GITHUB_ENV -# run: echo "SIMD_TAG=main" - - -# ${{ github.event.push.ref}} || pr-${{ github.event.pull_request.number }} e2e: runs-on: ubuntu-latest From c4318506dd046640dfe6b031b29ccbd2974afaea Mon Sep 17 00:00:00 2001 From: Cian Hatton Date: Mon, 4 Jul 2022 12:21:15 +0100 Subject: [PATCH 13/22] fix: specifying correct output name --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4c44d61f7b9..9b291492bb9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -213,7 +213,7 @@ jobs: determine-image-tag: runs-on: ubuntu-latest outputs: - simd-tag: ${{ steps.get-tag.outputs.matrix }} + simd-tag: ${{ steps.get-tag.outputs.simd-tag }} steps: - uses: actions/checkout@v3 - uses: actions/setup-go@v3 From 3c4f62b4160581c117cd4b27b23f7457d5d1cab4 Mon Sep 17 00:00:00 2001 From: Cian Hatton Date: Mon, 4 Jul 2022 12:29:14 +0100 Subject: [PATCH 14/22] fix: updating go script to accept a single argument --- .github/scripts/determine_simd_tag.go | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/.github/scripts/determine_simd_tag.go b/.github/scripts/determine_simd_tag.go index 7c54dcc1acc..8b6323969bf 100644 --- a/.github/scripts/determine_simd_tag.go +++ b/.github/scripts/determine_simd_tag.go @@ -8,12 +8,13 @@ import ( func main() { args := os.Args - if len(args) != 3 { - fmt.Println("must specify exactly 2 args, ref and PR number") + + if len(args) < 2 { + fmt.Printf("a ref or PR number is expected, provided: %+v\n", args) os.Exit(1) } - tag, err := determineSimdTag(args[1], args[2]) + tag, err := determineSimdTag(args[1]) if err != nil { fmt.Printf("failed to determine tag: %s", err) os.Exit(1) @@ -25,13 +26,17 @@ func main() { // when a ref is specified, this will usually be "main" which is the tag that should be // used once a branch has been merged to main. If a PR number is specified, then the format // of the tag will be "pr-1234". -func determineSimdTag(ref, prNumber string) (string, error) { - if ref != "" { - return ref, nil +func determineSimdTag(input string) (string, error) { + if input == "" { + return "", fmt.Errorf("empty input was provided") } - prNumm, err := strconv.Atoi(prNumber) - if err != nil { - return "", err + + // attempt to extract PR number + prNumm, err := strconv.Atoi(input) + if err == nil { + return fmt.Sprintf("pr-%d", prNumm), nil } - return fmt.Sprintf("pr-%d", prNumm), nil + + // a ref was provided instead, e.g. "main" + return input, nil } From b5fff2acad5159431e4801edbcf4e70b14fc6397 Mon Sep 17 00:00:00 2001 From: Cian Hatton Date: Mon, 4 Jul 2022 12:48:15 +0100 Subject: [PATCH 15/22] chore: greatly simplifying determine_simd_tag.go --- .github/scripts/determine_simd_tag.go | 43 ++++++++++----------------- .github/workflows/test.yml | 2 +- 2 files changed, 17 insertions(+), 28 deletions(-) diff --git a/.github/scripts/determine_simd_tag.go b/.github/scripts/determine_simd_tag.go index 8b6323969bf..2cb527a91a2 100644 --- a/.github/scripts/determine_simd_tag.go +++ b/.github/scripts/determine_simd_tag.go @@ -1,42 +1,31 @@ package main import ( + "flag" "fmt" "os" - "strconv" ) -func main() { - args := os.Args +var prNum int +var ref string - if len(args) < 2 { - fmt.Printf("a ref or PR number is expected, provided: %+v\n", args) - os.Exit(1) - } +func init() { + flag.IntVar(&prNum, "pr", 0, "the number of the pr") + flag.StringVar(&ref, "ref", "", "the github ref") + flag.Parse() +} - tag, err := determineSimdTag(args[1]) - if err != nil { - fmt.Printf("failed to determine tag: %s", err) +func main() { + if prNum == 0 && ref == "" { + fmt.Printf("must specify exactly one of [pr, ref]") os.Exit(1) } - fmt.Println(tag) + fmt.Printf(getSimdTag(prNum, ref)) } -// determineSimdTag returns the tag which should be used for the E2E test image. -// when a ref is specified, this will usually be "main" which is the tag that should be -// used once a branch has been merged to main. If a PR number is specified, then the format -// of the tag will be "pr-1234". -func determineSimdTag(input string) (string, error) { - if input == "" { - return "", fmt.Errorf("empty input was provided") - } - - // attempt to extract PR number - prNumm, err := strconv.Atoi(input) - if err == nil { - return fmt.Sprintf("pr-%d", prNumm), nil +func getSimdTag(prNum int, ref string) string { + if ref != "" { + return ref } - - // a ref was provided instead, e.g. "main" - return input, nil + return fmt.Sprintf("pr-%d", prNum) } diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9b291492bb9..8a5bad662d3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -220,7 +220,7 @@ jobs: with: go-version: 1.18 - id: get-tag - run: echo "::set-output name=simd-tag::$(go run .github/scripts/determine_simd_tag.go ${{ github.event.push.ref}} ${{ github.event.pull_request.number }} )" + run: echo "::set-output name=simd-tag::$(go run .github/scripts/determine_simd_tag.go -ref ${{ github.event.push.ref}} -pr ${{ github.event.pull_request.number }} )" e2e: From abb0eca9aba65cfa9a4fd4dce5287990cd7acf92 Mon Sep 17 00:00:00 2001 From: Cian Hatton Date: Mon, 4 Jul 2022 12:55:53 +0100 Subject: [PATCH 16/22] chore: adding docstring to determine_simd_tag.go --- .github/scripts/determine_simd_tag.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/scripts/determine_simd_tag.go b/.github/scripts/determine_simd_tag.go index 2cb527a91a2..3fb4ce6986f 100644 --- a/.github/scripts/determine_simd_tag.go +++ b/.github/scripts/determine_simd_tag.go @@ -15,9 +15,12 @@ func init() { flag.Parse() } +// in the context of a GithubAction workflow, the PR is the event number. So if the ref is not specified +// but the event number is, that means we are running for a PR. If the ref is specified, this means +// we have merged the PR, so we want to use the ref as a tag instead of the PR number. func main() { if prNum == 0 && ref == "" { - fmt.Printf("must specify exactly one of [pr, ref]") + fmt.Printf("must specify one or bot of [pr, ref]") os.Exit(1) } fmt.Printf(getSimdTag(prNum, ref)) From f36025bd282293590079960723918872e3786404 Mon Sep 17 00:00:00 2001 From: Cian Hatton Date: Mon, 4 Jul 2022 13:01:51 +0100 Subject: [PATCH 17/22] chore: extract output variable --- .github/workflows/test.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8a5bad662d3..1091550e916 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -220,7 +220,9 @@ jobs: with: go-version: 1.18 - id: get-tag - run: echo "::set-output name=simd-tag::$(go run .github/scripts/determine_simd_tag.go -ref ${{ github.event.push.ref}} -pr ${{ github.event.pull_request.number }} )" + run: | + tag=$(go run .github/scripts/determine_simd_tag.go -ref "${{ github.event.push.ref }}" -pr "${{ github.event.pull_request.number }}" ) + echo "::set-output name=simd-tag::$tag" e2e: From 903913741240b2c16e56e411456dcad864315d96 Mon Sep 17 00:00:00 2001 From: Cian Hatton Date: Mon, 4 Jul 2022 13:12:45 +0100 Subject: [PATCH 18/22] chore: adding echo to display the tag in the workflow --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1091550e916..94f0db65ada 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -222,6 +222,7 @@ jobs: - id: get-tag run: | tag=$(go run .github/scripts/determine_simd_tag.go -ref "${{ github.event.push.ref }}" -pr "${{ github.event.pull_request.number }}" ) + echo "Using tag $tag" echo "::set-output name=simd-tag::$tag" From 7083607d28035fcddd8a28cefdc9eba919133aee Mon Sep 17 00:00:00 2001 From: Cian Hatton Date: Tue, 5 Jul 2022 08:41:16 +0100 Subject: [PATCH 19/22] chore: removed simd tag variable --- .github/workflows/test.yml | 3 +-- e2e/fee_middleware_test.go | 4 ---- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 94f0db65ada..6305e793e5a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -233,8 +233,7 @@ jobs: - determine-image-tag - docker-build env: - SIMD_TAG: ${{ needs.determine-image-tag.outputs.simd-tag }} - SIMD_IMAGE: ghcr.io/cosmos/ibc-go-simd-e2e + SIMD_IMAGE: ghcr.io/cosmos/ibc-go-simd-e2e:${{ needs.determine-image-tag.outputs.simd-tag }} strategy: fail-fast: false matrix: ${{ fromJSON(needs.build-test-matrix.outputs.matrix) }} diff --git a/e2e/fee_middleware_test.go b/e2e/fee_middleware_test.go index 33327ecfb15..65ef9a77779 100644 --- a/e2e/fee_middleware_test.go +++ b/e2e/fee_middleware_test.go @@ -16,10 +16,6 @@ type FeeMiddlewareTestSuite struct { } func (s *FeeMiddlewareTestSuite) TestPlaceholder() { - tag, ok := os.LookupEnv("SIMD_TAG") - s.Require().True(ok) - s.T().Logf("SIMD_TAG=%s", tag) - image, ok := os.LookupEnv("SIMD_IMAGE") s.Require().True(ok) s.T().Logf("SIMD_IMAGE=%s", image) From e9ddf3f3d8b38f487b0f3d587e4d3cad4cef96c4 Mon Sep 17 00:00:00 2001 From: Cian Hatton Date: Tue, 5 Jul 2022 08:44:55 +0100 Subject: [PATCH 20/22] Revert "chore: removed simd tag variable" This reverts commit 7083607d28035fcddd8a28cefdc9eba919133aee. --- .github/workflows/test.yml | 3 ++- e2e/fee_middleware_test.go | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6305e793e5a..94f0db65ada 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -233,7 +233,8 @@ jobs: - determine-image-tag - docker-build env: - SIMD_IMAGE: ghcr.io/cosmos/ibc-go-simd-e2e:${{ needs.determine-image-tag.outputs.simd-tag }} + SIMD_TAG: ${{ needs.determine-image-tag.outputs.simd-tag }} + SIMD_IMAGE: ghcr.io/cosmos/ibc-go-simd-e2e strategy: fail-fast: false matrix: ${{ fromJSON(needs.build-test-matrix.outputs.matrix) }} diff --git a/e2e/fee_middleware_test.go b/e2e/fee_middleware_test.go index 65ef9a77779..33327ecfb15 100644 --- a/e2e/fee_middleware_test.go +++ b/e2e/fee_middleware_test.go @@ -16,6 +16,10 @@ type FeeMiddlewareTestSuite struct { } func (s *FeeMiddlewareTestSuite) TestPlaceholder() { + tag, ok := os.LookupEnv("SIMD_TAG") + s.Require().True(ok) + s.T().Logf("SIMD_TAG=%s", tag) + image, ok := os.LookupEnv("SIMD_IMAGE") s.Require().True(ok) s.T().Logf("SIMD_IMAGE=%s", image) From 5f6cf40b4d612e8cd5a84eea0230fcbfa9786a0d Mon Sep 17 00:00:00 2001 From: Cian Hatton Date: Tue, 5 Jul 2022 12:56:04 +0100 Subject: [PATCH 21/22] chore: adding additional tests and erroring on duplicate test functions --- .github/scripts/build_test_matrix.go | 5 +++- .github/scripts/build_test_matrix_test.go | 35 +++++++++++++++++++---- 2 files changed, 33 insertions(+), 7 deletions(-) diff --git a/.github/scripts/build_test_matrix.go b/.github/scripts/build_test_matrix.go index 8e736cf341c..c86324b31f8 100644 --- a/.github/scripts/build_test_matrix.go +++ b/.github/scripts/build_test_matrix.go @@ -100,6 +100,9 @@ func extractSuiteAndTestNames(file *ast.File) (string, []string, error) { if f, ok := d.(*ast.FuncDecl); ok { functionName := f.Name.Name if isTestSuiteMethod(f) { + if suiteNameForFile != "" { + return "", nil, fmt.Errorf("found a second test function: %s when %s was already found", f.Name.Name, suiteNameForFile) + } suiteNameForFile = functionName continue } @@ -121,7 +124,7 @@ func isTestSuiteMethod(f *ast.FuncDecl) bool { } // isTestFunction returns true if the function name starts with "Test" and has no parameters. -// as test suite functions to not accept a testing.T. +// as test suite functions do not accept a *testing.T. func isTestFunction(f *ast.FuncDecl) bool { return strings.HasPrefix(f.Name.Name, testNamePrefix) && len(f.Type.Params.List) == 0 } diff --git a/.github/scripts/build_test_matrix_test.go b/.github/scripts/build_test_matrix_test.go index 82445fd7da6..47de4d981c2 100644 --- a/.github/scripts/build_test_matrix_test.go +++ b/.github/scripts/build_test_matrix_test.go @@ -25,7 +25,7 @@ func TestGetGithubActionMatrixForTests(t *testing.T) { t.Run("only test functions are picked up", func(t *testing.T) { testingDir := t.TempDir() - createFileWithTestSuiteAndTests(t, "TestFeeMiddlewareTestSuite", "TestA", "TestB", testingDir, goTestFileNameOne) + createFileWithTestSuiteAndTests(t, "FeeMiddlewareTestSuite", "TestA", "TestB", testingDir, goTestFileNameOne) gh, err := getGithubActionMatrixForTests(testingDir) assert.NoError(t, err) @@ -47,8 +47,8 @@ func TestGetGithubActionMatrixForTests(t *testing.T) { t.Run("all files are picked up", func(t *testing.T) { testingDir := t.TempDir() - createFileWithTestSuiteAndTests(t, "TestFeeMiddlewareTestSuite", "TestA", "TestB", testingDir, goTestFileNameOne) - createFileWithTestSuiteAndTests(t, "TestTransferTestSuite", "TestC", "TestD", testingDir, goTestFileNameTwo) + createFileWithTestSuiteAndTests(t, "FeeMiddlewareTestSuite", "TestA", "TestB", testingDir, goTestFileNameOne) + createFileWithTestSuiteAndTests(t, "TransferTestSuite", "TestC", "TestD", testingDir, goTestFileNameTwo) gh, err := getGithubActionMatrixForTests(testingDir) assert.NoError(t, err) @@ -79,12 +79,35 @@ func TestGetGithubActionMatrixForTests(t *testing.T) { t.Run("non test files are not picked up", func(t *testing.T) { testingDir := t.TempDir() - createFileWithTestSuiteAndTests(t, "TestFeeMiddlewareTestSuite", "TestA", "TestB", testingDir, nonTestFile) + createFileWithTestSuiteAndTests(t, "FeeMiddlewareTestSuite", "TestA", "TestB", testingDir, nonTestFile) gh, err := getGithubActionMatrixForTests(testingDir) assert.NoError(t, err) assert.Empty(t, gh.Include) }) + + t.Run("fails when there are multiple suite runs", func(t *testing.T) { + testingDir := t.TempDir() + createFileWithTestSuiteAndTests(t, "FeeMiddlewareTestSuite", "TestA", "TestB", testingDir, nonTestFile) + + fileWithTwoSuites := `package foo +func SuiteOne(t *testing.T) { + suite.Run(t, new(FeeMiddlewareTestSuite)) +} + +func SuiteTwo(t *testing.T) { + suite.Run(t, new(FeeMiddlewareTestSuite)) +} + +type FeeMiddlewareTestSuite struct {} +` + + err := os.WriteFile(path.Join(testingDir, goTestFileNameOne), []byte(fileWithTwoSuites), os.FileMode(777)) + assert.NoError(t, err) + + _, err = getGithubActionMatrixForTests(testingDir) + assert.Error(t, err) + }) } func assertGithubActionTestMatricesEqual(t *testing.T, expected, actual GithubActionTestMatrix) { @@ -114,8 +137,8 @@ func goTestFileContents(suiteName, fnName1, fnName2 string) string { replacedSuiteName := strings.ReplaceAll(`package foo -func SuiteName(t *testing.T) { - suite.Run(t, new(FeeMiddlewareTestSuite)) +func TestSuiteName(t *testing.T) { + suite.Run(t, new(SuiteName)) } type SuiteName struct {} From c18313bd9fde1ae0892b8a047c697efffa520dd8 Mon Sep 17 00:00:00 2001 From: Cian Hatton Date: Wed, 6 Jul 2022 11:11:37 +0100 Subject: [PATCH 22/22] remove github context action --- .github/workflows/test.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 94f0db65ada..8482853965a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -200,13 +200,6 @@ jobs: - id: set-matrix run: echo "::set-output name=matrix::$(go run .github/scripts/build_test_matrix.go)" - dump-github-context: - runs-on: ubuntu-latest - env: - GITHUB_CONTEXT: ${{ toJson(github) }} - steps: - - name: Dump GitHub context - run: echo "$GITHUB_CONTEXT" # the tag of the image will differ if this is a PR or the branch is being merged into main. # we store the tag as an environment variable and use it in the E2E tests to determine the tag.