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:
21
.github/workflows/test.yaml
vendored
21
.github/workflows/test.yaml
vendored
@@ -9,9 +9,15 @@ jobs:
|
|||||||
|
|
||||||
env:
|
env:
|
||||||
DEBIAN_FRONTEND: noninteractive
|
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
|
DATABASE_URL: postgresql://danbooru:danbooru@postgres/danbooru
|
||||||
ARCHIVE_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_SECRET_KEY_BASE: 1234
|
||||||
DANBOORU_AWS_SQS_ENABLED: false
|
DANBOORU_AWS_SQS_ENABLED: false
|
||||||
DANBOORU_TWITTER_API_KEY: ${{ secrets.DANBOORU_TWITTER_API_KEY }}
|
DANBOORU_TWITTER_API_KEY: ${{ secrets.DANBOORU_TWITTER_API_KEY }}
|
||||||
@@ -48,12 +54,23 @@ jobs:
|
|||||||
# - name: Run tests
|
# - name: Run tests
|
||||||
# run: docker-compose --env-file ~/.env -f config/docker/docker-compose.test.yaml -p danbooru up
|
# run: docker-compose --env-file ~/.env -f config/docker/docker-compose.test.yaml -p danbooru up
|
||||||
- name: Install OS dependencies
|
- 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
|
- name: Install Ruby dependencies
|
||||||
run: BUNDLE_DEPLOYMENT=true bundle install --jobs 4
|
run: BUNDLE_DEPLOYMENT=true bundle install --jobs 4
|
||||||
- name: Install Javascript dependencies
|
- name: Install Javascript dependencies
|
||||||
run: yarn install
|
run: yarn install
|
||||||
- name: Prepare database
|
- name: Prepare database
|
||||||
run: config/docker/prepare-tests.sh
|
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
|
- name: Run tests
|
||||||
run: bin/rails test
|
run: bin/rails test
|
||||||
|
- name: Upload test coverage to Code Climate
|
||||||
|
run: ./test-reporter-latest-linux-amd64 after-build
|
||||||
|
|||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -7,6 +7,7 @@ config/database.yml
|
|||||||
config/danbooru_local_config.rb
|
config/danbooru_local_config.rb
|
||||||
config/deploy/*.rb
|
config/deploy/*.rb
|
||||||
config/newrelic.yml
|
config/newrelic.yml
|
||||||
|
coverage/
|
||||||
node_modules/
|
node_modules/
|
||||||
log/
|
log/
|
||||||
tmp/
|
tmp/
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
SimpleCov.start "rails" do
|
SimpleCov.start "rails" do
|
||||||
add_group "Libraries", ["app/logical", "lib"]
|
add_group "Libraries", ["app/logical", "lib"]
|
||||||
add_group "Presenters", "app/presenters"
|
add_group "Presenters", "app/presenters"
|
||||||
enable_coverage :branch
|
#enable_coverage :branch
|
||||||
minimum_coverage line: 85, branch: 75
|
#minimum_coverage line: 85, branch: 75
|
||||||
minimum_coverage_by_file 50
|
#minimum_coverage_by_file 50
|
||||||
coverage_dir "tmp/coverage"
|
#coverage_dir "tmp/coverage"
|
||||||
end
|
end
|
||||||
|
|||||||
2
Gemfile
2
Gemfile
@@ -85,7 +85,7 @@ group :test do
|
|||||||
gem "factory_bot"
|
gem "factory_bot"
|
||||||
gem "mocha", require: "mocha/minitest"
|
gem "mocha", require: "mocha/minitest"
|
||||||
gem "ffaker"
|
gem "ffaker"
|
||||||
gem "simplecov", require: false
|
gem "simplecov", "~> 0.17.0", require: false
|
||||||
gem "webmock", require: "webmock/minitest"
|
gem "webmock", require: "webmock/minitest"
|
||||||
gem "minitest-ci"
|
gem "minitest-ci"
|
||||||
gem "minitest-reporters", require: "minitest/reporters"
|
gem "minitest-reporters", require: "minitest/reporters"
|
||||||
|
|||||||
@@ -363,10 +363,11 @@ GEM
|
|||||||
simple_form (5.0.2)
|
simple_form (5.0.2)
|
||||||
actionpack (>= 5.0)
|
actionpack (>= 5.0)
|
||||||
activemodel (>= 5.0)
|
activemodel (>= 5.0)
|
||||||
simplecov (0.18.5)
|
simplecov (0.17.1)
|
||||||
docile (~> 1.1)
|
docile (~> 1.1)
|
||||||
simplecov-html (~> 0.11)
|
json (>= 1.8, < 3)
|
||||||
simplecov-html (0.12.2)
|
simplecov-html (~> 0.10.0)
|
||||||
|
simplecov-html (0.10.2)
|
||||||
sinatra (2.0.8.1)
|
sinatra (2.0.8.1)
|
||||||
mustermann (~> 1.0)
|
mustermann (~> 1.0)
|
||||||
rack (~> 2.0)
|
rack (~> 2.0)
|
||||||
@@ -490,7 +491,7 @@ DEPENDENCIES
|
|||||||
shoulda-context
|
shoulda-context
|
||||||
shoulda-matchers
|
shoulda-matchers
|
||||||
simple_form
|
simple_form
|
||||||
simplecov
|
simplecov (~> 0.17.0)
|
||||||
sinatra
|
sinatra
|
||||||
stackprof
|
stackprof
|
||||||
streamio-ffmpeg
|
streamio-ffmpeg
|
||||||
|
|||||||
Reference in New Issue
Block a user