.gitlab-ci.yml
# stages of gitlab ci.
stages:
- test
- deploy
- release
# default settings for all ci jobs.
default:
image: azadehafzarhub/gitlab-ci-ruby-build:latest
cache:
paths:
- vendor/
# job for testing package against default ruby version
# on master branch and send test coverage result to
# codeclimate.
test master branch defaut:
stage: test
before_script:
# setup rbenv.
- source ~/.bash_profile
# use default ruby version.
- rbenv global 3.0.0
# install dependency gems.
- bundle config set path 'vendor'
- bundle install
# run codeclimate test reporter agent.
- cc-test-reporter before-build
# run tests.
script:
- cd 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 mon master branch
# and merge requests against other ruby versions.
test master branch ruby 2.7.2:
stage: test
before_script:
# setup rbenv.
- source ~/.bash_profile
# use custom ruby version.
- rbenv global 2.7.2
# install dependency gems.
- bundle config set path 'vendor'
- bundle install
# run tests.
script:
- cd script && ./test.sh
only:
- master
# job for testing package on other branches than master
# and merge requests against default version.
test branch ruby default:
stage: test
before_script:
# setup rbenv.
- source ~/.bash_profile
# use default ruby version.
- rbenv global 3.0.0
# install dependency gems.
- bundle config set path 'vendor'
- bundle install
# run tests.
script:
- cd script && ./test.sh
only:
- branches
- merge_requests
except:
- master
# job for testing package on other branches than master
# and merge requests against other ruby versions.
test branch ruby 2.7.2:
stage: test
before_script:
# setup rbenv.
- source ~/.bash_profile
# use custom ruby version.
- rbenv global 2.7.2
# install dependency gems.
- bundle config set path 'vendor'
- bundle install
# run tests.
script:
- cd script && ./test.sh
only:
- branches
- merge_requests
except:
- master
# release a preview blog for master branch with gitlab pages.
pages:
stage: deploy
before_script:
# setup rbenv.
- source ~/.bash_profile
# use ruby version 3.0.0 .
- rbenv global 3.0.0
# delete and recreate directory.
- rm --force --recursive public
- mkdir public
# go to blog folder.
- cd doc/blog
# install dependency gems.
- bundle config set path 'vendor'
- bundle install
script:
# generate site with jekyll.
- bundle exec jekyll build --trace --config ./_config.yml --destination ../../public
artifacts:
paths:
- public
expire_in: 7 days
only:
- tags
when: manual
# deploy gems to rubygems.org whenever a tag is released.
release to rubygems:
stage: release
script:
# setup rbenv.
- source ~/.bash_profile
# use default ruby version.
- rbenv global 3.0.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