diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4b1575d..5e8ecf3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,6 +11,11 @@ jobs: test: name: Test failing spec detector runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + ci_node_total: [3] + ci_node_index: [0, 1, 2] steps: - uses: actions/checkout@v3 @@ -22,17 +27,21 @@ jobs: - name: Lint files run: bundle exec rake rubocop - name: Run tests + env: + RAILS_ENV: test + CI_NODE_TOTAL: ${{ matrix.ci_node_total }} + CI_NODE_INDEX: ${{ matrix.ci_node_index }} run: bundle exec rake spec - name: Upload Failures uses: actions/upload-artifact@v3 with: name: Failures - path: failures_log_*.yml + path: spec/failing_spec_detector/failures - name: Upload Exceptions uses: actions/upload-artifact@v3 with: name: Exceptions - path: exceptions_log_*.yml + path: spec/failing_spec_detector/exceptions print_log: name: Test print logs task @@ -50,10 +59,12 @@ jobs: uses: actions/download-artifact@v3 with: name: Failures + path: spec/failing_spec_detector/failures - name: Download Exceptions uses: actions/download-artifact@v3 with: name: Exceptions + path: spec/failing_spec_detector/exceptions - name: Run print_log task run: bundle exec rake failing_specs_detector:print_log diff --git a/.gitignore b/.gitignore index 7af1d38..8e333c5 100644 --- a/.gitignore +++ b/.gitignore @@ -11,5 +11,5 @@ .rspec_status # log files -exceptions_log_*.yml -failures_log_*.yml +exceptions/ +failures/ diff --git a/lib/failing_spec_detector/failing_spec_formatter.rb b/lib/failing_spec_detector/failing_spec_formatter.rb index 7a1c405..590d67c 100644 --- a/lib/failing_spec_detector/failing_spec_formatter.rb +++ b/lib/failing_spec_detector/failing_spec_formatter.rb @@ -12,8 +12,9 @@ def initialize(output) super(output) @failures = [] @exceptions = [] - @failures_filename = "failures_log_#{ENV.fetch('TEST_ENV_NUMBER', nil)}.yml" - @exceptions_filename = "exceptions_log_#{ENV.fetch('TEST_ENV_NUMBER', nil)}.yml" + @failures_filename = "spec/failing_spec_detector/failures/failures_log_#{ENV.fetch('TEST_ENV_NUMBER', nil)}.yml" + @exceptions_filename = "spec/failing_spec_detector/exceptions/exceptions_log_#{ENV.fetch('TEST_ENV_NUMBER', + nil)}.yml" end def example_failed(failure) diff --git a/lib/tasks/failing_spec_detector/print_log.rake b/lib/tasks/failing_spec_detector/print_log.rake index a7cd8b3..fe53c72 100644 --- a/lib/tasks/failing_spec_detector/print_log.rake +++ b/lib/tasks/failing_spec_detector/print_log.rake @@ -9,8 +9,8 @@ namespace :failing_specs_detector do task :print_log do failures = [] exceptions = [] - failures_file_paths = Dir['failures_log_*.yml'] - exceptions_file_paths = Dir['exceptions_log_*.yml'] + failures_file_paths = Dir['spec/failing_spec_detector/failures/failures_log_*.yml'] + exceptions_file_paths = Dir['spec/failing_spec_detector/exceptions/exceptions_log_*.yml'] failures_file_paths.each do |file_path| failures.concat(YAML.load_file(file_path, permitted_classes: [FailingSpecDetector::Failure])) File.delete(file_path) diff --git a/spec/failing_spec_detector/failing_spec_formatter_spec.rb b/spec/failing_spec_detector/failing_spec_formatter_spec.rb index 566bae8..b7d8ad9 100644 --- a/spec/failing_spec_detector/failing_spec_formatter_spec.rb +++ b/spec/failing_spec_detector/failing_spec_formatter_spec.rb @@ -7,8 +7,8 @@ let(:output) { Tempfile.new('./output_to_close') } let(:expected_failures_file_path) { './spec/support/expected_failures_log_.yml' } let(:expected_exceptions_file_path) { './spec/support/expected_exceptions_log_.yml' } - let(:actual_failures_file_path) { './failures_log_.yml' } - let(:actual_exceptions_file_path) { './exceptions_log_.yml' } + let(:actual_failures_file_path) { './spec/failing_spec_detector/failures/failures_log_.yml' } + let(:actual_exceptions_file_path) { './spec/failing_spec_detector/exceptions/exceptions_log_.yml' } let(:expected_failures_file) { File.new(expected_failures_file_path, 'r') } let(:expected_exceptions_file) { File.new(expected_exceptions_file_path, 'r') } let(:actual_failures_file) { File.new(actual_failures_file_path, 'r') }