-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Backporting github changed to gitlabs
- Loading branch information
Showing
4 changed files
with
881 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,205 @@ | ||
|
||
version: 2.1 | ||
|
||
executors: | ||
docker-image-golang: | ||
environment: | ||
PROJECT_ROOT_FOLDER: ~/project | ||
docker: | ||
- image: golang:1.11 | ||
docker-publisher: | ||
environment: | ||
PROJECT_ROOT_FOLDER: ~/project | ||
CONTAINER_IMAGE_NAME: proxeus/proxeus-core | ||
docker: | ||
- image: circleci/buildpack-deps:stretch | ||
|
||
jobs: | ||
validate: | ||
executor: docker-image-golang | ||
steps: | ||
- checkout | ||
- restore_cache: | ||
keys: | ||
- go-vendor-v1-{{ .Branch }} | ||
- run: | ||
command: make link-repo | ||
- run: | ||
command: curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh | ||
- run: | ||
command: go get golang.org/x/tools/cmd/goimports | ||
- run: | ||
command: | | ||
cd /go/src/git.proxeus.com/core/central | ||
dep ensure -v | ||
- run: | ||
command: chmod -R +x ./build | ||
- run: | ||
command: | | ||
cd /go/src/git.proxeus.com/core/central | ||
make fmt | ||
- run: | ||
command: | | ||
cd /go/src/git.proxeus.com/core/central | ||
make validate | ||
- save_cache: | ||
key: go-vendor-v1-{{ .Branch }} | ||
paths: | ||
- vendor/ | ||
|
||
test: | ||
executor: docker-image-golang | ||
steps: | ||
- checkout | ||
- restore_cache: | ||
keys: | ||
- go-vendor-v1-{{ .Branch }} | ||
- run: | ||
command: chmod -R +x ./build | ||
- run: | ||
command: make link-repo | ||
- run: | ||
command: | | ||
cd /go/src/git.proxeus.com/core/central | ||
make test | ||
- save_cache: | ||
key: go-vendor-v1-{{ .Branch }} | ||
paths: | ||
- vendor/ | ||
|
||
build-ui: | ||
docker: | ||
- image: node:10 | ||
steps: | ||
- checkout | ||
- restore_cache: | ||
keys: | ||
- yarn-v1-{{ .Branch }} | ||
- run: | ||
command: chmod -R +x ./build | ||
- run: | ||
command: make ui | ||
- save_cache: | ||
key: yarn-v1-{{ .Branch }} | ||
paths: | ||
- ui/.yarn/ | ||
- ui/node_modules/ | ||
- ui/core/node_modules/ | ||
- ui/wallet/node_modules/ | ||
- persist_to_workspace: | ||
root: . | ||
paths: | ||
- ./artifacts/dist | ||
|
||
build-go: | ||
executor: docker-image-golang | ||
steps: | ||
- checkout | ||
- attach_workspace: | ||
at: ~/project/ | ||
- restore_cache: | ||
keys: | ||
- go-vendor-v1-{{ .Branch }} | ||
- run: | ||
command: chmod -R +x ./build | ||
- run: | ||
name: | ||
command: make link-repo | ||
- run: | ||
name: | ||
command: | | ||
cd /go/src/git.proxeus.com/core/central | ||
make server-docker | ||
- save_cache: | ||
key: go-vendor-v1-{{ .Branch }} | ||
paths: | ||
- vendor/ | ||
- persist_to_workspace: | ||
root: . | ||
paths: | ||
- ./artifacts/server-docker | ||
|
||
build-docker: | ||
executor: docker-publisher | ||
steps: | ||
- checkout | ||
- attach_workspace: | ||
at: ~/project/ | ||
- setup_remote_docker | ||
- run: | ||
name: Build Docker image | ||
command: | | ||
docker build -f Dockerfile -t $CONTAINER_IMAGE_NAME:latest -t $CONTAINER_IMAGE_NAME . | ||
- run: | ||
name: Archive Docker image | ||
command: docker save -o image.tar $CONTAINER_IMAGE_NAME | ||
- persist_to_workspace: | ||
root: . | ||
paths: | ||
- image.tar | ||
|
||
publish-latest: | ||
executor: docker-publisher | ||
steps: | ||
- attach_workspace: | ||
at: /tmp/workspace | ||
- setup_remote_docker | ||
- run: | ||
name: Load archived Docker image | ||
command: docker load -i /tmp/workspace/image.tar | ||
- run: | ||
name: Publish Docker Image to Docker Hub | ||
command: | | ||
echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin | ||
docker push $CONTAINER_IMAGE_NAME | ||
publish-demo: | ||
executor: docker-publisher | ||
steps: | ||
- attach_workspace: | ||
at: /tmp/workspace | ||
- setup_remote_docker | ||
- run: | ||
name: Load archived Docker image | ||
command: docker load -i /tmp/workspace/image.tar | ||
- run: | ||
name: Tag docker image | ||
command: docker tag $CONTAINER_IMAGE_NAME $CONTAINER_IMAGE_NAME:demo | ||
- run: | ||
name: Publish Docker Image to Docker Hub | ||
command: | | ||
echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin | ||
docker push $CONTAINER_IMAGE_NAME:demo | ||
workflows: | ||
version: 2 | ||
build-master: | ||
jobs: | ||
- validate | ||
- test: | ||
requires: | ||
- validate | ||
- build-ui: | ||
requires: | ||
- test | ||
- build-go: | ||
requires: | ||
- build-ui | ||
- build-docker: | ||
requires: | ||
- build-ui | ||
- build-go | ||
- publish-latest: | ||
requires: | ||
- build-docker | ||
- hold: | ||
type: approval | ||
requires: | ||
- build-docker | ||
- publish-demo: | ||
requires: | ||
- hold | ||
filters: | ||
branches: | ||
only: master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.