-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
1b790d8
commit ed1e4c9
Showing
1 changed file
with
46 additions
and
20 deletions.
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 |
---|---|---|
@@ -1,32 +1,58 @@ | ||
docker-defaults: &docker-defaults | ||
docker: | ||
- image: docker:18.03.0-ce-git | ||
working_directory: ~/app | ||
|
||
version: 2 | ||
jobs: | ||
build: | ||
docker: | ||
- image: circleci/ruby:2.4 | ||
working_directory: ~/marli | ||
test: | ||
<<: *docker-defaults | ||
steps: | ||
- checkout | ||
- setup_remote_docker | ||
- run: | ||
name: Install Docker Compose | ||
name: Setup docker-compose dependency | ||
command: | | ||
set -x | ||
sudo curl -L https://github.com/docker/compose/releases/download/1.11.2/docker-compose-`uname -s`-`uname -m` > ~/docker-compose | ||
chmod +x ~/docker-compose | ||
sudo mv ~/docker-compose /usr/local/bin/docker-compose | ||
apk add --no-cache python3 | ||
pip3 install docker-compose==1.20.1 | ||
- run: | ||
name: Start container and run tests | ||
name: Test | ||
command: | | ||
docker-compose run test | ||
- deploy: | ||
name: Deploy | ||
deploy-dev: | ||
<<: *docker-defaults | ||
steps: | ||
- setup_remote_docker | ||
- run: | ||
name: Deploy into staging via Jenkins | ||
command: | | ||
if [ "${CIRCLE_BRANCH}" == "master" ]; then | ||
echo "Deploying to production" | ||
curl -u $JENKINS_USERNAME:$JENKINS_API_KEY -X POST http://jenkins.library.nyu.edu/view/MaRLI/job/MaRLI%20Production%20Deploy/build/api | ||
elif [[ "${CIRCLE_BRANCH}" =~ (feature|bug|hotfix|chore)\/(.+) ]]; then | ||
echo "Deploying to development" | ||
curl -u $JENKINS_USERNAME:$JENKINS_API_KEY -X POST http://jenkins.library.nyu.edu/view/MaRLI/job/MaRLI%20Development%20Deploy/build/api | ||
fi | ||
docker run --rm appropriate/curl -u $JENKINS_USERNAME:$JENKINS_API_KEY -X POST http://jenkins.library.nyu.edu/view/MaRLI/job/MaRLI%20Development%20Deploy/build/api | ||
deploy-prod: | ||
<<: *docker-defaults | ||
steps: | ||
- setup_remote_docker | ||
- run: | ||
name: Deploy into production via Jenkins | ||
command: | | ||
docker run --rm appropriate/curl -u $JENKINS_USERNAME:$JENKINS_API_KEY -X POST http://jenkins.library.nyu.edu/view/MaRLI/job/MaRLI%20Production%20Deploy/build/api | ||
workflows: | ||
version: 2 | ||
build-test-and-deploy: | ||
jobs: | ||
- test | ||
- deploy-dev: | ||
requires: | ||
- test | ||
filters: | ||
branches: | ||
ignore: | ||
- master | ||
- deploy-prod: | ||
requires: | ||
- test | ||
filters: | ||
branches: | ||
only: master |