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

Add Github action workflow for Odo 3.0 integration tests #62

Merged
merged 8 commits into from
Apr 14, 2022
4 changes: 2 additions & 2 deletions .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#
# SPDX-License-Identifier: EPL-2.0
#
name: Devfile integration tests
name: Devfile integration tests (latest Odo release)

on:
push:
Expand Down Expand Up @@ -48,5 +48,5 @@ jobs:
- name: Run test with pipenv and pytest
run: |
odo version
pipenv run pytest tests -v
pipenv run pytest tests/odo -v

69 changes: 69 additions & 0 deletions .github/workflows/pytest_odo.300.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Copyright (c) 2021 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
name: Devfile integration tests (latest Odo build)

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
# every day at 9am EST
- cron: 0 1 * * *

jobs:
test_with_minikube:
name: Run tests
strategy:
matrix:
os: [ ubuntu-latest, macos-10.15 ]
runs-on: ${{ matrix.os }}
continue-on-error: true
timeout-minutes: 20

steps:
- name: Check out repository code
uses: actions/checkout@v2

- name: Check out the latest odo repository code
uses: actions/checkout@v2
with:
repository: redhat-developer/odo
ref: main
path: odo

- name: Start minikube
uses: medyagh/setup-minikube@latest

- name: Setup go
uses: actions/setup-go@v3
with:
go-version: '1.16.1'
- run: go version

# Build and installs odo from source code
- name: Build and Install ODO
run: |
cd odo
make goget-tools
make bin
mv ./odo /usr/local/bin/odo
cd ..
rm -rf odo

# Setup Python
- name: Install Python, pipenv and Pipfile packages
uses: palewire/install-python-pipenv-pipfile@v2
with:
python-version: "3.9.10"

- name: Run test with pipenv and pytest
run: |
odo version
pipenv run pytest tests/odo_300 -v

Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
schemaVersion: 2.0.0
metadata:
name: nodejs
projectType: nodejs
language: nodejs
starterProjects:
- name: nodejs-starter
git:
remotes:
origin: "https://github.com/nodeshift-starters/devfile-sample.git"
checkoutFrom:
revision: main
components:
- name: runtime
container:
image: registry.access.redhat.com/ubi8/nodejs-12:1-36
memoryLimit: 1024Mi
endpoints:
- name: "3000-tcp"
targetPort: 3000
mountSources: true
commands:
- id: devbuild
exec:
component: runtime
commandLine: npm install
workingDir: ${PROJECTS_ROOT}
group:
kind: build
isDefault: true
- id: build
exec:
component: runtime
commandLine: npm install
workingDir: ${PROJECTS_ROOT}
group:
kind: build
- id: devrun
exec:
component: runtime
commandLine: npm start
workingDir: ${PROJECTS_ROOT}
group:
kind: run
isDefault: true
- id: run
exec:
component: runtime
commandLine: npm start
workingDir: ${PROJECTS_ROOT}
group:
kind: run
50 changes: 50 additions & 0 deletions tests/examples/source/devfiles/nodejs/devfile-with-tag.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
schemaVersion: 2.0.0
metadata:
name: nodejs
starterProjects:
- name: nodejs-starter
git:
remotes:
origin: "https://github.com/odo-devfiles/nodejs-ex.git"
checkoutFrom:
revision: 0.0.1
components:
- name: runtime
container:
image: registry.access.redhat.com/ubi8/nodejs-12:1-36
memoryLimit: 1024Mi
endpoints:
- name: "3000-tcp"
targetPort: 3000
mountSources: true
commands:
- id: devbuild
exec:
component: runtime
commandLine: npm install
workingDir: ${PROJECTS_ROOT}
group:
kind: build
isDefault: true
- id: build
exec:
component: runtime
commandLine: npm install
workingDir: ${PROJECTS_ROOT}
group:
kind: build
- id: devrun
exec:
component: runtime
commandLine: npm start
workingDir: ${PROJECTS_ROOT}
group:
kind: run
isDefault: true
- id: run
exec:
component: runtime
commandLine: npm start
workingDir: ${PROJECTS_ROOT}
group:
kind: run
51 changes: 51 additions & 0 deletions tests/examples/source/devfiles/springboot/devfile-with-subDir.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
schemaVersion: 2.0.0
metadata:
name: java-springboot
starterProjects:
- name: springbootproject
subDir: "/src/main"
git:
remotes:
origin: "https://github.com/odo-devfiles/springboot-ex.git"
components:
- name: tools
container:
image: quay.io/eclipse/che-java11-maven:next
memoryLimit: 768Mi
command: ['tail']
args: [ '-f', '/dev/null']
mountSources: true
volumeMounts:
- name: springbootpvc
path: /data/cache/.m2
- name: runtime
container:
image: quay.io/eclipse/che-java11-maven:next
memoryLimit: 768Mi
endpoints:
- name: "8080-tcp"
targetPort: 8080
volumeMounts:
- name: springbootpvc
path: /data/cache/.m2
mountSources: true
- name: springbootpvc
volume:
size: 3Gi
commands:
- id: defaultbuild
exec:
component: tools
commandLine: "mvn clean -Dmaven.repo.local=/data/cache/.m2/repository package -Dmaven.test.skip=true"
workingDir: /projects
group:
kind: build
- id: defaultrun
exec:
component: runtime
commandLine: "mvn -Dmaven.repo.local=/data/cache/.m2/repository spring-boot:run"
workingDir: /projects
group:
kind: run
isDefault: true
3 changes: 3 additions & 0 deletions tests/odo/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import os
import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def test_build_push_images(self):

