ci: track coverage with codecov.io instead of codeclimate.com.
Comparison: * Codecov has a simpler integration and a better UI. * Codeclimate tracks both linter warnings (Rubocop, ESLint) and code coverage, but its UI for code coverage is worse than Codecov's. * Codeclimate doesn't support Simplecov 0.18 because Codeclimate doesn't support 0.18's new coverage format yet.
This commit is contained in:
1
.codecov.yml
Normal file
1
.codecov.yml
Normal file
@@ -0,0 +1 @@
|
|||||||
|
comment: false
|
||||||
25
.github/workflows/test.yaml
vendored
25
.github/workflows/test.yaml
vendored
@@ -34,10 +34,7 @@ jobs:
|
|||||||
RUBYOPT: -W0 # silence ruby warnings
|
RUBYOPT: -W0 # silence ruby warnings
|
||||||
VIPS_WARNING: 0 # silence libvips warnings
|
VIPS_WARNING: 0 # silence libvips warnings
|
||||||
|
|
||||||
# Code Climate configuration. https://docs.codeclimate.com/docs/finding-your-test-coverage-token
|
CODECOV_TOKEN: ${{ secrets.CODECOV_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
|
||||||
@@ -74,7 +71,7 @@ jobs:
|
|||||||
- name: Install OS dependencies
|
- name: Install OS dependencies
|
||||||
run: |
|
run: |
|
||||||
apt-get update
|
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 libxslt-dev zlib1g-dev postgresql-server-dev-all wget
|
apt-get -y install --no-install-recommends build-essential ruby ruby-dev ruby-bundler git nodejs yarnpkg webpack ffmpeg mkvtoolnix libvips-dev libxml2-dev libxslt-dev zlib1g-dev postgresql-server-dev-all wget curl
|
||||||
ln -sf /usr/bin/yarnpkg /usr/bin/yarn
|
ln -sf /usr/bin/yarnpkg /usr/bin/yarn
|
||||||
|
|
||||||
- name: Install Ruby dependencies
|
- name: Install Ruby dependencies
|
||||||
@@ -86,23 +83,5 @@ jobs:
|
|||||||
- 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
|
|
||||||
if: ${{ !cancelled() }}
|
|
||||||
run: GIT_COMMITTED_AT="$(date -u +%s)" ./test-reporter-latest-linux-amd64 after-build --debug
|
|
||||||
|
|
||||||
# https://docs.codecov.io/docs
|
|
||||||
- name: Upload test coverage to Codecov.io
|
|
||||||
if: ${{ !cancelled() }}
|
|
||||||
uses: codecov/codecov-action@v1
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
|
||||||
|
|||||||
@@ -5,4 +5,10 @@ SimpleCov.start "rails" do
|
|||||||
#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"
|
||||||
|
|
||||||
|
# https://github.com/codecov/codecov-ruby#submit-only-in-ci-example
|
||||||
|
if ENV["CODECOV_TOKEN"]
|
||||||
|
require "codecov"
|
||||||
|
SimpleCov.formatter = SimpleCov::Formatter::Codecov
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
1
Gemfile
1
Gemfile
@@ -86,4 +86,5 @@ group :test do
|
|||||||
gem "mock_redis"
|
gem "mock_redis"
|
||||||
gem "capybara"
|
gem "capybara"
|
||||||
gem "selenium-webdriver"
|
gem "selenium-webdriver"
|
||||||
|
gem "codecov", require: false
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -120,6 +120,10 @@ GEM
|
|||||||
xpath (~> 3.2)
|
xpath (~> 3.2)
|
||||||
childprocess (3.0.0)
|
childprocess (3.0.0)
|
||||||
chronic (0.10.2)
|
chronic (0.10.2)
|
||||||
|
codecov (0.1.17)
|
||||||
|
json
|
||||||
|
simplecov
|
||||||
|
url
|
||||||
coderay (1.1.3)
|
coderay (1.1.3)
|
||||||
concurrent-ruby (1.1.6)
|
concurrent-ruby (1.1.6)
|
||||||
crass (1.0.6)
|
crass (1.0.6)
|
||||||
@@ -367,6 +371,7 @@ GEM
|
|||||||
unicorn-worker-killer (0.4.4)
|
unicorn-worker-killer (0.4.4)
|
||||||
get_process_mem (~> 0)
|
get_process_mem (~> 0)
|
||||||
unicorn (>= 4, < 6)
|
unicorn (>= 4, < 6)
|
||||||
|
url (0.3.2)
|
||||||
webpacker (5.1.1)
|
webpacker (5.1.1)
|
||||||
activesupport (>= 5.2)
|
activesupport (>= 5.2)
|
||||||
rack-proxy (>= 0.6.1)
|
rack-proxy (>= 0.6.1)
|
||||||
@@ -399,6 +404,7 @@ DEPENDENCIES
|
|||||||
capistrano-rbenv
|
capistrano-rbenv
|
||||||
capistrano3-unicorn
|
capistrano3-unicorn
|
||||||
capybara
|
capybara
|
||||||
|
codecov
|
||||||
daemons
|
daemons
|
||||||
delayed_job
|
delayed_job
|
||||||
delayed_job_active_record
|
delayed_job_active_record
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[](https://codeclimate.com/github/danbooru/danbooru/test_coverage) [](https://discord.gg/eSVKkUF)
|
[](https://codecov.io/gh/danbooru/danbooru) [](https://discord.gg/eSVKkUF)
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user