Skip to content

Commit

Permalink
github action
Browse files Browse the repository at this point in the history
  • Loading branch information
feloy committed Oct 5, 2021
1 parent 0be3021 commit 6f90394
Show file tree
Hide file tree
Showing 3 changed files with 134 additions and 2 deletions.
132 changes: 132 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
# This workflow will build odo run tests on IBM Kubernetes cluster
#
# To configure this workflow:
#
# 2. Setup secrets in your repository: IBM_CLOUD_API_KEY and IKS_CLUSTER_ID
# 3. Change the values for the IBM_CLOUD_REGION and IBM_CLOUD_RESOURCE_GROUP

name: Build and Test on IKS

on:
push:
paths:
- 'cmd/**'
- 'pkg/**'
- 'go.mod'
- 'go.sum'
- 'tests/**'
- '.github/workflows/tests.yml'

# Environment variables available to all jobs and steps in this workflow
env:
GITHUB_SHA: ${{ github.sha }}
IBM_CLOUD_API_KEY: ${{ secrets.IBM_CLOUD_API_KEY }}
IBM_CLOUD_REGION: eu-de
OPENSHIFT_CLUSTER_ENDPOINT: ${{ secrets.IBM_CLOUD_OPENSHIFT_CLUSTER_ENDPOINT }}
KUBE_CLUSTER_ID: ${{ secrets.IBM_CLOUD_KUBE_CLUSTER_ID }}

jobs:
integration-tests-openshift:
name: Run integration tests on OpenShift
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{matrix.os}}
steps:

- name: Checkout
uses: actions/checkout@v2

- name: Install oc
uses: redhat-actions/oc-installer@v1

- name: Connect to Openshift cluster
uses: redhat-actions/oc-login@v1
with:
openshift_server_url: ${{ env.OPENSHIFT_CLUSTER_ENDPOINT }}
openshift_username: apikey
openshift_password: ${{ env.IBM_CLOUD_API_KEY }}

- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: '^1.15.1'

- name: Build odo
run: make install

- name: Run Integration tests
run: |
make test-integration
- name: Run Devfile Integration tests
run: |
make test-integration-devfile
- name: Run Operator Hub Integration tests
run: |
make test-operator-hub
- name: Run Login/logout Integration tests
run: |
SKIP_USER_LOGIN_TESTS=true make test-cmd-login-logout
- name: Run Command Integration tests
run: |
make test-cmd-project
- name: Run e2e tests
run: |
make test-e2e-devfile
integration-tests-kubernetes:
name: Run integration tests on Kubernetes
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{matrix.os}}
env:
KUBERNETES: "true"
steps:

- name: Checkout
uses: actions/checkout@v2

- name: Install IBM Cloud CLI
run: |
curl -fsSL https://clis.cloud.ibm.com/install/linux | sh
ibmcloud --version
ibmcloud config --check-version=false
ibmcloud plugin install -f kubernetes-service
- name: Authenticate with IBM Cloud CLI
run: |
ibmcloud login --apikey "${IBM_CLOUD_API_KEY}" -r "${IBM_CLOUD_REGION}"
- name: Connect to Kubernetes cluster
run: |
ibmcloud ks cluster config --cluster ${KUBE_CLUSTER_ID} --admin
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: '^1.15.1'

- name: Build odo
run: make install

- name: Run Devfile Integration tests
run: |
make test-integration-devfile
- name: Run Integration tests
run: |
make test-integration
- name: Run e2e tests
run: |
make test-e2e-devfile
# make test-operator-hub
# make test-cmd-login-logout
# make test-cmd-project
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ else
endif

# Slow spec threshold for ginkgo tests. After this time (in second), ginkgo marks test as slow
SLOW_SPEC_THRESHOLD := 120
SLOW_SPEC_THRESHOLD := 300

# Env variable GINKGO_TEST_ARGS is used to get control over enabling ginkgo test flags against each test target run.
# For example:
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/devfile/cmd_devfile_exec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ var _ = Describe("odo devfile exec command tests", func() {
})

It("should error out when an invalid command is given by the user", func() {
output := helper.Cmd("odo", "exec", "--context", commonVar.Context, "--", "invalidCommand").ShouldFail().Out()
output := helper.Cmd("odo", "exec", "--context", commonVar.Context, "--", "invalidCommand").ShouldFail().Err()
Expect(output).To(ContainSubstring("executable file not found in $PATH"))
})
})
Expand Down

0 comments on commit 6f90394

Please sign in to comment.