# 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 rbenv. - source ~/.bash_profile # use ruby version 2.7.0 . - rbenv global 2.7.0 # install dependency gems. - bundle config set path 'vendor' - bundle install # 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.7.0 version. test ruby 2.7.0: stage: test before_script: # setup rbenv. - source ~/.bash_profile # use ruby version 2.7.0 . - rbenv global 2.7.0 # install dependency gems. - bundle config set path 'vendor' - bundle install # run tests. script: - script/test.sh only: - branches - merge_requests except: - master # jobs for testing package against older ruby versions. test ruby 2.6.5: stage: test before_script: # setup rbenv. - source ~/.bash_profile # use ruby version 2.6.5 . - rbenv global 2.6.5 # install dependency gems. - bundle config set path 'vendor' - bundle install # run tests. script: - script/test.sh except: - tags test ruby 2.5.7: stage: test before_script: # setup rbenv. - source ~/.bash_profile # use ruby version 2.5.7 . - rbenv global 2.5.7 # install dependency gems. - bundle config set path 'vendor' - bundle install # run tests. script: - script/test.sh except: - tags # release a preview blog for master branch with gitlab pages. pages: stage: release script: # setup rbenv. - source ~/.bash_profile # use ruby version 2.7.0 - rbenv global 2.7.0 # go to blog folder. - cd doc/blog # install dependency gems. - bundle config set path 'vendor' - bundle install # generate site with jekyll. - bundle exec jekyll build --trace --destination ../../public artifacts: paths: - public only: - master when: manual # deploy gems to rubygems.org whenever a tag is released. release to rubygems: stage: release script: # setup rbenv. - source ~/.bash_profile # use ruby version 2.7.0 - rbenv global 2.7.0 # 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 jekyll-openmoji.gemspec - gem push "jekyll-openmoji-$version.gem" # only run for new tags. only: - tags when: manual