forked from e621ng/e621ng
38 lines
1.4 KiB
YAML
38 lines
1.4 KiB
YAML
version: 2
|
|
|
|
defaults: &defaults
|
|
working_directory: ~/app
|
|
docker:
|
|
- image: circleci/buildpack-deps:trusty
|
|
environment:
|
|
DOCKER_VERSION: 18.03.1-ce
|
|
DOCKER_COMPOSE_VERSION: 1.21.1
|
|
|
|
jobs:
|
|
build:
|
|
<<: *defaults
|
|
parallelism: 5
|
|
steps:
|
|
- checkout
|
|
- setup_remote_docker:
|
|
docker_layer_caching: true
|
|
- run:
|
|
name: Create .env.test file
|
|
command: env | egrep 'DEBUG|DANBOORU|RAILS|DATABASE_URL|SECRET' > .env.test
|
|
- run:
|
|
name: Build and Start Docker containers
|
|
command: |
|
|
docker-compose -f config/docker/compose.yml up -d web
|
|
- run:
|
|
name: Run database migrations
|
|
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 web dockerize -wait tcp://$PGHOST:$PGPORT bash -l -c 'cd /app ; bin/rake db:create ; bin/rake db:migrate'
|
|
- run:
|
|
name: Run tests
|
|
command: |
|
|
circleci tests glob test/**/*_test.rb | circleci tests split --split-by=timings | xargs -I{} docker-compose -f config/docker/compose.yml exec -T web bash -l -c 'cd /app ; bin/rails test --no-ci-clean {}'
|
|
docker cp docker_web_1:/app/test/reports /tmp
|
|
- store_test_results:
|
|
path: /tmp/reports
|