Merge pull request #5039 from consul/fix_coveralls_build_number

Use Coveralls Github Action to send test reports
This commit is contained in:
Javi Martín
2022-11-29 18:37:05 +01:00
committed by GitHub
5 changed files with 33 additions and 30 deletions

View File

@@ -23,10 +23,7 @@ jobs:
POSTGRES_USER: consul POSTGRES_USER: consul
POSTGRES_PASSWORD: "" POSTGRES_PASSWORD: ""
env: env:
CI_BUILD_NUMBER: ${{ github.run_number }} TEST_COVERAGE: 1
COVERALLS_FLAG_NAME: run-${{ matrix.ci_node_index }}
COVERALLS_PARALLEL: true
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
PGUSER: consul PGUSER: consul
POSTGRES_HOST: postgres POSTGRES_HOST: postgres
RAILS_ENV: test RAILS_ENV: test
@@ -56,6 +53,12 @@ jobs:
KNAPSACK_PRO_FIXED_QUEUE_SPLIT: true KNAPSACK_PRO_FIXED_QUEUE_SPLIT: true
KNAPSACK_PRO_LOG_LEVEL: info KNAPSACK_PRO_LOG_LEVEL: info
run: bin/knapsack_pro_rspec run: bin/knapsack_pro_rspec
- name: Coveralls Parallel
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
flag-name: run-${{ matrix.ci_node_index }}
parallel: true
- name: Upload screenshots - name: Upload screenshots
if: failure() if: failure()
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
@@ -67,9 +70,9 @@ jobs:
contents: none contents: none
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: tests needs: tests
env:
CI_BUILD_NUMBER: ${{ github.run_number }}
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
steps: steps:
- name: Finish coveralls - name: Finish coveralls
run: curl -k https://coveralls.io/webhook?repo_token=$COVERALLS_REPO_TOKEN -d "payload[build_num]=$CI_BUILD_NUMBER&payload[status]=done" uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true

View File

@@ -14,7 +14,7 @@ tests:
variables: variables:
POSTGRES_USER: consul POSTGRES_USER: consul
RAILS_ENV: test RAILS_ENV: test
COVERALLS: 1 TEST_COVERAGE: 1
parallel: 5 parallel: 5
script: script:
- apt-get update && apt-get install -y nodejs chromium - apt-get update && apt-get install -y nodejs chromium

View File

@@ -86,10 +86,11 @@ end
group :test do group :test do
gem "capybara", "~> 3.37.1" gem "capybara", "~> 3.37.1"
gem "capybara-webmock", "~> 0.6.0" gem "capybara-webmock", "~> 0.6.0"
gem "coveralls", "~> 0.8.23", require: false
gem "email_spec", "~> 2.2.0" gem "email_spec", "~> 2.2.0"
gem "rspec-rails", "~> 5.1.2" gem "rspec-rails", "~> 5.1.2"
gem "selenium-webdriver", "~> 3.142" gem "selenium-webdriver", "~> 3.142"
gem "simplecov", "~> 0.21.2", require: false
gem "simplecov-lcov", "~> 0.8.0", require: false
gem "webdrivers", "~> 4.7.0" gem "webdrivers", "~> 4.7.0"
end end

View File

