# stages of gitlab ci. stages: - test - release # default settings for all ci jobs. default: image: azadehafzarhub/gitlab-ci-ruby-build:latest cache: paths: - vendor/ # job for testing package against ruby version 2.6 # on master branch and send test coverage result to # codeclimate. test main branch: stage: test before_script: # setup rvm. - source ~/.bash_profile # use ruby version 2.6. - rvm use 2.6 # upgrade bundler to latest version. - gem install bundler # install dependency gems. - bundle install --path vendor # run codeclimate test reporter agent. - cc-test-reporter before-build # run tests. script: - script/test.sh # send test coverage result to codeclimate. after_script: - cc-test-reporter after-build --coverage-input-type simplecov only: - master # job for testing package on other branches than master # and merge requests against 2.6 version. test ruby 2.6: stage: test before_script: # setup rvm. - source ~/.bash_profile # use ruby version 2.6. - rvm use 2.6 # upgrade bundler to latest version. - gem install bundler # install dependency gems. - bundle install --path vendor # run tests. script: - script/test.sh only: - branches - merge_requests except: - master test ruby 2.5: stage: test before_script: # setup rvm. - source ~/.bash_profile # use ruby version 2.5. - rvm use 2.5 # upgrade bundler to latest version. - gem install bundler # install dependency gems. - bundle install --path vendor # run tests. script: - script/test.sh except: - tags test ruby 2.4: stage: test before_script: # setup rvm. - source ~/.bash_profile # use ruby version 2.4. - rvm use 2.4 # upgrade bundler to latest version. - gem install bundler # install dependency gems. - bundle install --path vendor # run tests. script: - script/test.sh except: - tags test ruby 2.3: stage: test before_script: # setup rvm. - source ~/.bash_profile # use ruby version 2.3. - rvm use 2.3 # upgrade bundler to latest version. - gem install bundler # install dependency gems. - bundle install --path vendor # run tests. script: - script/test.sh except: - tags # deploy gems to rubygems.org whenever a tag is released. release to rubygems: stage: release script: # setup rvm. - source ~/.bash_profile # use ruby version 2.6. - rvm use 2.6 # create rubygems credential file for auto login. - script/ci_rubygems.sh # extract tag from git log and strip "v". - version=$(git describe --tags) - version=${version:1} # build and push gem. - gem build html-pipeline-negarmoji.gemspec - gem push "html-pipeline-negarmoji-$version.gem" # only run for new tags. only: - tags when: manual