This commit is contained in:
Albert Yi
2018-05-11 13:57:46 -07:00
parent 72d630a300
commit d171b1a2ea
2 changed files with 13 additions and 6 deletions

View File

@@ -35,19 +35,20 @@ jobs:
command: env | egrep 'DEBUG|DANBOORU|RAILS|DATABASE_URL|SECRET' > .env.test command: env | egrep 'DEBUG|DANBOORU|RAILS|DATABASE_URL|SECRET' > .env.test
- run: - run:
name: Build and Start Docker containers name: Build and Start Docker containers
command: docker-compose -f config/docker/compose.yml up -d web command: |
docker-compose -f config/docker/compose.yml up -d web
- run: - run:
name: Run database migrations name: Run database migrations
command: | command: |
docker-compose -f config/docker/compose.yml exec archives dockerize -wait tcp://$PGHOST:$PGPORT bash -l -c 'cd /app ; bundle exec rake db:create ; bundle exec rake db:migrate' docker-compose -f config/docker/compose.yml exec archives dockerize -wait tcp://$PGHOST:$PGPORT bash -l -c 'cd /app ; bundle exec rake db:create ; bundle exec rake db:migrate'
docker-compose -f config/docker/compose.yml exec web dockerize -wait tcp://$PGHOST:$PGPORT bash -l -c 'cd /app ; bin/rake db:create ; bin/rake db:migrate' docker-compose -f config/docker/compose.yml exec web dockerize -wait tcp://$PGHOST:$PGPORT bash -l -c 'cd /app ; bin/rake db:create ; bin/rake db:migrate'
- run: - run:
name: Run tests name: Test splitting
command: | command: |
sudo curl -o /usr/local/bin/circleci https://circle-downloads.s3.amazonaws.com/releases/build_agent_wrapper/circleci && chmod +x /usr/local/bin/circleci circleci tests glob test/**/*_test.rb | circleci tests split | xargs -I{} docker-compose -f config/docker/compose.yml exec -T web bash -l -c 'cd /app ; bin/rails test {}'
circleci tests glob "test/**/*_test.rb" | circleci tests split | docker-compose -f config/docker/compose.yml exec web bin/rails test docker cp docker_web_1:/app/test/reports /tmp
- store_test_results: - store_test_results:
path: test/reports path: /tmp/reports
- run: - run:
name: Teardown name: Teardown
command: docker-compose -f config/docker/compose.yml down command: docker-compose -f config/docker/compose.yml down

View File

@@ -5,5 +5,11 @@ FROM r888888888/danbooru-base
USER root USER root
COPY . /app COPY . /app
RUN chown -R danbooru:danbooru . RUN chown -R danbooru:danbooru .
# install circleci cli tools
RUN curl -q -o /usr/local/bin/circleci https://circle-downloads.s3.amazonaws.com/releases/build_agent_wrapper/circleci
RUN chmod +x /usr/local/bin/circleci
RUN sed -i'' -e 's/run -it/run -i/' /usr/local/bin/circleci
USER danbooru USER danbooru
RUN bundle install > /dev/null RUN bundle install > /dev/null