# example devfile path
source_devfile_path = os.path.join(os.path.dirname(__file__),
'examples/source/devfiles/nodejs/devfile-outerloop.yaml')
'../examples/source/devfiles/nodejs/devfile-outerloop.yaml')

copy_and_create(source_devfile_path, "nodejs/project", tmp_workspace, self.CONTEXT)

Expand All @@ -55,7 +55,7 @@ def test_build_images_with_dockerfile_args(self):

# example devfile path
source_devfile_path = os.path.join(os.path.dirname(__file__),
'examples/source/devfiles/nodejs/devfile-outerloop-args.yaml')
'../examples/source/devfiles/nodejs/devfile-outerloop-args.yaml')

copy_and_create(source_devfile_path, "nodejs/project", tmp_workspace, self.CONTEXT)

Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions tests/test_config_cmd.py → tests/odo/test_config_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def test_config_view(self):

# example devfile path
source_devfile_path = os.path.join(os.path.dirname(__file__),
'examples/source/devfiles/nodejs/devfile-registry.yaml')
'../examples/source/devfiles/nodejs/devfile-registry.yaml')
shutil.copyfile(source_devfile_path, devfile_path)
subprocess.check_call(["odo", "create", "nodejs", "--devfile", "./devfile.yaml"])

Expand Down Expand Up @@ -63,7 +63,7 @@ def test_config_set(self):

# example devfile path
source_devfile_path = os.path.join(os.path.dirname(__file__),
'examples/source/devfiles/nodejs/devfile-registry.yaml')
'../examples/source/devfiles/nodejs/devfile-registry.yaml')
shutil.copyfile(source_devfile_path, devfile_path)
subprocess.check_call(["odo", "create", "nodejs", "--devfile", "./devfile.yaml"])

Expand Down
6 changes: 3 additions & 3 deletions tests/test_create_cmd.py → tests/odo/test_create_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def test_create_component_from_devfile_starter_project(self):

# example devfile path
source_devfile_path = os.path.join(os.path.dirname(__file__),
'examples/source/devfiles/java-openliberty/devfile.yaml')
'../examples/source/devfiles/java-openliberty/devfile.yaml')

source_devfile_path = os.path.abspath(source_devfile_path)

Expand Down Expand Up @@ -132,7 +132,7 @@ def test_create_component_with_starter_project_git_branch(self):
os.chdir(tmp_workspace)

source_devfile_path = os.path.join(os.path.dirname(__file__),
'examples/source/devfiles/nodejs/devfile-with-branch.yaml')
'../examples/source/devfiles/nodejs/devfile-with-branch.yaml')
copy_example_devfile(source_devfile_path, tmp_workspace)
subprocess.run(["odo", "create", "nodejs", "--starter", "nodejs-starter"])

Expand All @@ -153,7 +153,7 @@ def test_create_component_with_devfile_flag(self):
os.chdir(tmp_workspace)

source_devfile_path = os.path.join(os.path.dirname(__file__),
'examples/source/devfiles/nodejs/devfile.yaml')
'../examples/source/devfiles/nodejs/devfile.yaml')
copy_example_devfile(source_devfile_path, tmp_workspace)