@@ -159,12 +159,6 @@ GEM
execjs execjs
coffee-script-source (1.12.2) coffee-script-source (1.12.2)
concurrent-ruby (1.1.10) concurrent-ruby (1.1.10)
coveralls (0.8.23)
json (>= 1.8, < 3)
simplecov (~> 0.16.1)
term-ansicolor (~> 1.3)
thor (>= 0.19.4, < 2.0)
tins (~> 1.6)
crass (1.0.6) crass (1.0.6)
daemons (1.4.1) daemons (1.4.1)
dalli (3.2.3) dalli (3.2.3)
@@ -183,7 +177,7 @@ GEM
devise-security (0.16.0) devise-security (0.16.0)
devise (>= 4.3.0, < 5.0) devise (>= 4.3.0, < 5.0)
diff-lcs (1.5.0) diff-lcs (1.5.0)
docile (1.3.2) docile (1.4.0)
dry-configurable (0.7.0) dry-configurable (0.7.0)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
dry-container (0.6.0) dry-container (0.6.0)
@@ -619,11 +613,13 @@ GEM
selenium-webdriver (3.142.7) selenium-webdriver (3.142.7)
childprocess (>= 0.5, < 4.0) childprocess (>= 0.5, < 4.0)
rubyzip (>= 1.2.2) rubyzip (>= 1.2.2)
simplecov (0.16.1) simplecov (0.21.2)
docile (~> 1.1) docile (~> 1.1)
json (>= 1.8, < 3) simplecov-html (~> 0.11)
simplecov-html (~> 0.10.0) simplecov_json_formatter (~> 0.1)
simplecov-html (0.10.2) simplecov-html (0.12.3)
simplecov-lcov (0.8.0)
simplecov_json_formatter (0.1.4)
sitemap_generator (6.3.0) sitemap_generator (6.3.0)
builder (~> 3.0) builder (~> 3.0)
smart_properties (1.17.0) smart_properties (1.17.0)
@@ -647,9 +643,6 @@ GEM
sshkit (1.21.2) sshkit (1.21.2)
net-scp (>= 1.1.2) net-scp (>= 1.1.2)
net-ssh (>= 2.8.0) net-ssh (>= 2.8.0)
sync (0.5.0)
term-ansicolor (1.7.1)
tins (~> 1.0)
terminal-table (3.0.2) terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3) unicode-display_width (>= 1.1.1, < 3)
terrapin (0.6.0) terrapin (0.6.0)
@@ -657,8 +650,6 @@ GEM
thor (1.2.1) thor (1.2.1)
thread_safe (0.3.6) thread_safe (0.3.6)
tilt (2.0.10) tilt (2.0.10)
tins (1.25.0)
sync
tomlrb (1.3.0) tomlrb (1.3.0)
translator-text (0.1.0) translator-text (0.1.0)
dry-struct (~> 0.5.0) dry-struct (~> 0.5.0)
@@ -735,7 +726,6 @@ DEPENDENCIES
caxlsx_rails (~> 0.6.3) caxlsx_rails (~> 0.6.3)
ckeditor (~> 4.3.0) ckeditor (~> 4.3.0)
cocoon (~> 1.2.15) cocoon (~> 1.2.15)
coveralls (~> 0.8.23)
daemons (~> 1.4.1) daemons (~> 1.4.1)
dalli (~> 3.2.3) dalli (~> 3.2.3)
delayed_job_active_record (~> 4.1.7) delayed_job_active_record (~> 4.1.7)
@@ -800,6 +790,8 @@ DEPENDENCIES
savon (~> 2.13.0) savon (~> 2.13.0)
scss_lint (~> 0.59.0) scss_lint (~> 0.59.0)
selenium-webdriver (~> 3.142) selenium-webdriver (~> 3.142)
simplecov (~> 0.21.2)
simplecov-lcov (~> 0.8.0)
sitemap_generator (~> 6.3.0) sitemap_generator (~> 6.3.0)
social-share-button (~> 1.2.4) social-share-button (~> 1.2.4)
spring (~> 2.1.1) spring (~> 2.1.1)

View File

@@ -1,7 +1,14 @@
ENV["RAILS_ENV"] ||= "test" ENV["RAILS_ENV"] ||= "test"
if ENV["COVERALLS_REPO_TOKEN"] if ENV["TEST_COVERAGE"]
require "coveralls" require "simplecov"
Coveralls.wear!("rails") require "simplecov-lcov"
SimpleCov::Formatter::LcovFormatter.config.report_with_single_file = true
SimpleCov::Formatter::LcovFormatter.config do |config|
config.output_directory = "coverage"
config.lcov_file_name = "lcov.info"
end
SimpleCov.formatter = SimpleCov::Formatter::LcovFormatter
SimpleCov.start("rails")
end end
require File.expand_path("../../config/environment", __FILE__) require File.expand_path("../../config/environment", __FILE__)
abort("The Rails environment is running in production mode!") if Rails.env.production? abort("The Rails environment is running in production mode!") if Rails.env.production?