diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 9ec50c7b..329032cf 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -26,7 +26,12 @@ jobs: run_modified_files_in_default_docker: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - name: Checkout HEAD + uses: actions/checkout@v4 + with: + fetch-depth: 0 # Fetch the full history to access other branches + - name: Fetch master branch + run: git fetch origin master # Fetch the master branch - name: Running test inside doc-builder-testing run: | docker build -t doc-builder-testing . diff --git a/Rakefile b/Rakefile index c2fb64ba..68d5b771 100644 --- a/Rakefile +++ b/Rakefile @@ -36,8 +36,9 @@ task :in_modified_specs do run_default = false # get changes in framework - lib_diff = `git diff --name-only origin/master -- lib dockerfiles Dockerfile Gemfile Gemfile.lock` - run_default = true unless lib_diff.empty? + lib_diff = `git diff --name-only origin/master -- lib dockerfiles Dockerfile Gemfile Gemfile.lock 2>&1` + # check of comparison results/errors + run_default = true if !lib_diff.empty? || lib_diff.include?('fatal:') # get changes in scripts and find them in spec scripts_diff = `git diff --name-only origin/master -- js python | xargs -I {} grep -Rl {} spec` @@ -45,11 +46,13 @@ task :in_modified_specs do spec_diff = `git diff --name-only origin/master -- spec ':!spec/spec_helper.rb' ':!spec/test_data.rb'` files = spec_diff.split | scripts_diff.split - if files.all? { |element| element =~ %r{^spec/.*\.rb} } - files.empty? ? print('NO TESTS TO RUN.') : sh("bundle exec parallel_rspec #{files.join(' ')}") - else - print("An incorrect file type for rspec has been detected: #{files}") - run_default = true + unless run_default + if files.all? { |element| element =~ %r{^spec/.*\.rb} } + files.empty? ? print('NO TESTS TO RUN.') : sh("bundle exec parallel_rspec #{files.join(' ')}") + else + print("An incorrect file type for rspec has been detected: #{files}") + run_default = true + end end Rake::Task['default'].invoke if run_default