tests: upload test coverage reports to code climate.

Downgrade simplecov to 0.17 because 0.18 is incompatible with code
climate. Ref: github.com codeclimate/test-reporter/issues/413
This commit is contained in:
evazion
2020-06-11 15:17:32 -05:00
parent 8181ee6a1d
commit 025e09ff7f
5 changed files with 30 additions and 11 deletions

View File

@@ -9,9 +9,15 @@ jobs:
env:
DEBIAN_FRONTEND: noninteractive
PARALLEL_WORKERS: 8 # number of parallel tests to run
# Code Climate configuration. https://docs.codeclimate.com/docs/finding-your-test-coverage-token
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
GIT_COMMIT_SHA: ${{ github.sha }}
GIT_BRANCH: ${{ github.ref }}
DATABASE_URL: postgresql://danbooru:danbooru@postgres/danbooru
ARCHIVE_DATABASE_URL: postgresql://danbooru:danbooru@postgres/danbooru
PARALLEL_WORKERS: 8 # number of parallel tests to run
DANBOORU_SECRET_KEY_BASE: 1234
DANBOORU_AWS_SQS_ENABLED: false
DANBOORU_TWITTER_API_KEY: ${{ secrets.DANBOORU_TWITTER_API_KEY }}
@@ -48,12 +54,23 @@ jobs:
# - name: Run tests
# run: docker-compose --env-file ~/.env -f config/docker/docker-compose.test.yaml -p danbooru up
- name: Install OS dependencies
run: apt-get update && apt-get -y install build-essential ruby ruby-dev ruby-bundler git nodejs yarnpkg webpack ffmpeg mkvtoolnix libvips-dev libxml2-dev postgresql-server-dev-all && ln -sf /usr/bin/yarnpkg /usr/bin/yarn
run: |
apt-get update
apt-get -y install --no-install-recommends build-essential ruby ruby-dev ruby-bundler git nodejs yarnpkg webpack ffmpeg mkvtoolnix libvips-dev libxml2-dev postgresql-server-dev-all wget
ln -sf /usr/bin/yarnpkg /usr/bin/yarn
- name: Install Ruby dependencies
run: BUNDLE_DEPLOYMENT=true bundle install --jobs 4
- name: Install Javascript dependencies
run: yarn install
- name: Prepare database
run: config/docker/prepare-tests.sh
# https://docs.codeclimate.com/docs/configuring-test-coverage
- name: Prepare test coverage for Code Climate
run: |
wget https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64
chmod +x test-reporter-latest-linux-amd64
./test-reporter-latest-linux-amd64 before-build
- name: Run tests
run: bin/rails test
- name: Upload test coverage to Code Climate
run: ./test-reporter-latest-linux-amd64 after-build

1
.gitignore vendored
View File

@@ -7,6 +7,7 @@ config/database.yml
config/danbooru_local_config.rb
config/deploy/*.rb
config/newrelic.yml
coverage/
node_modules/
log/
tmp/

View File

@@ -1,8 +1,8 @@
SimpleCov.start "rails" do
add_group "Libraries", ["app/logical", "lib"]
add_group "Presenters", "app/presenters"
enable_coverage :branch
minimum_coverage line: 85, branch: 75
minimum_coverage_by_file 50
coverage_dir "tmp/coverage"
#enable_coverage :branch
#minimum_coverage line: 85, branch: 75
#minimum_coverage_by_file 50
#coverage_dir "tmp/coverage"
end

View File

@@ -85,7 +85,7 @@ group :test do
gem "factory_bot"
gem "mocha", require: "mocha/minitest"
gem "ffaker"
gem "simplecov", require: false
gem "simplecov", "~> 0.17.0", require: false
gem "webmock", require: "webmock/minitest"
gem "minitest-ci"
gem "minitest-reporters", require: "minitest/reporters"

View File

@@ -363,10 +363,11 @@ GEM
simple_form (5.0.2)
actionpack (>= 5.0)
activemodel (>= 5.0)
simplecov (0.18.5)
simplecov (0.17.1)
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov-html (0.12.2)
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.2)
sinatra (2.0.8.1)
mustermann (~> 1.0)
rack (~> 2.0)
@@ -490,7 +491,7 @@ DEPENDENCIES
shoulda-context
shoulda-matchers
simple_form
simplecov
simplecov (~> 0.17.0)
sinatra
stackprof
streamio-ffmpeg