Skip to content

Commit

Permalink
Merge branch 'cian/issue#1648-add-baseline-e2e-test-suite-type-(e2e-#3)…
Browse files Browse the repository at this point in the history
…' into cian/issue#1652-add-e2e-test-for-async-single-sender
  • Loading branch information
chatton committed Jul 11, 2022
2 parents 388862d + e154f09 commit 3baaef2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 25 deletions.
26 changes: 9 additions & 17 deletions .github/scripts/determine_simd_tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,24 @@ package main
import (
"flag"
"fmt"
"os"
)

var prNum int
var ref string
var prNum string

func init() {
flag.IntVar(&prNum, "pr", 0, "the number of the pr")
flag.StringVar(&ref, "ref", "", "the github ref")
flag.StringVar(&prNum, "pr", "", "the number of the pr")
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.
// in the context of a GithubAction workflow, the PR is non empty if it is a pr. When
// code is merged to main, it will be empty. In this case we just use the "main" tag.
func main() {
if prNum == 0 && ref == "" {
fmt.Printf("must specify one or bot of [pr, ref]")
os.Exit(1)
}
fmt.Printf(getSimdTag(prNum, ref))
fmt.Printf(getSimdTag(prNum))
}

func getSimdTag(prNum int, ref string) string {
if ref != "" {
return ref
func getSimdTag(prNum string) string {
if prNum == "" {
return "main"
}
return fmt.Sprintf("pr-%d", prNum)
return fmt.Sprintf("pr-%s", prNum)
}
9 changes: 1 addition & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -221,7 +214,7 @@ jobs:
go-version: 1.18
- id: get-tag
run: |
tag=$(go run .github/scripts/determine_simd_tag.go -ref "${{ github.event.push.ref }}" -pr "${{ github.event.pull_request.number }}" )
tag=$(go run .github/scripts/determine_simd_tag.go -pr "${{ github.event.pull_request.number }}" )
echo "Using tag $tag"
echo "::set-output name=simd-tag::$tag"
Expand Down

0 comments on commit 3baaef2

Please sign in to comment.