From 6cff8b17e2b0ed091848abd2e02bcb6eacb7a7d0 Mon Sep 17 00:00:00 2001 From: Ivan Kuchin Date: Fri, 12 Jul 2024 19:02:26 +0200 Subject: [PATCH] test --- .github/workflows/ci.yml | 14 ++++++++++++++ a.rb | 1 + test/only_checked/files/a.rb | 1 + test/only_checked/mock_bins/rubocop | 9 +++++++++ 4 files changed, 25 insertions(+) create mode 100644 a.rb create mode 100644 test/only_checked/files/a.rb create mode 100755 test/only_checked/mock_bins/rubocop diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 83a5fd2..f327f7c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,3 +21,17 @@ jobs: skip_install: 'true' use_bundler: 'true' - run: test "$(bundle exec rubocop --version)" == "1.18.1" + test-only-changed: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: | + cp test/only_checked/files/* . + git add * + git commit -m auto + - name: rubocop with only_checked + uses: ./ + with: + only_checked: 'true' + env: + PATH: test/only_checked/mock_bins:${{ env.PATH }} diff --git a/a.rb b/a.rb new file mode 100644 index 0000000..5460224 --- /dev/null +++ b/a.rb @@ -0,0 +1 @@ +puts "Hello, " + "world!" diff --git a/test/only_checked/files/a.rb b/test/only_checked/files/a.rb new file mode 100644 index 0000000..5460224 --- /dev/null +++ b/test/only_checked/files/a.rb @@ -0,0 +1 @@ +puts "Hello, " + "world!" diff --git a/test/only_checked/mock_bins/rubocop b/test/only_checked/mock_bins/rubocop new file mode 100755 index 0000000..ddfda21 --- /dev/null +++ b/test/only_checked/mock_bins/rubocop @@ -0,0 +1,9 @@ +#!/usr/bin/env ruby + +case ARGV +when %w[--list-target-files] + puts %w[a.rb b.rb c.rb] + +else + abort "rubocop mock called with unexpected arguments:\n#{ARGV.join("\n")}" +end