Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .github/workflows/gotest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Devfile Go integration tests

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

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

steps:

- name: Setup Go environment
uses: actions/setup-go@v2.1.3
with:
go-version: 1.15
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: Check go mod status
run: |
make gomod_tidy
if [[ ! -z $(git status -s) ]]
then
echo "Go mod state is not clean"
git diff "$GITHUB_SHA"
exit 1
fi

- name: Check format
run: |
make gofmt
if [[ ! -z $(git status -s) ]]
then
echo "not well formatted sources are found : $(git status -s)"
exit 1
fi

- name: Run Go Tests
run: make test

# - name: Upload Test Coverage results
# uses: actions/upload-artifact@v2
# with:
# name: lib-test-coverage-html
# path: tests/v2/lib-test-coverage.html
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,5 @@ dmypy.json
# Pyre type checker
.pyre/

# Test temp directory
tests/v2/integrationTest/tmp/
29 changes: 29 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FILES := main

default: bin

.PHONY: all
all: gomod_tidy gofmt test

.PHONY: gomod_tidy
gomod_tidy:
go mod tidy

.PHONY: gofmt
gofmt:
go fmt -x ./...

.PHONY: bin
bin:
go build *.go

.PHONY: test
test:
go test -v ./tests/v2/integrationTest
# go test -coverprofile tests/v2/lib-test-coverage.out -v ./...
# go tool cover -html=tests/v2/lib-test-coverage.out -o tests/v2/lib-test-coverage.html

.PHONY: clean
clean:
@rm -rf $(FILES)

36 changes: 36 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
module github.com/devfile/library

go 1.15

require (
github.com/devfile/api/v2 v2.0.0-20220309195345-48ebbf1e51cf
github.com/fatih/color v1.7.0
github.com/fsnotify/fsnotify v1.4.9
github.com/gobwas/glob v0.2.3
github.com/golang/mock v1.5.0
github.com/google/go-cmp v0.5.5
github.com/google/go-github v17.0.0+incompatible // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7
github.com/hashicorp/go-multierror v1.1.1
github.com/hashicorp/go-version v1.3.0
github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348
github.com/mattn/go-colorable v0.1.2 // indirect
github.com/mattn/go-isatty v0.0.12 // indirect
github.com/onsi/ginkgo v1.16.4
github.com/onsi/gomega v1.14.0
github.com/openshift/api v0.0.0-20200930075302-db52bc4ef99f
github.com/openshift/odo v1.2.6
github.com/pkg/errors v0.9.1
github.com/spf13/afero v1.2.2
github.com/stretchr/testify v1.7.0
github.com/tidwall/gjson v1.14.1
github.com/xeipuuv/gojsonschema v1.2.0
k8s.io/api v0.21.3
k8s.io/apimachinery v0.21.3
k8s.io/client-go v0.21.3
k8s.io/klog v1.0.0
k8s.io/utils v0.0.0-20210722164352-7f3ee0f31471
sigs.k8s.io/controller-runtime v0.9.5
sigs.k8s.io/yaml v1.2.0
)
816 changes: 816 additions & 0 deletions go.sum

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ var _ = Describe("odo devfile create command tests", func() {
})

Measure("should successfully create the devfile component with valid component name", func(b Benchmarker) {
runtime := b.Time("========== Command: odo create java-openliberty " +
cmpName + " ==========", func() {
runtime := b.Time("========== Command: odo create java-openliberty "+
cmpName+" ==========", func() {
helper.Cmd("odo", "create", "java-openliberty", cmpName).ShouldPass()
})
b.RecordValueWithPrecision("========== Execution time in ms ==========", float64(runtime.Milliseconds()), "ms", 2)
Expand Down
Loading