subprocess.run(["odo", "create", "nodejs", "--devfile", "./devfile.yaml"])
Expand Down
6 changes: 3 additions & 3 deletions tests/test_deploy_cmd.py → tests/odo/test_deploy_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def test_deploy(self):

# example devfile path
source_devfile_path = os.path.join(os.path.dirname(__file__),
'examples/source/devfiles/nodejs/devfile-deploy.yaml')
'../examples/source/devfiles/nodejs/devfile-deploy.yaml')

copy_and_create(source_devfile_path, "nodejs/project", tmp_workspace, self.CONTEXT)

Expand Down Expand Up @@ -62,7 +62,7 @@ def test_deploy_image_component(self):

# example devfile path
source_devfile_path = os.path.join(os.path.dirname(__file__),
'examples/source/devfiles/nodejs/devfile-outerloop-project_source-in-docker-build-context.yaml')
'../examples/source/devfiles/nodejs/devfile-outerloop-project_source-in-docker-build-context.yaml')

copy_and_create(source_devfile_path, "nodejs/project", tmp_workspace, self.CONTEXT)

Expand Down Expand Up @@ -100,7 +100,7 @@ def test_deploy_image_component(self):
#
# # example devfile path
# source_devfile_path = os.path.join(os.path.dirname(__file__),
# 'examples/source/devfiles/nodejs/devfile-with-two-deploy-commands.yaml')
# '../examples/source/devfiles/nodejs/devfile-with-two-deploy-commands.yaml')
#
# copy_and_create(source_devfile_path, "nodejs/project", tmp_workspace, self.CONTEXT)
#
Expand Down
4 changes: 2 additions & 2 deletions tests/test_describe_cmd.py → tests/odo/test_describe_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def test_describe_missing_metadata(self):

# example devfile path
source_devfile_path = os.path.join(os.path.dirname(__file__),
'examples/source/devfiles/springboot/devfile-with-missing-projectType-metadata.yaml')
'../examples/source/devfiles/springboot/devfile-with-missing-projectType-metadata.yaml')

copy_and_create(source_devfile_path, "springboot/project", tmp_workspace, self.CONTEXT)

Expand All @@ -145,7 +145,7 @@ def test_describe_missing_metadata_and_language(self):

# example devfile path
source_devfile_path = os.path.join(os.path.dirname(__file__),
'examples/source/devfiles/springboot/devfile-with-missing-projectType-and-language-metadata.yaml')
'../examples/source/devfiles/springboot/devfile-with-missing-projectType-and-language-metadata.yaml')

copy_and_create(source_devfile_path, "springboot/project", tmp_workspace, self.CONTEXT)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def test_url_create_with_dot_devfile(self):

# example devfile path
source_devfile_path = os.path.join(os.path.dirname(__file__),
'examples/source/devfiles/nodejs/devfile.yaml')
'../examples/source/devfiles/nodejs/devfile.yaml')

copy_and_create(source_devfile_path, "nodejs/project", tmp_workspace, self.CONTEXT)

Expand Down
6 changes: 3 additions & 3 deletions tests/test_list_cmd.py → tests/odo/test_list_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def test_list_component_in_application(self):

# example devfile path
source_devfile_path = os.path.join(os.path.dirname(__file__),
'examples/source/devfiles/nodejs/devfile.yaml')
'../examples/source/devfiles/nodejs/devfile.yaml')

copy_and_create(source_devfile_path, "nodejs/project", tmp_workspace, self.CONTEXT)

Expand Down Expand Up @@ -74,7 +74,7 @@ def test_list_component_missing_metadata_projecttype(self):

# example devfile path
source_devfile_path = os.path.join(os.path.dirname(__file__),
'examples/source/devfiles/springboot/devfile-with-missing-projectType-metadata.yaml')
'../examples/source/devfiles/springboot/devfile-with-missing-projectType-metadata.yaml')

copy_and_create(source_devfile_path, "springboot/project", tmp_workspace, self.CONTEXT)

Expand Down Expand Up @@ -109,7 +109,7 @@ def test_list_component_missing_metadata_projecttype_language(self):

# example devfile path
source_devfile_path = os.path.join(os.path.dirname(__file__),
'examples/source/devfiles/springboot/devfile-with-missing-projectType-and-language-metadata.yaml')
'../examples/source/devfiles/springboot/devfile-with-missing-projectType-and-language-metadata.yaml')

copy_and_create(source_devfile_path, "springboot/project", tmp_workspace, self.CONTEXT)

Expand Down
Loading