-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
197 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
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,133 @@ | ||
# from https://circleci.com/docs/2.0/configuration-reference/#example-full-configuration | ||
version: 2.1 | ||
jobs: | ||
build: | ||
docker: | ||
- image: ubuntu:14.04 | ||
auth: | ||
username: mydockerhub-user | ||
password: $DOCKERHUB_PASSWORD # context / project UI env-var reference | ||
|
||
- image: mongo:2.6.8 | ||
auth: | ||
username: mydockerhub-user | ||
password: $DOCKERHUB_PASSWORD # context / project UI env-var reference | ||
command: [mongod, --smallfiles] | ||
|
||
- image: postgres:9.4.1 | ||
auth: | ||
username: mydockerhub-user | ||
password: $DOCKERHUB_PASSWORD # context / project UI env-var reference | ||
# some containers require setting environment variables | ||
environment: | ||
POSTGRES_USER: root | ||
|
||
- image: redis@sha256:54057dd7e125ca41afe526a877e8bd35ec2cdd33b9217e022ed37bdcf7d09673 | ||
auth: | ||
username: mydockerhub-user | ||
password: $DOCKERHUB_PASSWORD # context / project UI env-var reference | ||
|
||
- image: rabbitmq:3.5.4 | ||
auth: | ||
username: mydockerhub-user | ||
password: $DOCKERHUB_PASSWORD # context / project UI env-var reference | ||
|
||
environment: | ||
TEST_REPORTS: /tmp/test-reports | ||
|
||
working_directory: ~/my-project | ||
|
||
steps: | ||
- checkout | ||
|
||
- run: | ||
shell: /bin/dash | ||
command: echo 127.0.0.1 devhost | sudo tee -a /etc/hosts | ||
|
||
# Create Postgres users and database | ||
# Note the YAML heredoc '|' for nicer formatting | ||
- run: | | ||
sudo -u root createuser -h localhost --superuser ubuntu && | ||
sudo createdb -h localhost test_db | ||
- restore_cache: | ||
keys: | ||
- v1-my-project-{{ checksum "project.clj" }} | ||
- v1-my-project- | ||
|
||
- run: | ||
environment: | ||
SSH_TARGET: "localhost" | ||
TEST_ENV: "linux" | ||
command: | | ||
set -xu | ||
mkdir -p ${TEST_REPORTS} | ||
run-tests.sh | ||
cp out/tests/*.xml ${TEST_REPORTS} | ||
- run: | | ||
set -xu | ||
mkdir -p /tmp/artifacts | ||
create_jars.sh << pipeline.number >> | ||
cp *.jar /tmp/artifacts | ||
- save_cache: | ||
key: v1-my-project-{{ checksum "project.clj" }} | ||
paths: | ||
- ~/.m2 | ||
|
||
# Save artifacts | ||
- store_artifacts: | ||
path: /tmp/artifacts | ||
destination: build | ||
|
||
# Upload test results | ||
- store_test_results: | ||
path: /tmp/test-reports | ||
|
||
deploy-stage: | ||
docker: | ||
- image: ubuntu:14.04 | ||
auth: | ||
username: mydockerhub-user | ||
password: $DOCKERHUB_PASSWORD # context / project UI env-var reference | ||
working_directory: /tmp/my-project | ||
steps: | ||
- run: | ||
name: Deploy if tests pass and branch is Staging | ||
command: ansible-playbook site.yml -i staging | ||
|
||
deploy-prod: | ||
docker: | ||
- image: ubuntu:14.04 | ||
auth: | ||
username: mydockerhub-user | ||
password: $DOCKERHUB_PASSWORD # context / project UI env-var reference | ||
working_directory: /tmp/my-project | ||
steps: | ||
- run: | ||
name: Deploy if tests pass and branch is Main | ||
command: ansible-playbook site.yml -i production | ||
|
||
workflows: | ||
version: 2 | ||
build-deploy: | ||
jobs: | ||
- build: | ||
filters: | ||
branches: | ||
ignore: | ||
- develop | ||
- /feature-.*/ | ||
- deploy-stage: | ||
requires: | ||
- build | ||
filters: | ||
branches: | ||
only: staging | ||
- deploy-prod: | ||
requires: | ||
- build | ||
filters: | ||
branches: | ||
only: main |
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