From 0c8f80d26ffe085e867003c46489724a1b9fa2a8 Mon Sep 17 00:00:00 2001 From: Benny Zlotnik Date: Tue, 19 Dec 2023 11:57:45 +0200 Subject: [PATCH] Run tests in github action Signed-off-by: Benny Zlotnik --- .github/workflows/go-test.yaml | 12 ++++++++++++ .github/workflows/pull-request.yml | 2 ++ tests/suit/tests_suite_test.go | 5 +++++ 3 files changed, 19 insertions(+) create mode 100644 .github/workflows/go-test.yaml diff --git a/.github/workflows/go-test.yaml b/.github/workflows/go-test.yaml new file mode 100644 index 000000000..451420766 --- /dev/null +++ b/.github/workflows/go-test.yaml @@ -0,0 +1,12 @@ +name: go-test +on: + pull_request: + branches: + - main +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Test with the Go CLI + run: go test ./... diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 6640f8fa0..682b187c6 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -88,6 +88,8 @@ jobs: runs-on: ubuntu-latest env: USE_BAZEL_VERSION: 5.4.0 + E2E_RUN: true + # Steps represent a sequence of tasks that will be executed as part of the job steps: - name: Checks-out repository under $GITHUB_WORKSPACE diff --git a/tests/suit/tests_suite_test.go b/tests/suit/tests_suite_test.go index 076fce150..01857b666 100644 --- a/tests/suit/tests_suite_test.go +++ b/tests/suit/tests_suite_test.go @@ -3,6 +3,7 @@ package suit_test import ( "flag" "fmt" + "os" "testing" "github.com/konveyor/forklift-controller/tests/suit/framework" @@ -54,6 +55,10 @@ func TestTests(t *testing.T) { // flag parsing happens AFTER ginkgo has constructed the entire testing tree. So anything that uses information from flags // cannot work when called during test tree construction. func BuildTestSuite() { + if os.Getenv("E2E_RUN") != "true" { + ginkgo.Skip("Not in CI e2e context, skipping e2e tests") + } + BeforeSuite(func() { fmt.Fprintf(ginkgo.GinkgoWriter, "Reading parameters\n") // Read flags, and configure client instances