diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 000000000..14e14213e --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,65 @@ +image: funcy/go-dind:latest + +cache: + key: "$CI_COMMIT_REF_NAME" + untracked: true + +stages: +- deps +- build +- test +- deploy + +before_script: + - mkdir -p "${GOPATH}/src/gitlab-odx.oracle.com/odx/" + - ln -s `pwd` "${GOPATH}/src/gitlab-odx.oracle.com/odx/" + - cd "${GOPATH}/src/gitlab-odx.oracle.com/odx/functions" + +get_deps: + stage: deps + script: + - cd "${GOPATH}/src/gitlab-odx.oracle.com/odx/functions" + - pwd + - go get github.com/Masterminds/glide + - glide install --strip-vendor + - cd "${GOPATH}/src/gitlab-odx.oracle.com/odx/functions/fn" + - pwd + - glide install --strip-vendor + only: + - master + +load_deps: + stage: deps + script: + - cd "${GOPATH}/src/gitlab-odx.oracle.com/odx/functions" + - pwd + - ls vendor/github.com/ > /dev/null || which glide || go get github.com/Masterminds/glide + - ls vendor/github.com/ > /dev/null || glide install --strip-vendor + - cd "${GOPATH}/src/gitlab-odx.oracle.com/odx/functions/fn" + - pwd + - ls vendor/github.com/ > /dev/null || glide install --strip-vendor + except: + - master + +build_job: + stage: build + script: + - go build -o functions-alpine + +test_job: + stage: test + script: + - ./test.sh + +deploy_job: + only: + - tags + - master + stage: deploy + script: + - ls + - docker build -t ${DOCKER_IMAGE}:latest . + - docker tag ${DOCKER_IMAGE}:latest ${DOCKER_IMAGE}:${CI_COMMIT_REF_NAME} + - docker login -p ${DOCKER_PASSWORD} -u ${DOCKER_USERNAME} ${DOCKER_REGISTRY} + - docker push ${DOCKER_IMAGE}:${CI_COMMIT_REF_NAME} + - docker push ${DOCKER_IMAGE}:latest diff --git a/Makefile b/Makefile index 37ca00238..8b1b5fbf9 100644 --- a/Makefile +++ b/Makefile @@ -40,6 +40,6 @@ docker-test: -v ${CURDIR}:/go/src/gitlab-odx.oracle.com/odx/functions \ -w /go/src/gitlab-odx.oracle.com/odx/functions \ funcy/go:dev go test \ - -v $(shell docker run -ti -v ${CURDIR}:/go/src/gitlab-odx.oracle.com/odx/functions -w /go/src/gitlab-odx.oracle.com/odx/functions -e GOPATH=/go golang:alpine sh -c 'go list ./... | grep -v vendor | grep -v examples | grep -v tool | grep -v fn | grep -v datastore') + -v $(shell docker run --rm -ti -v ${CURDIR}:/go/src/gitlab-odx.oracle.com/odx/functions -w /go/src/gitlab-odx.oracle.com/odx/functions -e GOPATH=/go golang:alpine sh -c 'go list ./... | grep -v vendor | grep -v examples | grep -v tool | grep -v fn') all: dep build diff --git a/README.md b/README.md index ad903e4cc..aa94d0328 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Oracle Functions +# Oracle Functions [![build status](https://gitlab-odx.oracle.com/odx/functions/badges/master/build.svg)](https://gitlab-odx.oracle.com/odx/functions/commits/master) @@ -24,9 +24,9 @@ platform that you can run anywhere. Some of it's key features: ## Usage -### Installation (if running locally) +### Installation (if running locally) -NOTE: The following instructions apply while the project is a private repo. This will +NOTE: The following instructions apply while the project is a private repo. This will build the Functions server and the CLI tool directly from the repo instead of using pre-built containers. Once the project is public, these steps will be unnecessary. @@ -58,7 +58,7 @@ Download the pre-built CLI binary: 4. chmod +x -