diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cce5df6c..b32ac81a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -39,6 +39,18 @@ jobs: --health-retries 5 ports: - 6379:6379 + strategy: + fail-fast: false + matrix: + ci_node_total: [4] + ci_node_index: [0, 1, 2, 3] + + env: + SELECTIVE_API_KEY: ${{ secrets.SELECTIVE_API_KEY }} + SELECTIVE_RUN_ID: ${{ github.run_id }} + SELECTIVE_RUN_ATTEMPT: ${{ github.run_attempt }} + SELECTIVE_RUNNER_ID: ${{ matrix.ci_node_index }} + PR_TITLE: ${{ github.event.pull_request.title }} steps: - uses: actions/checkout@v3 @@ -76,13 +88,17 @@ jobs: env: NODE_OPTIONS: --openssl-legacy-provider run: | - bundle exec rspec --profile 10 \ - --format progress \ + bundle exec selective rspec --format progress \ --format RspecJunitFormatter \ - --out junit/rspec.xml + --out junit/rspec-$SELECTIVE_RUNNER_ID.xml - ./cc-test-reporter format-coverage -t simplecov - ./cc-test-reporter upload-coverage + ./cc-test-reporter format-coverage -t simplecov -o $GITHUB_WORKSPACE/coverage/codeclimate.$SELECTIVE_RUNNER_ID.json + + - name: Upload coverage artifacts + uses: actions/upload-artifact@v3 + with: + name: coverage + path: coverage - name: Upload JUnit artifacts if: always() @@ -90,3 +106,24 @@ jobs: with: name: junit path: junit + + upload-coverage: + needs: test + runs-on: ubuntu-latest + steps: + - name: Download coverage artifacts + uses: actions/download-artifact@v3 + with: + name: coverage + path: coverage + + - name: Prepare CodeClimate Reporter + run: | + curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter + chmod +x ./cc-test-reporter + ./cc-test-reporter before-build + + - name: Upload coverage to CodeClimate + run: | + ./cc-test-reporter sum-coverage coverage/codeclimate.*.json + ./cc-test-reporter upload-coverage diff --git a/Gemfile b/Gemfile index 4cc9fb64..c2a80dc8 100644 --- a/Gemfile +++ b/Gemfile @@ -91,6 +91,7 @@ group :development, :test do gem 'vcr' gem 'spring' gem 'spring-watcher-listen' + gem 'selective-ruby-rspec' end group :development do diff --git a/Gemfile.lock b/Gemfile.lock index 2d7f0a0f..2e9db1f0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -224,7 +224,6 @@ GEM thread_safe (~> 0.3, >= 0.3.1) method_source (1.0.0) mini_mime (1.1.2) - mini_portile2 (2.8.1) minitest (5.15.0) msgpack (1.4.4) multipart-post (2.1.1) @@ -238,8 +237,7 @@ GEM mutant (= 0.11.4) rspec-core (>= 3.8.0, < 4.0.0) nio4r (2.5.8) - nokogiri (1.14.2) - mini_portile2 (~> 2.8.0) + nokogiri (1.14.2-x86_64-linux) racc (~> 1.4) orm_adapter (0.5.0) parallel (1.19.1) @@ -371,6 +369,11 @@ GEM sprockets (> 3.0) sprockets-rails tilt + selective-ruby-core (0.1.1-x86_64-linux) + zeitwerk (~> 2.6.12) + selective-ruby-rspec (0.1.0) + selective-ruby-core + zeitwerk (~> 2.6.12) selectize-rails (0.12.6) selenium-webdriver (4.8.1) rexml (~> 3.2, >= 3.2.5) @@ -447,10 +450,10 @@ GEM websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.5.4) + zeitwerk (2.6.12) PLATFORMS - ruby + x86_64-linux DEPENDENCIES activeadmin @@ -493,6 +496,7 @@ DEPENDENCIES rspec-rails (>= 4.0.0.beta3) rspec_junit_formatter sassc-rails + selective-ruby-rspec selectize-rails selenium-webdriver shoulda-matchers