Skip to content

Commit

Permalink
Merge pull request #1 from Clever/bstein-dev-public
Browse files Browse the repository at this point in the history
Pruning git history. Now public!
  • Loading branch information
bstein-clever authored Sep 30, 2020
2 parents 404391a + e6dbda1 commit cabf0de
Show file tree
Hide file tree
Showing 52 changed files with 6,426 additions and 0 deletions.
112 changes: 112 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
version: 2.1

executors:
common-executor:
working_directory: /go/src/github.com/Clever/analytics-latency-config-service
docker:
- image: circleci/golang:1.13-stretch-node
- image: circleci/postgres:9.4-alpine-ram
- image: circleci/mongo:3.2.20-jessie-ram
environment:
POSTGRES_USER: postgres

environment:
CIRCLE_ARTIFACTS: /tmp/circleci-artifacts
CIRCLE_TEST_REPORTS: /tmp/circleci-test-results
POSTGRES_USER: postgres

commands:
clone-ci-scripts:
description: Clone the ci-scripts repo
steps:
- run:
command: cd .. && git clone --depth 1 -v https://github.com/Clever/ci-scripts.git && cd ci-scripts && git show --oneline -s
name: Clone ci-scripts

jobs:
build:
executor: common-executor
steps:
- checkout
- run:
command: sudo apt-get update && sudo apt-get install postgresql
name: Install psql
- run:
command: |-
echo Waiting for postgres
for i in `seq 1 10`;
do
nc -z localhost 5432 && echo Success && exit 0
echo -n .
sleep 1
done
echo Failed waiting for postgres && exit 1
name: Wait for postgres database to be ready
- run: make install_deps
- run: make db-setup
- run: make build
- run: make test
- persist_to_workspace:
root: /go/src/github.com/Clever
paths: "."

publish:
executor: common-executor
steps:
- attach_workspace:
at: /go/src/github.com/Clever
- clone-ci-scripts
- setup_remote_docker
- run: ../ci-scripts/circleci/docker-publish $DOCKER_USER $DOCKER_PASS "$DOCKER_EMAIL" $DOCKER_ORG
- run: ../ci-scripts/circleci/catapult-publish $CATAPULT_URL $CATAPULT_USER $CATAPULT_PASS $APP_NAME
- run: if [ "${CIRCLE_BRANCH}" == "master" ]; then ../ci-scripts/circleci/npm-publish $NPM_TOKEN gen-js/; fi;
- run: if [ "${CIRCLE_BRANCH}" == "master" ]; then cat ./swagger.yml | grep "^ version:" | cut -d":" -f2 | tr -d " " > ./VERSION; fi;
- run: if [ "${CIRCLE_BRANCH}" == "master" ]; then ../ci-scripts/circleci/github-release $GH_RELEASE_TOKEN; fi;

unit-test:
executor: common-executor
steps:
- attach_workspace:
at: /go/src/github.com/Clever
- run:
command: sudo apt-get update && sudo apt-get install postgresql
name: Install psql
- run:
command: |-
echo Waiting for postgres
for i in `seq 1 10`;
do
nc -z localhost 5432 && echo Success && exit 0
echo -n .
sleep 1
done
echo Failed waiting for postgres && exit 1
name: Wait for postgres database to be ready
- run:
command: mkdir -p $CIRCLE_ARTIFACTS $CIRCLE_TEST_REPORTS
name: Set up CircleCI artifacts directories
- run: make db-setup
- run: make test

deploy:
executor: common-executor
steps:
- clone-ci-scripts
- run: if [ "${CIRCLE_BRANCH}" == "master" ]; then ../ci-scripts/circleci/dapple-deploy $DAPPLE_URL $DAPPLE_USER $DAPPLE_PASS $APP_NAME clever-dev no-confirm-deploy; fi;
- run: if [ "${CIRCLE_BRANCH}" == "master" ]; then ../ci-scripts/circleci/dapple-deploy $DAPPLE_URL $DAPPLE_USER $DAPPLE_PASS $APP_NAME production no-confirm-deploy; fi;

workflows:
version: 2.1
build_test_publish_deploy:
jobs:
- build
- unit-test:
requires:
- build
- publish:
requires:
- build
- deploy:
requires:
- unit-test
- publish
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
gen-*/** linguist-generated
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @Clever/eng-deip
13 changes: 13 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## Link to JIRA:
[Link to JIRA](url)

## Overview:
[insert description]

If you made any changes to swagger.yml:
- [ ] Update swagger.yml version
- [ ] Run "make generate"

## Testing

## Rollout
18 changes: 18 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# osx / sshfs
._*
.DS_Store

# emacs / vim
*~
\#*\#
.\#*

vendor
bin

# don't commit mocks
mock_*.go

# js
node_modules
package-lock.json
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM alpine:3.10

RUN apk add ca-certificates
RUN update-ca-certificates

COPY kvconfig.yml /bin/kvconfig.yml
COPY bin/analytics-latency-config-service /bin/analytics-latency-config-service

CMD ["/bin/analytics-latency-config-service", "--addr=0.0.0.0:80"]
Loading

0 comments on commit cabf0de

Please sign in to comment.