# See documentation at https://docs.gitlab.com/ee/ci/yaml/README.html variables: CI_REGISTRY_IMAGE_LATEST: $CI_REGISTRY_IMAGE:latest CI_REGISTRY_IMAGE_STABLE: $CI_REGISTRY_IMAGE:stable stages: - test - deploy .docker_build: &docker image: docker:latest services: - docker:dind before_script: - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY .ruby_build: &ruby image: $CI_REGISTRY_IMAGE_LATEST # Cache gems in between builds cache: paths: - /cache # This is a basic example for a gem or script which doesn't use # services such as redis or postgres before_script: - ruby -v # Print out ruby version for debugging - gem install bundler --no-ri --no-rdoc # Bundler is not installed with the image - bundle install -j $(nproc) --path=".bundle" # Install dependencies into ./.bundle .release_docker_image: &release_docker_image <<: *docker stage: deploy script: - echo "Releasing ${$TARGET_IMAGE} from $CI_REGISTRY_IMAGE_LATEST" - docker pull $CI_REGISTRY_IMAGE_LATEST - docker tag $CI_REGISTRY_IMAGE_LATEST ${$TARGET_IMAGE} - docker push ${$TARGET_IMAGE} test: <<: *ruby script: bin/rake test stage: test artifacts: paths: - Gemfile.lock - spec/reports - coverage doc: <<: *ruby script: bin/rake doc stage: test artifacts: paths: - doc build latest docker: <<: *docker stage: deploy only: - develop dependencies: - test script: - echo "Building $CI_REGISTRY_IMAGE_LATEST" - docker build --pull -t $CI_REGISTRY_IMAGE_LATEST . - docker push $CI_REGISTRY_IMAGE_LATEST build stable docker: <<: *docker stage: deploy only: - master dependencies: - test script: - echo "Building $CI_REGISTRY_IMAGE_STABLE" - docker build --pull -t $CI_REGISTRY_IMAGE_STABLE . - docker push $CI_REGISTRY_IMAGE_STABLE build_gem: <<: *ruby script: bin/rake build only: - develop stage: deploy artifacts: paths: - doc - pkg