...
 
Commits (4)
  • georg's avatar
    CI: export env var to check code coverage · 548edd10
    georg authored
    548edd10
  • georg's avatar
    CI: Deploy code coverage overview as HTML to make it actually usable · 2f779414
    georg authored
    Code coverage was added to the CI some time ago. Up until now, a part of
    the result was printed at the end of the rspec test jobs, accessible via
    the individual job logs, barely usable.
    
    This commit introduces deploying the HTML result and making it
    accessible via a dedicated page, allowing to search within and filter
    the data, in a much more convenient and appealing way.
    
    While I'm not hunting for 100 percent code coverage, I think having at
    least a better insight into this topic is quite valuable. I hope this
    leads to a better understanding of our test suite, possibly identifying
    weak points (which then can be improved) and in the end to a better code
    base.
    2f779414
  • georg's avatar
    CI: codespell: ignore code coverage dir leading to false positives · c60e18ec
    georg authored
    Due to the introduced artifacts to store the code coverage report, and
    to "hand it over" from one stage to the next, these artifacts are now
    downloaded as well before the codespell job. This lead to false
    positives, spelling errors within this directory, we're not really
    interested in. Therefore, ignore this directory if running codespell.
    c60e18ec
  • paz's avatar
    Merge branch 'ci-make-code-coverage-usable' into 'release-4.0' · c6a75553
    paz authored
    CI: make code coverage actually usable
    
    See merge request !287
    c6a75553
......@@ -30,7 +30,7 @@ variables:
script:
- eatmydata bundle install --jobs $(nproc)
- SCHLEUDER_ENV=test SCHLEUDER_CONFIG=spec/schleuder.yml eatmydata bundle exec rake db:init
- eatmydata bundle exec rspec
- CHECK_CODE_COVERAGE=true eatmydata bundle exec rspec
ruby:2.3:
image: $IMAGE_REGISTRY:schleuder-ruby2.3
......@@ -44,6 +44,10 @@ ruby:2.5:
ruby:2.6:
image: $IMAGE_REGISTRY:schleuder-ruby2.6
<<: *test_ruby
artifacts:
expire_in: 1 day
paths:
- coverage
changelog:
image: $IMAGE_REGISTRY:debian-generic
......@@ -64,13 +68,44 @@ changelog:
codespell:
image: $IMAGE_REGISTRY:debian-generic
script:
# Run codespell to check for spelling errors, using a config with ignored words, skipping files
# (German translations) leading to false positives, ignoring warnings about
# binary files and, finally, checking file names as well.
- codespell -I utils/ci/codespell/ignored_words.txt -S de.yml -q 2 -f
# Run codespell to check for spelling errors, using a config with ignored
# words, skipping files (German translations) and the code coverage dir
# leading to false positives, ignoring warnings about binary files and,
# finally, checking file names as well.
- codespell -I utils/ci/codespell/ignored_words.txt -S ./coverage,de.yml -q 2 -f
stage: static
<<: *limit_non_release_branches
code-coverage:
image: $IMAGE_REGISTRY:debian-generic
script:
- unset HISTFILE
- eval $(ssh-agent -s)
- echo "$DEPLOY_KEY" | tr -d '\r' | ssh-add - > /dev/null
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- printf "
|1|ZfxGVbfwfCHlaURlet/V6y+2gjg=|/X7OweXQUnXZnGSKkvF/IpVz4n4= ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPJx38PfGvaHtkSsHptiHoIQxlI3Yf0cskPNTwAQnY14\n
|1|8YPsezXF2SYQ7rq9U5TbDnMsVjo=|SJOodZB+8j+dO+l6YTdZ7+44XLw= ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPJx38PfGvaHtkSsHptiHoIQxlI3Yf0cskPNTwAQnY14
" > ~/.ssh/known_hosts
# Unfortunately, variable expansion doesn't work completely in
# GitLab. Therefore, a bit code duplication in the following code.
- DEPLOY_SLUG=www/$DEPLOY_BASE/$CI_PROJECT_NAME/$CI_COMMIT_REF_SLUG
- export DEPLOY_SLUG
- lftp -e "mkdir -fp $DEPLOY_SLUG; quit" -u $DEPLOY_USER,dummy sftp://$DEPLOY_HOST || /bin/true
- lftp -e "mirror -eRv -x ^download/ coverage $DEPLOY_SLUG; quit;" -u $DEPLOY_USER,dummy sftp://$DEPLOY_HOST
environment:
name: $DEPLOY_BASE/$CI_PROJECT_NAME/$CI_COMMIT_REF_SLUG
url: https://schleuder.org/$DEPLOY_BASE/$CI_PROJECT_NAME/$CI_COMMIT_REF_SLUG
only:
- branches@schleuder/schleuder
variables:
DEPLOY_BASE: dev/code-coverage
GIT_STRATEGY: none
allow_failure: true
stage: static
<<: *limit_non_release_branches
rubocop:
image: $IMAGE_REGISTRY:debian-generic
script:
......
......@@ -44,7 +44,8 @@ Gem::Specification.new do |s|
s.add_development_dependency 'hirb', '~> 0'
s.add_development_dependency 'factory_bot', '~> 5.0'
s.add_development_dependency 'database_cleaner', '~> 1'
s.add_development_dependency 'simplecov-console', '~> 0'
s.add_development_dependency 'simplecov', '~> 0'
s.add_development_dependency 'simplecov-html', '~> 0'
s.add_development_dependency 'rack-test', '~> 1'
s.add_development_dependency 'rubocop', '~> 0'
s.add_development_dependency 'byebug', '~> 10'
......
......@@ -9,9 +9,8 @@ end
# Check env if we want to run code coverage analysis
if ENV['CHECK_CODE_COVERAGE'] == 'true'
require 'simplecov'
require 'simplecov-console'
SimpleCov::Formatter::Console.table_options = {max_width: 400}
SimpleCov.formatter = SimpleCov::Formatter::Console
require 'simplecov-html'
SimpleCov.formatter = SimpleCov::Formatter::HTMLFormatter
SimpleCov.start do
add_filter %r{^/vendor/}
add_filter %r{^/spec/}
......