From c4236411026b4c8440bacc9a426a2eff4f5cf0d0 Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Thu, 27 Oct 2022 11:22:20 +0100 Subject: [PATCH 01/24] Adds knapsack_pro to the stack; updates configs --- Gemfile | 4 ++++ Gemfile.lock | 3 +++ spec/base_spec_helper.rb | 8 +++++++- spec/spec_helper.rb | 6 ++++++ spec/support/vcr_setup.rb | 1 + 5 files changed, 21 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 7ca4980c28..1c1beb19a3 100644 --- a/Gemfile +++ b/Gemfile @@ -153,6 +153,7 @@ group :test, :development do gem 'fuubar', '~> 2.5.1' gem 'json_spec', '~> 1.1.4' gem 'knapsack', require: false + gem 'knapsack_pro', require: false gem 'letter_opener', '>= 1.4.1' gem 'rspec-rails', ">= 3.5.2" gem 'rspec-retry', require: false @@ -168,6 +169,9 @@ group :test do gem 'simplecov', require: false gem 'test-prof', require: false gem 'vcr', require: false + gem 'test-prof' + gem 'vcr' +>>>>>>> 7f0d4cc24 (Adds knapsack_pro to the stack; updates configs) gem 'webmock', require: false # See spec/spec_helper.rb for instructions # gem 'perftools.rb' diff --git a/Gemfile.lock b/Gemfile.lock index f2b901ea93..3515da5d56 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -377,6 +377,8 @@ GEM jwt (2.5.0) knapsack (4.0.0) rake + knapsack_pro (3.4.1) + rake launchy (2.5.0) addressable (~> 2.7) letter_opener (1.8.1) @@ -819,6 +821,7 @@ DEPENDENCIES jsonapi-serializer jwt (~> 2.3) knapsack + knapsack_pro letter_opener (>= 1.4.1) listen mime-types diff --git a/spec/base_spec_helper.rb b/spec/base_spec_helper.rb index 008445dd72..4b2d1ebcaf 100644 --- a/spec/base_spec_helper.rb +++ b/spec/base_spec_helper.rb @@ -24,12 +24,18 @@ Shoulda::Matchers.configure do |config| end end +# Configures knapsack_pro if not set otherwise on .github/workflows/build.yml +unless ENV['DISABLE_KNAPSACK_PRO'] + require 'knapsack_pro' + KnapsackPro::Adapters::RSpecAdapter.bind +end + # Allow connections to selenium whilst raising errors when connecting to external sites require 'webmock/rspec' WebMock.enable! WebMock.disable_net_connect!( allow_localhost: true, - allow: 'chromedriver.storage.googleapis.com' + allow: ['chromedriver.storage.googleapis.com', 'api.knapsackpro.com'] ) # Requires supporting ruby files with custom matchers and macros, etc, diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index c9bee1d80e..5a49444670 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -13,6 +13,12 @@ unless ENV['DISABLE_KNAPSACK'] Knapsack::Adapters::RSpecAdapter.bind end +# Configures knapsack_pro if not set otherwise on .github/workflows/build.yml +unless ENV['DISABLE_KNAPSACK_PRO'] + require 'knapsack_pro' + KnapsackPro::Adapters::RSpecAdapter.bind +end + Capybara.javascript_driver = :chrome Capybara.default_max_wait_time = 30 Capybara.disable_animation = true diff --git a/spec/support/vcr_setup.rb b/spec/support/vcr_setup.rb index c4af4c19b5..261563fff7 100644 --- a/spec/support/vcr_setup.rb +++ b/spec/support/vcr_setup.rb @@ -9,4 +9,5 @@ VCR.configure do |config| config.configure_rspec_metadata! config.filter_sensitive_data('') { ENV['STRIPE_SECRET_TEST_API_KEY'] } config.filter_sensitive_data('') { ENV['STRIPE_CUSTOMER'] } + config.ignore_hosts('localhost', '127.0.0.1', '0.0.0.0', 'api.knapsackpro.com') end From 2a8ef5a45e57520397e3b4b5b0ce0c4a907e74d4 Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Thu, 27 Oct 2022 11:41:39 +0100 Subject: [PATCH 02/24] Updates build.yml to run the build the first time with knapsack_pro --- .github/workflows/build.yml | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b0555c40d1..ea699b4fbc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,6 +9,7 @@ on: env: DISABLE_KNAPSACK: true + DISABLE_KNAPSACK_PRO: false TIMEZONE: UTC COVERAGE: true RAILS_ENV: test @@ -33,19 +34,15 @@ jobs: POSTGRES_USER: ofn POSTGRES_PASSWORD: f00d strategy: - matrix: - specs: - - "spec/controllers" - - "spec/models" - - "spec/lib" - - "spec/migrations" - - "spec/serializers" - - "spec/system/admin/[a-o0-9]*" - - "spec/system/admin/[p-z]*" - - "spec/system/consumer/[a-o0-9]*" - - "spec/system/consumer/[p-z]*" - - "engines/*/spec" fail-fast: false + matrix: + # [n] - where the n is a number of parallel jobs you want to run your tests on. + # Use a higher number if you have slow tests to split them between more parallel jobs. + # Remember to update the value of the `ci_node_index` below to (0..n-1). + ci_node_total: [10] + # Indexes for parallel jobs (starting from zero). + # E.g. use [0, 1] for 2 parallel jobs, [0, 1, 2] for 3 parallel jobs, etc. + ci_node_index: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] steps: - uses: actions/checkout@v3 @@ -72,7 +69,20 @@ jobs: bundle exec rake db:schema:load - name: Run tests - run: bundle exec rspec --profile -- ${{ matrix.specs }} + env: + KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC: ${{ secrets.KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC }} + KNAPSACK_PRO_CI_NODE_TOTAL: ${{ matrix.ci_node_total }} + KNAPSACK_PRO_CI_NODE_INDEX: ${{ matrix.ci_node_index }} + KNAPSACK_PRO_LOG_LEVEL: info + # if you use Knapsack Pro Queue Mode you must set below env variable + # to be able to retry CI build and run previously recorded tests + # https://github.com/KnapsackPro/knapsack_pro-ruby#knapsack_pro_fixed_queue_split-remember-queue-split-on-retry-ci-node + KNAPSACK_PRO_FIXED_QUEUE_SPLIT: true + # RSpec split test files by test examples feature - it's optional + # https://knapsackpro.com/faq/question/how-to-split-slow-rspec-test-files-by-test-examples-by-individual-it + # KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES: true + run: | + bundle exec rake knapsack_pro:rspec - name: Archive failed tests screenshots if: failure() From d6aa0168b254cf095718331d06b36c1303c1d10c Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Sat, 29 Oct 2022 19:08:54 +0100 Subject: [PATCH 03/24] Creates fork disabling on forks Changes run job to use bash file --- .github/workflows/build.yml | 2 +- bin/knapsack_pro_rspec | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100755 bin/knapsack_pro_rspec diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ea699b4fbc..0899f9d182 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -82,7 +82,7 @@ jobs: # https://knapsackpro.com/faq/question/how-to-split-slow-rspec-test-files-by-test-examples-by-individual-it # KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES: true run: | - bundle exec rake knapsack_pro:rspec + bin/knapsack_pro_rspec - name: Archive failed tests screenshots if: failure() diff --git a/bin/knapsack_pro_rspec b/bin/knapsack_pro_rspec new file mode 100755 index 0000000000..65e8608d91 --- /dev/null +++ b/bin/knapsack_pro_rspec @@ -0,0 +1,13 @@ +#!/bin/bash +if [ "$KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC" = "" ]; then + KNAPSACK_PRO_ENDPOINT=https://api-disabled-for-fork.knapsackpro.com \ + KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC=disabled-for-fork \ + KNAPSACK_PRO_MAX_REQUEST_RETRIES=0 \ + bundle exec rake knapsack_pro:rspec # use Regular Mode here always +else + # Regular Mode + bundle exec rake knapsack_pro:rspec + + # or you can use Queue Mode instead of Regular Mode if you like + # bundle exec rake knapsack_pro:queue:rspec +fi \ No newline at end of file From ccfb83d2cd0a78f4bbd2cb2e9423948246eaa950 Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Sat, 29 Oct 2022 19:28:57 +0100 Subject: [PATCH 04/24] Splits build into 50 jobs --- .github/workflows/build.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0899f9d182..790b039a75 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -39,10 +39,12 @@ jobs: # [n] - where the n is a number of parallel jobs you want to run your tests on. # Use a higher number if you have slow tests to split them between more parallel jobs. # Remember to update the value of the `ci_node_index` below to (0..n-1). - ci_node_total: [10] + ci_node_total: [50] # Indexes for parallel jobs (starting from zero). # E.g. use [0, 1] for 2 parallel jobs, [0, 1, 2] for 3 parallel jobs, etc. - ci_node_index: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + ci_node_index: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, + 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49] steps: - uses: actions/checkout@v3 From 61cb7c44021f41895bae6571ac6467d94aceeb58 Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Mon, 31 Oct 2022 23:06:50 +0000 Subject: [PATCH 05/24] Removes knapsack_pro config from spec_helper.rb --- spec/spec_helper.rb | 6 ------ 1 file changed, 6 deletions(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 5a49444670..c9bee1d80e 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -13,12 +13,6 @@ unless ENV['DISABLE_KNAPSACK'] Knapsack::Adapters::RSpecAdapter.bind end -# Configures knapsack_pro if not set otherwise on .github/workflows/build.yml -unless ENV['DISABLE_KNAPSACK_PRO'] - require 'knapsack_pro' - KnapsackPro::Adapters::RSpecAdapter.bind -end - Capybara.javascript_driver = :chrome Capybara.default_max_wait_time = 30 Capybara.disable_animation = true From dbd5186dfafb88edfdc74de2dbf2dc523de5ff5b Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Mon, 31 Oct 2022 23:14:16 +0000 Subject: [PATCH 06/24] Enables slow file pattern to run on system specs --- .github/workflows/build.yml | 37 ++----- .../workflows/build_knapsack_controllers.yml | 88 +++++++++++++++++ .github/workflows/build_knapsack_system.yml | 97 +++++++++++++++++++ 3 files changed, 194 insertions(+), 28 deletions(-) create mode 100644 .github/workflows/build_knapsack_controllers.yml create mode 100644 .github/workflows/build_knapsack_system.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 790b039a75..896da4fb9f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Build +name: Build test-the-rest on: workflow_dispatch: @@ -9,7 +9,6 @@ on: env: DISABLE_KNAPSACK: true - DISABLE_KNAPSACK_PRO: false TIMEZONE: UTC COVERAGE: true RAILS_ENV: test @@ -34,17 +33,14 @@ jobs: POSTGRES_USER: ofn POSTGRES_PASSWORD: f00d strategy: - fail-fast: false matrix: - # [n] - where the n is a number of parallel jobs you want to run your tests on. - # Use a higher number if you have slow tests to split them between more parallel jobs. - # Remember to update the value of the `ci_node_index` below to (0..n-1). - ci_node_total: [50] - # Indexes for parallel jobs (starting from zero). - # E.g. use [0, 1] for 2 parallel jobs, [0, 1, 2] for 3 parallel jobs, etc. - ci_node_index: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, - 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49] + specs: + - "spec/models" + - "spec/lib" + - "spec/migrations" + - "spec/serializers" + - "engines/*/spec" + fail-fast: false steps: - uses: actions/checkout@v3 @@ -69,22 +65,8 @@ jobs: run: | bundle exec rake db:create bundle exec rake db:schema:load - - name: Run tests - env: - KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC: ${{ secrets.KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC }} - KNAPSACK_PRO_CI_NODE_TOTAL: ${{ matrix.ci_node_total }} - KNAPSACK_PRO_CI_NODE_INDEX: ${{ matrix.ci_node_index }} - KNAPSACK_PRO_LOG_LEVEL: info - # if you use Knapsack Pro Queue Mode you must set below env variable - # to be able to retry CI build and run previously recorded tests - # https://github.com/KnapsackPro/knapsack_pro-ruby#knapsack_pro_fixed_queue_split-remember-queue-split-on-retry-ci-node - KNAPSACK_PRO_FIXED_QUEUE_SPLIT: true - # RSpec split test files by test examples feature - it's optional - # https://knapsackpro.com/faq/question/how-to-split-slow-rspec-test-files-by-test-examples-by-individual-it - # KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES: true - run: | - bin/knapsack_pro_rspec + run: bundle exec rspec --profile -- ${{ matrix.specs }} - name: Archive failed tests screenshots if: failure() @@ -134,7 +116,6 @@ jobs: run: | bundle exec rake db:create bundle exec rake db:schema:load - - name: Run JS tests run: bundle exec rake karma:run diff --git a/.github/workflows/build_knapsack_controllers.yml b/.github/workflows/build_knapsack_controllers.yml new file mode 100644 index 0000000000..a95711339c --- /dev/null +++ b/.github/workflows/build_knapsack_controllers.yml @@ -0,0 +1,88 @@ +name: Build KnapSack Controllers + +on: + workflow_dispatch: + push: + branches-ignore: + - 'dependabot/**' + pull_request: + +env: + DISABLE_KNAPSACK: true + DISABLE_KNAPSACK_PRO: false + TIMEZONE: UTC + COVERAGE: true + RAILS_ENV: test + +permissions: + contents: read + +jobs: + rspec: + runs-on: ubuntu-20.04 + services: + postgres: + image: postgres:10 + ports: ["5432:5432"] + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + env: + POSTGRES_DB: open_food_network_test + POSTGRES_USER: ofn + POSTGRES_PASSWORD: f00d + strategy: + fail-fast: false + matrix: + # [n] - where the n is a number of parallel jobs you want to run your tests on. + # Use a higher number if you have slow tests to split them between more parallel jobs. + # Remember to update the value of the `ci_node_index` below to (0..n-1). + ci_node_total: [10] + # Indexes for parallel jobs (starting from zero). + # E.g. use [0, 1] for 2 parallel jobs, [0, 1, 2] for 3 parallel jobs, etc. + ci_node_index: [1, 2, 3, 4, 5, 6, 7, 8, 9] + steps: + - uses: actions/checkout@v3 + + - name: Setup redis + uses: supercharge/redis-github-action@1.4.0 + with: + redis-version: 6 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + bundler-cache: true # runs 'bundle install' and caches installed gems automatically + + - uses: actions/setup-node@v3 + with: + node-version: 16 + + - name: Install JS dependencies + run: yarn install --frozen-lockfile + + - name: Set up database + run: | + bundle exec rake db:create + bundle exec rake db:schema:load + + - name: Run tests + + env: + KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC: ${{ secrets.KNAPSACK_PRO_CONTROLLERS_TOKEN_RSPEC }} + KNAPSACK_PRO_CI_NODE_TOTAL: ${{ matrix.ci_node_total }} + KNAPSACK_PRO_CI_NODE_INDEX: ${{ matrix.ci_node_index }} + KNAPSACK_PRO_LOG_LEVEL: info + # if you use Knapsack Pro Queue Mode you must set below env variable + # to be able to retry CI build and run previously recorded tests + # https://github.com/KnapsackPro/knapsack_pro-ruby#knapsack_pro_fixed_queue_split-remember-queue-split-on-retry-ci-node + KNAPSACK_PRO_FIXED_QUEUE_SPLIT: true + # RSpec split test files by test examples feature - it's optional + # https://knapsackpro.com/faq/question/how-to-split-slow-rspec-test-files-by-test-examples-by-individual-it + #KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES: true + + run: | + KNAPSACK_PRO_TEST_FILE_PATTERN="{spec/controllers/**{,/*/**}/*_spec.rb,spec/controllers/**{,/*/**}/*_spec.rb}" bundle exec rake knapsack_pro:rspec + diff --git a/.github/workflows/build_knapsack_system.yml b/.github/workflows/build_knapsack_system.yml new file mode 100644 index 0000000000..6ddaca3d31 --- /dev/null +++ b/.github/workflows/build_knapsack_system.yml @@ -0,0 +1,97 @@ +name: Build KnapSack System + +on: + workflow_dispatch: + push: + branches-ignore: + - 'dependabot/**' + pull_request: + +env: + DISABLE_KNAPSACK: true + DISABLE_KNAPSACK_PRO: false + TIMEZONE: UTC + COVERAGE: true + RAILS_ENV: test + +permissions: + contents: read + +jobs: + rspec: + runs-on: ubuntu-20.04 + services: + postgres: + image: postgres:10 + ports: ["5432:5432"] + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + env: + POSTGRES_DB: open_food_network_test + POSTGRES_USER: ofn + POSTGRES_PASSWORD: f00d + strategy: + fail-fast: false + matrix: + # [n] - where the n is a number of parallel jobs you want to run your tests on. + # Use a higher number if you have slow tests to split them between more parallel jobs. + # Remember to update the value of the `ci_node_index` below to (0..n-1). + ci_node_total: [40] + # Indexes for parallel jobs (starting from zero). + # E.g. use [0, 1] for 2 parallel jobs, [0, 1, 2] for 3 parallel jobs, etc. + ci_node_index: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39] + steps: + - uses: actions/checkout@v3 + + - name: Setup redis + uses: supercharge/redis-github-action@1.4.0 + with: + redis-version: 6 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + bundler-cache: true # runs 'bundle install' and caches installed gems automatically + + - uses: actions/setup-node@v3 + with: + node-version: 16 + + - name: Install JS dependencies + run: yarn install --frozen-lockfile + + - name: Set up database + run: | + bundle exec rake db:create + bundle exec rake db:schema:load + + - name: Run tests + + env: + KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC: ${{ secrets.KNAPSACK_PRO_SYSTEM_TOKEN_RSPEC }} + KNAPSACK_PRO_CI_NODE_TOTAL: ${{ matrix.ci_node_total }} + KNAPSACK_PRO_CI_NODE_INDEX: ${{ matrix.ci_node_index }} + KNAPSACK_PRO_LOG_LEVEL: info + # if you use Knapsack Pro Queue Mode you must set below env variable + # to be able to retry CI build and run previously recorded tests + # https://github.com/KnapsackPro/knapsack_pro-ruby#knapsack_pro_fixed_queue_split-remember-queue-split-on-retry-ci-node + KNAPSACK_PRO_FIXED_QUEUE_SPLIT: true + # RSpec split test files by test examples feature - it's optional + # https://knapsackpro.com/faq/question/how-to-split-slow-rspec-test-files-by-test-examples-by-individual-it + #KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES: true + + run: | + KNAPSACK_PRO_TEST_FILE_PATTERN="{spec/system/**{,/*/**}/*_spec.rb,spec/system/**{,/*/**}/*_spec.rb}" bundle exec rake knapsack_pro:rspec + + - name: Archive failed tests screenshots + if: failure() + uses: actions/upload-artifact@v3 + with: + name: failed-tests-screenshots + path: tmp/capybara/screenshots/*.png + retention-days: 7 + if-no-files-found: ignore From d2f28e2095945e973f5c0bd28eba4b657225908b Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Fri, 4 Nov 2022 11:48:11 +0000 Subject: [PATCH 07/24] Makes API key public --- .github/workflows/build_knapsack_controllers.yml | 4 ++-- .github/workflows/build_knapsack_system.yml | 4 ++-- Gemfile | 3 --- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build_knapsack_controllers.yml b/.github/workflows/build_knapsack_controllers.yml index a95711339c..2147f5c63a 100644 --- a/.github/workflows/build_knapsack_controllers.yml +++ b/.github/workflows/build_knapsack_controllers.yml @@ -71,7 +71,7 @@ jobs: - name: Run tests env: - KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC: ${{ secrets.KNAPSACK_PRO_CONTROLLERS_TOKEN_RSPEC }} + KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC: 864ef557d85ea8e603e086c0387d5154 KNAPSACK_PRO_CI_NODE_TOTAL: ${{ matrix.ci_node_total }} KNAPSACK_PRO_CI_NODE_INDEX: ${{ matrix.ci_node_index }} KNAPSACK_PRO_LOG_LEVEL: info @@ -84,5 +84,5 @@ jobs: #KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES: true run: | - KNAPSACK_PRO_TEST_FILE_PATTERN="{spec/controllers/**{,/*/**}/*_spec.rb,spec/controllers/**{,/*/**}/*_spec.rb}" bundle exec rake knapsack_pro:rspec + KNAPSACK_PRO_TEST_FILE_PATTERN="spec/controllers/**/*_spec.rb" bundle exec rake knapsack_pro:rspec diff --git a/.github/workflows/build_knapsack_system.yml b/.github/workflows/build_knapsack_system.yml index 6ddaca3d31..f135d1f182 100644 --- a/.github/workflows/build_knapsack_system.yml +++ b/.github/workflows/build_knapsack_system.yml @@ -72,7 +72,7 @@ jobs: - name: Run tests env: - KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC: ${{ secrets.KNAPSACK_PRO_SYSTEM_TOKEN_RSPEC }} + KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC: ff2456e64c9f2aa5157eb0daf711d3c3 KNAPSACK_PRO_CI_NODE_TOTAL: ${{ matrix.ci_node_total }} KNAPSACK_PRO_CI_NODE_INDEX: ${{ matrix.ci_node_index }} KNAPSACK_PRO_LOG_LEVEL: info @@ -85,7 +85,7 @@ jobs: #KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES: true run: | - KNAPSACK_PRO_TEST_FILE_PATTERN="{spec/system/**{,/*/**}/*_spec.rb,spec/system/**{,/*/**}/*_spec.rb}" bundle exec rake knapsack_pro:rspec + KNAPSACK_PRO_TEST_FILE_PATTERN="spec/system/**/*_spec.rb" bundle exec rake knapsack_pro:rspec - name: Archive failed tests screenshots if: failure() diff --git a/Gemfile b/Gemfile index 1c1beb19a3..7730eec253 100644 --- a/Gemfile +++ b/Gemfile @@ -169,9 +169,6 @@ group :test do gem 'simplecov', require: false gem 'test-prof', require: false gem 'vcr', require: false - gem 'test-prof' - gem 'vcr' ->>>>>>> 7f0d4cc24 (Adds knapsack_pro to the stack; updates configs) gem 'webmock', require: false # See spec/spec_helper.rb for instructions # gem 'perftools.rb' From 8d532ae26259010bd81102bf01d73eedf70da397 Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Fri, 4 Nov 2022 12:02:31 +0000 Subject: [PATCH 08/24] Enables knapsack_pro by default --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 7730eec253..46d81be700 100644 --- a/Gemfile +++ b/Gemfile @@ -153,7 +153,7 @@ group :test, :development do gem 'fuubar', '~> 2.5.1' gem 'json_spec', '~> 1.1.4' gem 'knapsack', require: false - gem 'knapsack_pro', require: false + gem 'knapsack_pro' gem 'letter_opener', '>= 1.4.1' gem 'rspec-rails', ">= 3.5.2" gem 'rspec-retry', require: false From e62eca93c17b3f2038280c9670fc9557ebefe812 Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Fri, 4 Nov 2022 12:20:20 +0000 Subject: [PATCH 09/24] Simplifies settings --- .github/workflows/build.yml | 8 ++++---- .github/workflows/build_knapsack_controllers.yml | 5 +++-- .github/workflows/build_knapsack_system.yml | 8 ++++---- spec/base_spec_helper.rb | 7 ++----- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 896da4fb9f..ac8ec7302c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,11 +35,11 @@ jobs: strategy: matrix: specs: - - "spec/models" - - "spec/lib" + #- "spec/models" + #- "spec/lib" - "spec/migrations" - - "spec/serializers" - - "engines/*/spec" + #- "spec/serializers" + #- "engines/*/spec" fail-fast: false steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/build_knapsack_controllers.yml b/.github/workflows/build_knapsack_controllers.yml index 2147f5c63a..6943af5bec 100644 --- a/.github/workflows/build_knapsack_controllers.yml +++ b/.github/workflows/build_knapsack_controllers.yml @@ -42,7 +42,7 @@ jobs: ci_node_total: [10] # Indexes for parallel jobs (starting from zero). # E.g. use [0, 1] for 2 parallel jobs, [0, 1, 2] for 3 parallel jobs, etc. - ci_node_index: [1, 2, 3, 4, 5, 6, 7, 8, 9] + ci_node_index: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] steps: - uses: actions/checkout@v3 @@ -82,7 +82,8 @@ jobs: # RSpec split test files by test examples feature - it's optional # https://knapsackpro.com/faq/question/how-to-split-slow-rspec-test-files-by-test-examples-by-individual-it #KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES: true + KNAPSACK_PRO_TEST_FILE_PATTERN: "spec/controllers/**/*_spec.rb" run: | - KNAPSACK_PRO_TEST_FILE_PATTERN="spec/controllers/**/*_spec.rb" bundle exec rake knapsack_pro:rspec + bundle exec rake knapsack_pro:rspec diff --git a/.github/workflows/build_knapsack_system.yml b/.github/workflows/build_knapsack_system.yml index f135d1f182..004f5c2abc 100644 --- a/.github/workflows/build_knapsack_system.yml +++ b/.github/workflows/build_knapsack_system.yml @@ -39,11 +39,10 @@ jobs: # [n] - where the n is a number of parallel jobs you want to run your tests on. # Use a higher number if you have slow tests to split them between more parallel jobs. # Remember to update the value of the `ci_node_index` below to (0..n-1). - ci_node_total: [40] + ci_node_total: [10] # Indexes for parallel jobs (starting from zero). # E.g. use [0, 1] for 2 parallel jobs, [0, 1, 2] for 3 parallel jobs, etc. - ci_node_index: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39] + ci_node_index: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] steps: - uses: actions/checkout@v3 @@ -83,9 +82,10 @@ jobs: # RSpec split test files by test examples feature - it's optional # https://knapsackpro.com/faq/question/how-to-split-slow-rspec-test-files-by-test-examples-by-individual-it #KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES: true + KNAPSACK_PRO_TEST_FILE_PATTERN: "spec/system/**/*_spec.rb" run: | - KNAPSACK_PRO_TEST_FILE_PATTERN="spec/system/**/*_spec.rb" bundle exec rake knapsack_pro:rspec + bundle exec rake knapsack_pro:rspec - name: Archive failed tests screenshots if: failure() diff --git a/spec/base_spec_helper.rb b/spec/base_spec_helper.rb index 4b2d1ebcaf..eec44cf8a7 100644 --- a/spec/base_spec_helper.rb +++ b/spec/base_spec_helper.rb @@ -24,11 +24,8 @@ Shoulda::Matchers.configure do |config| end end -# Configures knapsack_pro if not set otherwise on .github/workflows/build.yml -unless ENV['DISABLE_KNAPSACK_PRO'] - require 'knapsack_pro' - KnapsackPro::Adapters::RSpecAdapter.bind -end +require 'knapsack_pro' +KnapsackPro::Adapters::RSpecAdapter.bind # Allow connections to selenium whilst raising errors when connecting to external sites require 'webmock/rspec' From ff9985dd88fa22bf20574a5191c9ea29223e7530 Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Fri, 4 Nov 2022 13:13:19 +0000 Subject: [PATCH 10/24] Further splits the build --- .github/workflows/build_knapsack_system.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_knapsack_system.yml b/.github/workflows/build_knapsack_system.yml index 004f5c2abc..02a396d863 100644 --- a/.github/workflows/build_knapsack_system.yml +++ b/.github/workflows/build_knapsack_system.yml @@ -39,10 +39,10 @@ jobs: # [n] - where the n is a number of parallel jobs you want to run your tests on. # Use a higher number if you have slow tests to split them between more parallel jobs. # Remember to update the value of the `ci_node_index` below to (0..n-1). - ci_node_total: [10] + ci_node_total: [20] # Indexes for parallel jobs (starting from zero). # E.g. use [0, 1] for 2 parallel jobs, [0, 1, 2] for 3 parallel jobs, etc. - ci_node_index: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + ci_node_index: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19] steps: - uses: actions/checkout@v3 From 9e1047288f6cf6a68c33f42bb881fa2bbb69c516 Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Fri, 4 Nov 2022 18:15:31 +0000 Subject: [PATCH 11/24] Runs all the test-the-rest specs --- .github/workflows/build.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ac8ec7302c..896da4fb9f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,11 +35,11 @@ jobs: strategy: matrix: specs: - #- "spec/models" - #- "spec/lib" + - "spec/models" + - "spec/lib" - "spec/migrations" - #- "spec/serializers" - #- "engines/*/spec" + - "spec/serializers" + - "engines/*/spec" fail-fast: false steps: - uses: actions/checkout@v3 From da5976d85d593d7abb35d9ec9838871c9ddd3c67 Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Sun, 6 Nov 2022 16:42:58 +0000 Subject: [PATCH 12/24] Splits model specs --- .github/workflows/build.yml | 1 - .github/workflows/build_knapsack_models.yml | 89 +++++++++++++++++++++ 2 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/build_knapsack_models.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 896da4fb9f..a62b922b77 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,7 +35,6 @@ jobs: strategy: matrix: specs: - - "spec/models" - "spec/lib" - "spec/migrations" - "spec/serializers" diff --git a/.github/workflows/build_knapsack_models.yml b/.github/workflows/build_knapsack_models.yml new file mode 100644 index 0000000000..cf7caf100a --- /dev/null +++ b/.github/workflows/build_knapsack_models.yml @@ -0,0 +1,89 @@ +name: Build KnapSack Models + +on: + workflow_dispatch: + push: + branches-ignore: + - 'dependabot/**' + pull_request: + +env: + DISABLE_KNAPSACK: true + DISABLE_KNAPSACK_PRO: false + TIMEZONE: UTC + COVERAGE: true + RAILS_ENV: test + +permissions: + contents: read + +jobs: + rspec: + runs-on: ubuntu-20.04 + services: + postgres: + image: postgres:10 + ports: ["5432:5432"] + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + env: + POSTGRES_DB: open_food_network_test + POSTGRES_USER: ofn + POSTGRES_PASSWORD: f00d + strategy: + fail-fast: false + matrix: + # [n] - where the n is a number of parallel jobs you want to run your tests on. + # Use a higher number if you have slow tests to split them between more parallel jobs. + # Remember to update the value of the `ci_node_index` below to (0..n-1). + ci_node_total: [10] + # Indexes for parallel jobs (starting from zero). + # E.g. use [0, 1] for 2 parallel jobs, [0, 1, 2] for 3 parallel jobs, etc. + ci_node_index: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + steps: + - uses: actions/checkout@v3 + + - name: Setup redis + uses: supercharge/redis-github-action@1.4.0 + with: + redis-version: 6 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + bundler-cache: true # runs 'bundle install' and caches installed gems automatically + + - uses: actions/setup-node@v3 + with: + node-version: 16 + + - name: Install JS dependencies + run: yarn install --frozen-lockfile + + - name: Set up database + run: | + bundle exec rake db:create + bundle exec rake db:schema:load + + - name: Run tests + + env: + KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC: 864ef557d85ea8e603e086c0387d5154 + KNAPSACK_PRO_CI_NODE_TOTAL: ${{ matrix.ci_node_total }} + KNAPSACK_PRO_CI_NODE_INDEX: ${{ matrix.ci_node_index }} + KNAPSACK_PRO_LOG_LEVEL: info + # if you use Knapsack Pro Queue Mode you must set below env variable + # to be able to retry CI build and run previously recorded tests + # https://github.com/KnapsackPro/knapsack_pro-ruby#knapsack_pro_fixed_queue_split-remember-queue-split-on-retry-ci-node + KNAPSACK_PRO_FIXED_QUEUE_SPLIT: true + # RSpec split test files by test examples feature - it's optional + # https://knapsackpro.com/faq/question/how-to-split-slow-rspec-test-files-by-test-examples-by-individual-it + #KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES: true + KNAPSACK_PRO_TEST_FILE_PATTERN: "spec/models/**/*_spec.rb" + + run: | + bundle exec rake knapsack_pro:rspec + From b5da120805c818d6db057ad841239eb4e8e11ea9 Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Sun, 6 Nov 2022 17:25:23 +0000 Subject: [PATCH 13/24] Splits engines Keeps test-the-rest specs running without Knapsack --- .github/workflows/build.yml | 62 +----------------- .github/workflows/build_engines.yml | 97 +++++++++++++++++++++++++++++ 2 files changed, 99 insertions(+), 60 deletions(-) create mode 100644 .github/workflows/build_engines.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a62b922b77..8e1c604057 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Build test-the-rest +name: test-the-rest (non-Knapsack) on: workflow_dispatch: @@ -9,6 +9,7 @@ on: env: DISABLE_KNAPSACK: true + DISABLE_KNAPSACK_PRO: false TIMEZONE: UTC COVERAGE: true RAILS_ENV: test @@ -17,65 +18,6 @@ permissions: contents: read jobs: - rspec: - runs-on: ubuntu-20.04 - services: - postgres: - image: postgres:10 - ports: ["5432:5432"] - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - env: - POSTGRES_DB: open_food_network_test - POSTGRES_USER: ofn - POSTGRES_PASSWORD: f00d - strategy: - matrix: - specs: - - "spec/lib" - - "spec/migrations" - - "spec/serializers" - - "engines/*/spec" - fail-fast: false - steps: - - uses: actions/checkout@v3 - - - name: Setup redis - uses: supercharge/redis-github-action@1.4.0 - with: - redis-version: 6 - - - name: Set up Ruby - uses: ruby/setup-ruby@v1 - with: - bundler-cache: true # runs 'bundle install' and caches installed gems automatically - - - uses: actions/setup-node@v3 - with: - node-version: 16 - - - name: Install JS dependencies - run: yarn install --frozen-lockfile - - - name: Set up database - run: | - bundle exec rake db:create - bundle exec rake db:schema:load - - name: Run tests - run: bundle exec rspec --profile -- ${{ matrix.specs }} - - - name: Archive failed tests screenshots - if: failure() - uses: actions/upload-artifact@v3 - with: - name: failed-tests-screenshots - path: tmp/capybara/screenshots/*.png - retention-days: 7 - if-no-files-found: ignore - test-the-rest: runs-on: ubuntu-20.04 services: diff --git a/.github/workflows/build_engines.yml b/.github/workflows/build_engines.yml new file mode 100644 index 0000000000..0b988c7624 --- /dev/null +++ b/.github/workflows/build_engines.yml @@ -0,0 +1,97 @@ +name: Build Knapsack Engines + +on: + workflow_dispatch: + push: + branches-ignore: + - 'dependabot/**' + pull_request: + +env: + DISABLE_KNAPSACK: true + DISABLE_KNAPSACK_PRO: false + TIMEZONE: UTC + COVERAGE: true + RAILS_ENV: test + +permissions: + contents: read + +jobs: + rspec: + runs-on: ubuntu-20.04 + services: + postgres: + image: postgres:10 + ports: ["5432:5432"] + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + env: + POSTGRES_DB: open_food_network_test + POSTGRES_USER: ofn + POSTGRES_PASSWORD: f00d + strategy: + fail-fast: false + matrix: + # [n] - where the n is a number of parallel jobs you want to run your tests on. + # Use a higher number if you have slow tests to split them between more parallel jobs. + # Remember to update the value of the `ci_node_index` below to (0..n-1). + ci_node_total: [10] + # Indexes for parallel jobs (starting from zero). + # E.g. use [0, 1] for 2 parallel jobs, [0, 1, 2] for 3 parallel jobs, etc. + ci_node_index: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + steps: + - uses: actions/checkout@v3 + + - name: Setup redis + uses: supercharge/redis-github-action@1.4.0 + with: + redis-version: 6 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + bundler-cache: true # runs 'bundle install' and caches installed gems automatically + + - uses: actions/setup-node@v3 + with: + node-version: 16 + + - name: Install JS dependencies + run: yarn install --frozen-lockfile + + - name: Set up database + run: | + bundle exec rake db:create + bundle exec rake db:schema:load + + - name: Run tests + + env: + KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC: 09476e2ce491c12083df62768667c674 + KNAPSACK_PRO_CI_NODE_TOTAL: ${{ matrix.ci_node_total }} + KNAPSACK_PRO_CI_NODE_INDEX: ${{ matrix.ci_node_index }} + KNAPSACK_PRO_LOG_LEVEL: info + # if you use Knapsack Pro Queue Mode you must set below env variable + # to be able to retry CI build and run previously recorded tests + # https://github.com/KnapsackPro/knapsack_pro-ruby#knapsack_pro_fixed_queue_split-remember-queue-split-on-retry-ci-node + KNAPSACK_PRO_FIXED_QUEUE_SPLIT: true + # RSpec split test files by test examples feature - it's optional + # https://knapsackpro.com/faq/question/how-to-split-slow-rspec-test-files-by-test-examples-by-individual-it + #KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES: true + KNAPSACK_PRO_TEST_FILE_PATTERN: "{spec/lib/**/*_spec.rb, spec/migrations/**/*_spec.rb, spec/serializers/**/*_spec.rb, engines/**/*_spec.rb}" + + run: | + bundle exec rake knapsack_pro:rspec + + - name: Archive failed tests screenshots + if: failure() + uses: actions/upload-artifact@v3 + with: + name: failed-tests-screenshots + path: tmp/capybara/screenshots/*.png + retention-days: 7 + if-no-files-found: ignore From b9471d4f016312fe18f76d29028dfd00e8142403 Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Sun, 6 Nov 2022 20:16:25 +0000 Subject: [PATCH 14/24] Sets same API key for models and engines --- .github/workflows/build_knapsack_models.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_knapsack_models.yml b/.github/workflows/build_knapsack_models.yml index cf7caf100a..151cf4b27e 100644 --- a/.github/workflows/build_knapsack_models.yml +++ b/.github/workflows/build_knapsack_models.yml @@ -71,7 +71,7 @@ jobs: - name: Run tests env: - KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC: 864ef557d85ea8e603e086c0387d5154 + KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC: 09476e2ce491c12083df62768667c674 KNAPSACK_PRO_CI_NODE_TOTAL: ${{ matrix.ci_node_total }} KNAPSACK_PRO_CI_NODE_INDEX: ${{ matrix.ci_node_index }} KNAPSACK_PRO_LOG_LEVEL: info From 8fb11b9151b7ada8e015942a5094945593c8a75c Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Sun, 6 Nov 2022 20:51:28 +0000 Subject: [PATCH 15/24] Increases ci_node_total for system specs --- .github/workflows/build_knapsack_system.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_knapsack_system.yml b/.github/workflows/build_knapsack_system.yml index 02a396d863..7300d2a0b5 100644 --- a/.github/workflows/build_knapsack_system.yml +++ b/.github/workflows/build_knapsack_system.yml @@ -1,4 +1,4 @@ -name: Build KnapSack System +name: Build Knapsack System on: workflow_dispatch: @@ -39,10 +39,10 @@ jobs: # [n] - where the n is a number of parallel jobs you want to run your tests on. # Use a higher number if you have slow tests to split them between more parallel jobs. # Remember to update the value of the `ci_node_index` below to (0..n-1). - ci_node_total: [20] + ci_node_total: [24] # Indexes for parallel jobs (starting from zero). # E.g. use [0, 1] for 2 parallel jobs, [0, 1, 2] for 3 parallel jobs, etc. - ci_node_index: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19] + ci_node_index: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23] steps: - uses: actions/checkout@v3 From 236abe485aee0ca63518b5e2877222d4c67b6385 Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Mon, 7 Nov 2022 00:07:57 +0000 Subject: [PATCH 16/24] Splits test-the-rest specs --- .github/workflows/build.yml | 2 +- .github/workflows/build_knapsack_system.yml | 4 +- .../build_knapsack_test_the_rest.yml | 89 +++++++++++++++++++ 3 files changed, 92 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/build_knapsack_test_the_rest.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8e1c604057..0bc8b5551c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: test-the-rest (non-Knapsack) +name: jest and karma (non-Knapsack) on: workflow_dispatch: diff --git a/.github/workflows/build_knapsack_system.yml b/.github/workflows/build_knapsack_system.yml index 7300d2a0b5..5d9d6c11ee 100644 --- a/.github/workflows/build_knapsack_system.yml +++ b/.github/workflows/build_knapsack_system.yml @@ -39,10 +39,10 @@ jobs: # [n] - where the n is a number of parallel jobs you want to run your tests on. # Use a higher number if you have slow tests to split them between more parallel jobs. # Remember to update the value of the `ci_node_index` below to (0..n-1). - ci_node_total: [24] + ci_node_total: [20] # Indexes for parallel jobs (starting from zero). # E.g. use [0, 1] for 2 parallel jobs, [0, 1, 2] for 3 parallel jobs, etc. - ci_node_index: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23] + ci_node_index: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19] steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/build_knapsack_test_the_rest.yml b/.github/workflows/build_knapsack_test_the_rest.yml new file mode 100644 index 0000000000..9b98ee4852 --- /dev/null +++ b/.github/workflows/build_knapsack_test_the_rest.yml @@ -0,0 +1,89 @@ +name: Build Knapsack test-the-rest + +on: + workflow_dispatch: + push: + branches-ignore: + - 'dependabot/**' + pull_request: + +env: + DISABLE_KNAPSACK: true + DISABLE_KNAPSACK_PRO: false + TIMEZONE: UTC + COVERAGE: true + RAILS_ENV: test + +permissions: + contents: read + +jobs: + rspec: + runs-on: ubuntu-20.04 + services: + postgres: + image: postgres:10 + ports: ["5432:5432"] + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + env: + POSTGRES_DB: open_food_network_test + POSTGRES_USER: ofn + POSTGRES_PASSWORD: f00d + strategy: + fail-fast: false + matrix: + # [n] - where the n is a number of parallel jobs you want to run your tests on. + # Use a higher number if you have slow tests to split them between more parallel jobs. + # Remember to update the value of the `ci_node_index` below to (0..n-1). + ci_node_total: [5] + # Indexes for parallel jobs (starting from zero). + # E.g. use [0, 1] for 2 parallel jobs, [0, 1, 2] for 3 parallel jobs, etc. + ci_node_index: [0, 1, 2, 3, 4] + steps: + - uses: actions/checkout@v3 + + - name: Setup redis + uses: supercharge/redis-github-action@1.4.0 + with: + redis-version: 6 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + bundler-cache: true # runs 'bundle install' and caches installed gems automatically + + - uses: actions/setup-node@v3 + with: + node-version: 16 + + - name: Install JS dependencies + run: yarn install --frozen-lockfile + + - name: Set up database + run: | + bundle exec rake db:create + bundle exec rake db:schema:load + + - name: Run tests + + env: + KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC: 09476e2ce491c12083df62768667c674 + KNAPSACK_PRO_CI_NODE_TOTAL: ${{ matrix.ci_node_total }} + KNAPSACK_PRO_CI_NODE_INDEX: ${{ matrix.ci_node_index }} + KNAPSACK_PRO_LOG_LEVEL: info + # if you use Knapsack Pro Queue Mode you must set below env variable + # to be able to retry CI build and run previously recorded tests + # https://github.com/KnapsackPro/knapsack_pro-ruby#knapsack_pro_fixed_queue_split-remember-queue-split-on-retry-ci-node + KNAPSACK_PRO_FIXED_QUEUE_SPLIT: true + # RSpec split test files by test examples feature - it's optional + # https://knapsackpro.com/faq/question/how-to-split-slow-rspec-test-files-by-test-examples-by-individual-it + #KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES: true + KNAPSACK_PRO_TEST_EXCLUDE_PATTERN: "{engines/**{,/*/**}/*_spec.rb,spec/models/**{,/*/**}/*_spec.rb,spec/controllers/**{,/*/**}/*_spec.rb,spec/serializers/**{,/*/**}/*_spec.rb,spec/lib/**{,/*/**}/*_spec.rb,spec/migrations/**{,/*/**}/*_spec.rb,spec/system/**{,/*/**}/*_spec.rb}" + + run: | + bundle exec rake knapsack_pro:rspec + From fd3a54a904d27b6dd4b7fabe54fd8cd81edb7d8e Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Mon, 7 Nov 2022 00:25:01 +0000 Subject: [PATCH 17/24] Creates key for test_the_rest specs --- .github/workflows/build_knapsack_system.yml | 4 ++-- .github/workflows/build_knapsack_test_the_rest.yml | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build_knapsack_system.yml b/.github/workflows/build_knapsack_system.yml index 5d9d6c11ee..72931cae6f 100644 --- a/.github/workflows/build_knapsack_system.yml +++ b/.github/workflows/build_knapsack_system.yml @@ -39,10 +39,10 @@ jobs: # [n] - where the n is a number of parallel jobs you want to run your tests on. # Use a higher number if you have slow tests to split them between more parallel jobs. # Remember to update the value of the `ci_node_index` below to (0..n-1). - ci_node_total: [20] + ci_node_total: [15] # Indexes for parallel jobs (starting from zero). # E.g. use [0, 1] for 2 parallel jobs, [0, 1, 2] for 3 parallel jobs, etc. - ci_node_index: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19] + ci_node_index: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/build_knapsack_test_the_rest.yml b/.github/workflows/build_knapsack_test_the_rest.yml index 9b98ee4852..4d2152b854 100644 --- a/.github/workflows/build_knapsack_test_the_rest.yml +++ b/.github/workflows/build_knapsack_test_the_rest.yml @@ -39,10 +39,10 @@ jobs: # [n] - where the n is a number of parallel jobs you want to run your tests on. # Use a higher number if you have slow tests to split them between more parallel jobs. # Remember to update the value of the `ci_node_index` below to (0..n-1). - ci_node_total: [5] + ci_node_total: [10] # Indexes for parallel jobs (starting from zero). # E.g. use [0, 1] for 2 parallel jobs, [0, 1, 2] for 3 parallel jobs, etc. - ci_node_index: [0, 1, 2, 3, 4] + ci_node_index: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] steps: - uses: actions/checkout@v3 @@ -71,7 +71,7 @@ jobs: - name: Run tests env: - KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC: 09476e2ce491c12083df62768667c674 + KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC: e3b8800198d2d89b70c7edbdd85f8fd8 KNAPSACK_PRO_CI_NODE_TOTAL: ${{ matrix.ci_node_total }} KNAPSACK_PRO_CI_NODE_INDEX: ${{ matrix.ci_node_index }} KNAPSACK_PRO_LOG_LEVEL: info @@ -82,7 +82,8 @@ jobs: # RSpec split test files by test examples feature - it's optional # https://knapsackpro.com/faq/question/how-to-split-slow-rspec-test-files-by-test-examples-by-individual-it #KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES: true - KNAPSACK_PRO_TEST_EXCLUDE_PATTERN: "{engines/**{,/*/**}/*_spec.rb,spec/models/**{,/*/**}/*_spec.rb,spec/controllers/**{,/*/**}/*_spec.rb,spec/serializers/**{,/*/**}/*_spec.rb,spec/lib/**{,/*/**}/*_spec.rb,spec/migrations/**{,/*/**}/*_spec.rb,spec/system/**{,/*/**}/*_spec.rb}" + KNAPSACK_PRO_TEST_FILE_EXCLUDE_PATTERN: "{engines/**{,/*/**}/*_spec.rb,spec/models/**{,/*/**}/*_spec.rb,spec/controllers/**{,/*/**}/*_spec.rb,spec/serializers/**{,/*/**}/*_spec.rb,spec/lib/**{,/*/**}/*_spec.rb,spec/migrations/**{,/*/**}/*_spec.rb,spec/system/**{,/*/**}/*_spec.rb}" + run: | bundle exec rake knapsack_pro:rspec From 04c3b8b9cfa5484ffda96175657e4a3cee455123 Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Mon, 7 Nov 2022 00:54:40 +0000 Subject: [PATCH 18/24] Sets failing performance specs as pending --- .../workflows/build_knapsack_controllers.yml | 4 +- .github/workflows/build_knapsack_models.yml | 4 +- spec/performance/shop_controller_spec.rb | 51 +++++++++++++++++++ 3 files changed, 55 insertions(+), 4 deletions(-) create mode 100644 spec/performance/shop_controller_spec.rb diff --git a/.github/workflows/build_knapsack_controllers.yml b/.github/workflows/build_knapsack_controllers.yml index 6943af5bec..059d1b2040 100644 --- a/.github/workflows/build_knapsack_controllers.yml +++ b/.github/workflows/build_knapsack_controllers.yml @@ -39,10 +39,10 @@ jobs: # [n] - where the n is a number of parallel jobs you want to run your tests on. # Use a higher number if you have slow tests to split them between more parallel jobs. # Remember to update the value of the `ci_node_index` below to (0..n-1). - ci_node_total: [10] + ci_node_total: [5] # Indexes for parallel jobs (starting from zero). # E.g. use [0, 1] for 2 parallel jobs, [0, 1, 2] for 3 parallel jobs, etc. - ci_node_index: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + ci_node_index: [0, 1, 2, 3, 4] steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/build_knapsack_models.yml b/.github/workflows/build_knapsack_models.yml index 151cf4b27e..d7dcdd2f12 100644 --- a/.github/workflows/build_knapsack_models.yml +++ b/.github/workflows/build_knapsack_models.yml @@ -39,10 +39,10 @@ jobs: # [n] - where the n is a number of parallel jobs you want to run your tests on. # Use a higher number if you have slow tests to split them between more parallel jobs. # Remember to update the value of the `ci_node_index` below to (0..n-1). - ci_node_total: [10] + ci_node_total: [5] # Indexes for parallel jobs (starting from zero). # E.g. use [0, 1] for 2 parallel jobs, [0, 1, 2] for 3 parallel jobs, etc. - ci_node_index: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + ci_node_index: [0, 1, 2, 3, 4] steps: - uses: actions/checkout@v3 diff --git a/spec/performance/shop_controller_spec.rb b/spec/performance/shop_controller_spec.rb new file mode 100644 index 0000000000..793a84c049 --- /dev/null +++ b/spec/performance/shop_controller_spec.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +require 'spec_helper' + +xdescribe ShopController, type: :controller, performance: true do + include FileHelper + + let(:d) { create(:distributor_enterprise) } + let(:enterprise_fee) { create(:enterprise_fee) } + let(:order_cycle) { + create(:simple_order_cycle, distributors: [d], coordinator_fees: [enterprise_fee]) + } + + before do + allow(controller).to receive(:current_distributor) { d } + allow(controller).to receive(:current_order_cycle) { order_cycle } + Spree::Config.currency = 'AUD' + end + + describe "fetching products" do + let(:exchange) { order_cycle.exchanges.to_enterprises(d).outgoing.first } + let(:image) { white_logo_file } + let(:cache_key_patterns) do + [ + 'api\/taxon_serializer\/spree\/taxons', + 'enterprise' + ] + end + + before do + 11.times do + p = create(:simple_product) + p.set_property 'Organic Certified', 'NASAA 12345' + v1 = create(:variant, product: p) + v2 = create(:variant, product: p) + Spree::Image.create! viewable_id: p.master.id, viewable_type: 'Spree::Variant', + attachment: image + + exchange.variants << [v1, v2] + end + end + + it "returns products via json" do + pending("fixing failing performance specs") + results = multi_benchmark(3, cache_key_patterns: cache_key_patterns) do + get :products, xhr: true + expect(response.status).to eq 200 + end + end + end +end From ef7684e07921080f68981d89751a3b90f6d03639 Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Mon, 7 Nov 2022 12:07:07 +0000 Subject: [PATCH 19/24] Disables queue mode --- .github/workflows/build_engines.yml | 2 +- .github/workflows/build_knapsack_controllers.yml | 2 +- .github/workflows/build_knapsack_models.yml | 2 +- .github/workflows/build_knapsack_system.yml | 6 +++--- .github/workflows/build_knapsack_test_the_rest.yml | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build_engines.yml b/.github/workflows/build_engines.yml index 0b988c7624..50866db697 100644 --- a/.github/workflows/build_engines.yml +++ b/.github/workflows/build_engines.yml @@ -78,7 +78,7 @@ jobs: # if you use Knapsack Pro Queue Mode you must set below env variable # to be able to retry CI build and run previously recorded tests # https://github.com/KnapsackPro/knapsack_pro-ruby#knapsack_pro_fixed_queue_split-remember-queue-split-on-retry-ci-node - KNAPSACK_PRO_FIXED_QUEUE_SPLIT: true + # KNAPSACK_PRO_FIXED_QUEUE_SPLIT: false # RSpec split test files by test examples feature - it's optional # https://knapsackpro.com/faq/question/how-to-split-slow-rspec-test-files-by-test-examples-by-individual-it #KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES: true diff --git a/.github/workflows/build_knapsack_controllers.yml b/.github/workflows/build_knapsack_controllers.yml index 059d1b2040..bd840410f9 100644 --- a/.github/workflows/build_knapsack_controllers.yml +++ b/.github/workflows/build_knapsack_controllers.yml @@ -78,7 +78,7 @@ jobs: # if you use Knapsack Pro Queue Mode you must set below env variable # to be able to retry CI build and run previously recorded tests # https://github.com/KnapsackPro/knapsack_pro-ruby#knapsack_pro_fixed_queue_split-remember-queue-split-on-retry-ci-node - KNAPSACK_PRO_FIXED_QUEUE_SPLIT: true + # KNAPSACK_PRO_FIXED_QUEUE_SPLIT: false # RSpec split test files by test examples feature - it's optional # https://knapsackpro.com/faq/question/how-to-split-slow-rspec-test-files-by-test-examples-by-individual-it #KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES: true diff --git a/.github/workflows/build_knapsack_models.yml b/.github/workflows/build_knapsack_models.yml index d7dcdd2f12..d3bea5daa1 100644 --- a/.github/workflows/build_knapsack_models.yml +++ b/.github/workflows/build_knapsack_models.yml @@ -78,7 +78,7 @@ jobs: # if you use Knapsack Pro Queue Mode you must set below env variable # to be able to retry CI build and run previously recorded tests # https://github.com/KnapsackPro/knapsack_pro-ruby#knapsack_pro_fixed_queue_split-remember-queue-split-on-retry-ci-node - KNAPSACK_PRO_FIXED_QUEUE_SPLIT: true + # KNAPSACK_PRO_FIXED_QUEUE_SPLIT: false # RSpec split test files by test examples feature - it's optional # https://knapsackpro.com/faq/question/how-to-split-slow-rspec-test-files-by-test-examples-by-individual-it #KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES: true diff --git a/.github/workflows/build_knapsack_system.yml b/.github/workflows/build_knapsack_system.yml index 72931cae6f..b4b49f1026 100644 --- a/.github/workflows/build_knapsack_system.yml +++ b/.github/workflows/build_knapsack_system.yml @@ -39,10 +39,10 @@ jobs: # [n] - where the n is a number of parallel jobs you want to run your tests on. # Use a higher number if you have slow tests to split them between more parallel jobs. # Remember to update the value of the `ci_node_index` below to (0..n-1). - ci_node_total: [15] + ci_node_total: [20] # Indexes for parallel jobs (starting from zero). # E.g. use [0, 1] for 2 parallel jobs, [0, 1, 2] for 3 parallel jobs, etc. - ci_node_index: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] + ci_node_index: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19] steps: - uses: actions/checkout@v3 @@ -78,7 +78,7 @@ jobs: # if you use Knapsack Pro Queue Mode you must set below env variable # to be able to retry CI build and run previously recorded tests # https://github.com/KnapsackPro/knapsack_pro-ruby#knapsack_pro_fixed_queue_split-remember-queue-split-on-retry-ci-node - KNAPSACK_PRO_FIXED_QUEUE_SPLIT: true + # KNAPSACK_PRO_FIXED_QUEUE_SPLIT: false # RSpec split test files by test examples feature - it's optional # https://knapsackpro.com/faq/question/how-to-split-slow-rspec-test-files-by-test-examples-by-individual-it #KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES: true diff --git a/.github/workflows/build_knapsack_test_the_rest.yml b/.github/workflows/build_knapsack_test_the_rest.yml index 4d2152b854..3cb7fe1f1e 100644 --- a/.github/workflows/build_knapsack_test_the_rest.yml +++ b/.github/workflows/build_knapsack_test_the_rest.yml @@ -78,7 +78,7 @@ jobs: # if you use Knapsack Pro Queue Mode you must set below env variable # to be able to retry CI build and run previously recorded tests # https://github.com/KnapsackPro/knapsack_pro-ruby#knapsack_pro_fixed_queue_split-remember-queue-split-on-retry-ci-node - KNAPSACK_PRO_FIXED_QUEUE_SPLIT: true + # KNAPSACK_PRO_FIXED_QUEUE_SPLIT: false # RSpec split test files by test examples feature - it's optional # https://knapsackpro.com/faq/question/how-to-split-slow-rspec-test-files-by-test-examples-by-individual-it #KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES: true From 48ecbaaa16e1a105f0ae84b3b38025dbaac1901b Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Mon, 14 Nov 2022 13:25:35 +0000 Subject: [PATCH 20/24] Enables queue mode only for system tests --- .github/workflows/build_knapsack_system.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_knapsack_system.yml b/.github/workflows/build_knapsack_system.yml index b4b49f1026..650c01ee7a 100644 --- a/.github/workflows/build_knapsack_system.yml +++ b/.github/workflows/build_knapsack_system.yml @@ -85,7 +85,7 @@ jobs: KNAPSACK_PRO_TEST_FILE_PATTERN: "spec/system/**/*_spec.rb" run: | - bundle exec rake knapsack_pro:rspec + bundle exec rake knapsack_pro:queue:rspec - name: Archive failed tests screenshots if: failure() From 40a9c36c85294d861141c2eb1852ae9cb9fa56d5 Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Mon, 14 Nov 2022 13:43:56 +0000 Subject: [PATCH 21/24] Increases nr of nodes for system specs --- .github/workflows/build_knapsack_system.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_knapsack_system.yml b/.github/workflows/build_knapsack_system.yml index 650c01ee7a..07705bf54d 100644 --- a/.github/workflows/build_knapsack_system.yml +++ b/.github/workflows/build_knapsack_system.yml @@ -39,10 +39,10 @@ jobs: # [n] - where the n is a number of parallel jobs you want to run your tests on. # Use a higher number if you have slow tests to split them between more parallel jobs. # Remember to update the value of the `ci_node_index` below to (0..n-1). - ci_node_total: [20] + ci_node_total: [24] # Indexes for parallel jobs (starting from zero). # E.g. use [0, 1] for 2 parallel jobs, [0, 1, 2] for 3 parallel jobs, etc. - ci_node_index: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19] + ci_node_index: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 23] steps: - uses: actions/checkout@v3 From 3c53214daa17141f14badbd78f7d188f8ca2f881 Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Tue, 15 Nov 2022 18:45:31 +0000 Subject: [PATCH 22/24] Enables fixed_queue_split --- .github/workflows/build_knapsack_system.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_knapsack_system.yml b/.github/workflows/build_knapsack_system.yml index 07705bf54d..44ac1496b2 100644 --- a/.github/workflows/build_knapsack_system.yml +++ b/.github/workflows/build_knapsack_system.yml @@ -78,7 +78,7 @@ jobs: # if you use Knapsack Pro Queue Mode you must set below env variable # to be able to retry CI build and run previously recorded tests # https://github.com/KnapsackPro/knapsack_pro-ruby#knapsack_pro_fixed_queue_split-remember-queue-split-on-retry-ci-node - # KNAPSACK_PRO_FIXED_QUEUE_SPLIT: false + KNAPSACK_PRO_FIXED_QUEUE_SPLIT: true # RSpec split test files by test examples feature - it's optional # https://knapsackpro.com/faq/question/how-to-split-slow-rspec-test-files-by-test-examples-by-individual-it #KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES: true From 10d1d2066e80bb7a915f96181f8685bd12dded7f Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Mon, 21 Nov 2022 10:12:49 +0000 Subject: [PATCH 23/24] Merges separate knapsack_pro build files into one Renames jobs Includes jest and karma tests in build file Renames jest karma job Moves build setup into build.yml file Changes job names Re-distributes nodes according to run-time --- .github/workflows/build.yml | 372 +++++++++++++++++- .github/workflows/build_engines.yml | 97 ----- .../workflows/build_knapsack_controllers.yml | 89 ----- .github/workflows/build_knapsack_models.yml | 89 ----- .github/workflows/build_knapsack_system.yml | 97 ----- .../build_knapsack_test_the_rest.yml | 90 ----- 6 files changed, 366 insertions(+), 468 deletions(-) delete mode 100644 .github/workflows/build_engines.yml delete mode 100644 .github/workflows/build_knapsack_controllers.yml delete mode 100644 .github/workflows/build_knapsack_models.yml delete mode 100644 .github/workflows/build_knapsack_system.yml delete mode 100644 .github/workflows/build_knapsack_test_the_rest.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0bc8b5551c..07a8c328cd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: jest and karma (non-Knapsack) +name: Build on: workflow_dispatch: @@ -8,7 +8,6 @@ on: pull_request: env: - DISABLE_KNAPSACK: true DISABLE_KNAPSACK_PRO: false TIMEZONE: UTC COVERAGE: true @@ -18,7 +17,371 @@ permissions: contents: read jobs: - test-the-rest: + knapsack_rspec_controllers: + runs-on: ubuntu-20.04 + services: + postgres: + image: postgres:10 + ports: ["5432:5432"] + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + env: + POSTGRES_DB: open_food_network_test + POSTGRES_USER: ofn + POSTGRES_PASSWORD: f00d + strategy: + fail-fast: false + matrix: + # [n] - where the n is a number of parallel jobs you want to run your tests on. + # Use a higher number if you have slow tests to split them between more parallel jobs. + # Remember to update the value of the `ci_node_index` below to (0..n-1). + ci_node_total: [8] + # Indexes for parallel jobs (starting from zero). + # E.g. use [0, 1] for 2 parallel jobs, [0, 1, 2] for 3 parallel jobs, etc. + ci_node_index: [0, 1, 2, 3, 4, 5, 6, 7] + steps: + - uses: actions/checkout@v3 + + - name: Setup redis + uses: supercharge/redis-github-action@1.4.0 + with: + redis-version: 6 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + bundler-cache: true # runs 'bundle install' and caches installed gems automatically + + - uses: actions/setup-node@v3 + with: + node-version: 16 + + - name: Install JS dependencies + run: yarn install --frozen-lockfile + + - name: Set up database + run: | + bundle exec rake db:create + bundle exec rake db:schema:load + + - name: Run tests + + env: + KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC: 864ef557d85ea8e603e086c0387d5154 + KNAPSACK_PRO_CI_NODE_TOTAL: ${{ matrix.ci_node_total }} + KNAPSACK_PRO_CI_NODE_INDEX: ${{ matrix.ci_node_index }} + KNAPSACK_PRO_LOG_LEVEL: info + # if you use Knapsack Pro Queue Mode you must set below env variable + # to be able to retry CI build and run previously recorded tests + # https://github.com/KnapsackPro/knapsack_pro-ruby#knapsack_pro_fixed_queue_split-remember-queue-split-on-retry-ci-node + # KNAPSACK_PRO_FIXED_QUEUE_SPLIT: false + # RSpec split test files by test examples feature - it's optional + # https://knapsackpro.com/faq/question/how-to-split-slow-rspec-test-files-by-test-examples-by-individual-it + #KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES: true + KNAPSACK_PRO_TEST_FILE_PATTERN: "spec/controllers/**/*_spec.rb" + + run: | + bundle exec rake knapsack_pro:rspec + + knapsack_rspec_models: + runs-on: ubuntu-20.04 + services: + postgres: + image: postgres:10 + ports: ["5432:5432"] + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + env: + POSTGRES_DB: open_food_network_test + POSTGRES_USER: ofn + POSTGRES_PASSWORD: f00d + strategy: + fail-fast: false + matrix: + # [n] - where the n is a number of parallel jobs you want to run your tests on. + # Use a higher number if you have slow tests to split them between more parallel jobs. + # Remember to update the value of the `ci_node_index` below to (0..n-1). + ci_node_total: [7] + # Indexes for parallel jobs (starting from zero). + # E.g. use [0, 1] for 2 parallel jobs, [0, 1, 2] for 3 parallel jobs, etc. + ci_node_index: [0, 1, 2, 3, 4, 5, 6] + steps: + - uses: actions/checkout@v3 + + - name: Setup redis + uses: supercharge/redis-github-action@1.4.0 + with: + redis-version: 6 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + bundler-cache: true # runs 'bundle install' and caches installed gems automatically + + - uses: actions/setup-node@v3 + with: + node-version: 16 + + - name: Install JS dependencies + run: yarn install --frozen-lockfile + + - name: Set up database + run: | + bundle exec rake db:create + bundle exec rake db:schema:load + + - name: Run tests + + env: + KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC: 09476e2ce491c12083df62768667c674 + KNAPSACK_PRO_CI_NODE_TOTAL: ${{ matrix.ci_node_total }} + KNAPSACK_PRO_CI_NODE_INDEX: ${{ matrix.ci_node_index }} + KNAPSACK_PRO_LOG_LEVEL: info + # if you use Knapsack Pro Queue Mode you must set below env variable + # to be able to retry CI build and run previously recorded tests + # https://github.com/KnapsackPro/knapsack_pro-ruby#knapsack_pro_fixed_queue_split-remember-queue-split-on-retry-ci-node + # KNAPSACK_PRO_FIXED_QUEUE_SPLIT: false + # RSpec split test files by test examples feature - it's optional + # https://knapsackpro.com/faq/question/how-to-split-slow-rspec-test-files-by-test-examples-by-individual-it + #KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES: true + KNAPSACK_PRO_TEST_FILE_PATTERN: "spec/models/**/*_spec.rb" + + run: | + bundle exec rake knapsack_pro:rspec + + knapsack_rspec_system: + runs-on: ubuntu-20.04 + services: + postgres: + image: postgres:10 + ports: ["5432:5432"] + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + env: + POSTGRES_DB: open_food_network_test + POSTGRES_USER: ofn + POSTGRES_PASSWORD: f00d + strategy: + fail-fast: false + matrix: + # [n] - where the n is a number of parallel jobs you want to run your tests on. + # Use a higher number if you have slow tests to split them between more parallel jobs. + # Remember to update the value of the `ci_node_index` below to (0..n-1). + ci_node_total: [30] + # Indexes for parallel jobs (starting from zero). + # E.g. use [0, 1] for 2 parallel jobs, [0, 1, 2] for 3 parallel jobs, etc. + ci_node_index: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 28, 29] + steps: + - uses: actions/checkout@v3 + + - name: Setup redis + uses: supercharge/redis-github-action@1.4.0 + with: + redis-version: 6 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + bundler-cache: true # runs 'bundle install' and caches installed gems automatically + + - uses: actions/setup-node@v3 + with: + node-version: 16 + + - name: Install JS dependencies + run: yarn install --frozen-lockfile + + - name: Set up database + run: | + bundle exec rake db:create + bundle exec rake db:schema:load + + - name: Run tests + + env: + KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC: ff2456e64c9f2aa5157eb0daf711d3c3 + KNAPSACK_PRO_CI_NODE_TOTAL: ${{ matrix.ci_node_total }} + KNAPSACK_PRO_CI_NODE_INDEX: ${{ matrix.ci_node_index }} + KNAPSACK_PRO_LOG_LEVEL: info + # if you use Knapsack Pro Queue Mode you must set below env variable + # to be able to retry CI build and run previously recorded tests + # https://github.com/KnapsackPro/knapsack_pro-ruby#knapsack_pro_fixed_queue_split-remember-queue-split-on-retry-ci-node + KNAPSACK_PRO_FIXED_QUEUE_SPLIT: true + # RSpec split test files by test examples feature - it's optional + # https://knapsackpro.com/faq/question/how-to-split-slow-rspec-test-files-by-test-examples-by-individual-it + #KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES: true + KNAPSACK_PRO_TEST_FILE_PATTERN: "spec/system/**/*_spec.rb" + + run: | + bundle exec rake knapsack_pro:queue:rspec + + - name: Archive failed tests screenshots + if: failure() + uses: actions/upload-artifact@v3 + with: + name: failed-tests-screenshots + path: tmp/capybara/screenshots/*.png + retention-days: 7 + if-no-files-found: ignore + + knapsack_rspec_engines: + runs-on: ubuntu-20.04 + services: + postgres: + image: postgres:10 + ports: ["5432:5432"] + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + env: + POSTGRES_DB: open_food_network_test + POSTGRES_USER: ofn + POSTGRES_PASSWORD: f00d + strategy: + fail-fast: false + matrix: + # [n] - where the n is a number of parallel jobs you want to run your tests on. + # Use a higher number if you have slow tests to split them between more parallel jobs. + # Remember to update the value of the `ci_node_index` below to (0..n-1). + ci_node_total: [5] + # Indexes for parallel jobs (starting from zero). + # E.g. use [0, 1] for 2 parallel jobs, [0, 1, 2] for 3 parallel jobs, etc. + ci_node_index: [0, 1, 2, 3, 4] + steps: + - uses: actions/checkout@v3 + + - name: Setup redis + uses: supercharge/redis-github-action@1.4.0 + with: + redis-version: 6 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + bundler-cache: true # runs 'bundle install' and caches installed gems automatically + + - uses: actions/setup-node@v3 + with: + node-version: 16 + + - name: Install JS dependencies + run: yarn install --frozen-lockfile + + - name: Set up database + run: | + bundle exec rake db:create + bundle exec rake db:schema:load + + - name: Run tests + + env: + KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC: 09476e2ce491c12083df62768667c674 + KNAPSACK_PRO_CI_NODE_TOTAL: ${{ matrix.ci_node_total }} + KNAPSACK_PRO_CI_NODE_INDEX: ${{ matrix.ci_node_index }} + KNAPSACK_PRO_LOG_LEVEL: info + # if you use Knapsack Pro Queue Mode you must set below env variable + # to be able to retry CI build and run previously recorded tests + # https://github.com/KnapsackPro/knapsack_pro-ruby#knapsack_pro_fixed_queue_split-remember-queue-split-on-retry-ci-node + # KNAPSACK_PRO_FIXED_QUEUE_SPLIT: false + # RSpec split test files by test examples feature - it's optional + # https://knapsackpro.com/faq/question/how-to-split-slow-rspec-test-files-by-test-examples-by-individual-it + #KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES: true + KNAPSACK_PRO_TEST_FILE_PATTERN: "{spec/lib/**/*_spec.rb, spec/migrations/**/*_spec.rb, spec/serializers/**/*_spec.rb, engines/**/*_spec.rb}" + + run: | + bundle exec rake knapsack_pro:rspec + + - name: Archive failed tests screenshots + if: failure() + uses: actions/upload-artifact@v3 + with: + name: failed-tests-screenshots + path: tmp/capybara/screenshots/*.png + retention-days: 7 + if-no-files-found: ignore + + knapsack_rspec_test_the_rest: + runs-on: ubuntu-20.04 + services: + postgres: + image: postgres:10 + ports: ["5432:5432"] + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + env: + POSTGRES_DB: open_food_network_test + POSTGRES_USER: ofn + POSTGRES_PASSWORD: f00d + strategy: + fail-fast: false + matrix: + # [n] - where the n is a number of parallel jobs you want to run your tests on. + # Use a higher number if you have slow tests to split them between more parallel jobs. + # Remember to update the value of the `ci_node_index` below to (0..n-1). + ci_node_total: [5] + # Indexes for parallel jobs (starting from zero). + # E.g. use [0, 1] for 2 parallel jobs, [0, 1, 2] for 3 parallel jobs, etc. + ci_node_index: [0, 1, 2, 3, 4] + steps: + - uses: actions/checkout@v3 + + - name: Setup redis + uses: supercharge/redis-github-action@1.4.0 + with: + redis-version: 6 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + bundler-cache: true # runs 'bundle install' and caches installed gems automatically + + - uses: actions/setup-node@v3 + with: + node-version: 16 + + - name: Install JS dependencies + run: yarn install --frozen-lockfile + + - name: Set up database + run: | + bundle exec rake db:create + bundle exec rake db:schema:load + + - name: Run tests + + env: + KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC: e3b8800198d2d89b70c7edbdd85f8fd8 + KNAPSACK_PRO_CI_NODE_TOTAL: ${{ matrix.ci_node_total }} + KNAPSACK_PRO_CI_NODE_INDEX: ${{ matrix.ci_node_index }} + KNAPSACK_PRO_LOG_LEVEL: info + # if you use Knapsack Pro Queue Mode you must set below env variable + # to be able to retry CI build and run previously recorded tests + # https://github.com/KnapsackPro/knapsack_pro-ruby#knapsack_pro_fixed_queue_split-remember-queue-split-on-retry-ci-node + # KNAPSACK_PRO_FIXED_QUEUE_SPLIT: false + # RSpec split test files by test examples feature - it's optional + # https://knapsackpro.com/faq/question/how-to-split-slow-rspec-test-files-by-test-examples-by-individual-it + #KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES: true + KNAPSACK_PRO_TEST_FILE_EXCLUDE_PATTERN: "{engines/**{,/*/**}/*_spec.rb,spec/models/**{,/*/**}/*_spec.rb,spec/controllers/**{,/*/**}/*_spec.rb,spec/serializers/**{,/*/**}/*_spec.rb,spec/lib/**{,/*/**}/*_spec.rb,spec/migrations/**{,/*/**}/*_spec.rb,spec/system/**{,/*/**}/*_spec.rb}" + + + run: | + bundle exec rake knapsack_pro:rspec + + non_knapsack_jest_karma: runs-on: ubuntu-20.04 services: postgres: @@ -62,6 +425,3 @@ jobs: - name: Run jest tests run: yarn jest - - - name: Run all other tests - run: bundle exec rspec --exclude-pattern "./models/**/*_spec.rb, ./controllers/**/*_spec.rb, ./serializers/**/*_spec.rb, ./lib/**/*_spec.rb, ./migrations/**/*_spec.rb, ./system/**/*_spec.rb" diff --git a/.github/workflows/build_engines.yml b/.github/workflows/build_engines.yml deleted file mode 100644 index 50866db697..0000000000 --- a/.github/workflows/build_engines.yml +++ /dev/null @@ -1,97 +0,0 @@ -name: Build Knapsack Engines - -on: - workflow_dispatch: - push: - branches-ignore: - - 'dependabot/**' - pull_request: - -env: - DISABLE_KNAPSACK: true - DISABLE_KNAPSACK_PRO: false - TIMEZONE: UTC - COVERAGE: true - RAILS_ENV: test - -permissions: - contents: read - -jobs: - rspec: - runs-on: ubuntu-20.04 - services: - postgres: - image: postgres:10 - ports: ["5432:5432"] - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - env: - POSTGRES_DB: open_food_network_test - POSTGRES_USER: ofn - POSTGRES_PASSWORD: f00d - strategy: - fail-fast: false - matrix: - # [n] - where the n is a number of parallel jobs you want to run your tests on. - # Use a higher number if you have slow tests to split them between more parallel jobs. - # Remember to update the value of the `ci_node_index` below to (0..n-1). - ci_node_total: [10] - # Indexes for parallel jobs (starting from zero). - # E.g. use [0, 1] for 2 parallel jobs, [0, 1, 2] for 3 parallel jobs, etc. - ci_node_index: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] - steps: - - uses: actions/checkout@v3 - - - name: Setup redis - uses: supercharge/redis-github-action@1.4.0 - with: - redis-version: 6 - - - name: Set up Ruby - uses: ruby/setup-ruby@v1 - with: - bundler-cache: true # runs 'bundle install' and caches installed gems automatically - - - uses: actions/setup-node@v3 - with: - node-version: 16 - - - name: Install JS dependencies - run: yarn install --frozen-lockfile - - - name: Set up database - run: | - bundle exec rake db:create - bundle exec rake db:schema:load - - - name: Run tests - - env: - KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC: 09476e2ce491c12083df62768667c674 - KNAPSACK_PRO_CI_NODE_TOTAL: ${{ matrix.ci_node_total }} - KNAPSACK_PRO_CI_NODE_INDEX: ${{ matrix.ci_node_index }} - KNAPSACK_PRO_LOG_LEVEL: info - # if you use Knapsack Pro Queue Mode you must set below env variable - # to be able to retry CI build and run previously recorded tests - # https://github.com/KnapsackPro/knapsack_pro-ruby#knapsack_pro_fixed_queue_split-remember-queue-split-on-retry-ci-node - # KNAPSACK_PRO_FIXED_QUEUE_SPLIT: false - # RSpec split test files by test examples feature - it's optional - # https://knapsackpro.com/faq/question/how-to-split-slow-rspec-test-files-by-test-examples-by-individual-it - #KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES: true - KNAPSACK_PRO_TEST_FILE_PATTERN: "{spec/lib/**/*_spec.rb, spec/migrations/**/*_spec.rb, spec/serializers/**/*_spec.rb, engines/**/*_spec.rb}" - - run: | - bundle exec rake knapsack_pro:rspec - - - name: Archive failed tests screenshots - if: failure() - uses: actions/upload-artifact@v3 - with: - name: failed-tests-screenshots - path: tmp/capybara/screenshots/*.png - retention-days: 7 - if-no-files-found: ignore diff --git a/.github/workflows/build_knapsack_controllers.yml b/.github/workflows/build_knapsack_controllers.yml deleted file mode 100644 index bd840410f9..0000000000 --- a/.github/workflows/build_knapsack_controllers.yml +++ /dev/null @@ -1,89 +0,0 @@ -name: Build KnapSack Controllers - -on: - workflow_dispatch: - push: - branches-ignore: - - 'dependabot/**' - pull_request: - -env: - DISABLE_KNAPSACK: true - DISABLE_KNAPSACK_PRO: false - TIMEZONE: UTC - COVERAGE: true - RAILS_ENV: test - -permissions: - contents: read - -jobs: - rspec: - runs-on: ubuntu-20.04 - services: - postgres: - image: postgres:10 - ports: ["5432:5432"] - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - env: - POSTGRES_DB: open_food_network_test - POSTGRES_USER: ofn - POSTGRES_PASSWORD: f00d - strategy: - fail-fast: false - matrix: - # [n] - where the n is a number of parallel jobs you want to run your tests on. - # Use a higher number if you have slow tests to split them between more parallel jobs. - # Remember to update the value of the `ci_node_index` below to (0..n-1). - ci_node_total: [5] - # Indexes for parallel jobs (starting from zero). - # E.g. use [0, 1] for 2 parallel jobs, [0, 1, 2] for 3 parallel jobs, etc. - ci_node_index: [0, 1, 2, 3, 4] - steps: - - uses: actions/checkout@v3 - - - name: Setup redis - uses: supercharge/redis-github-action@1.4.0 - with: - redis-version: 6 - - - name: Set up Ruby - uses: ruby/setup-ruby@v1 - with: - bundler-cache: true # runs 'bundle install' and caches installed gems automatically - - - uses: actions/setup-node@v3 - with: - node-version: 16 - - - name: Install JS dependencies - run: yarn install --frozen-lockfile - - - name: Set up database - run: | - bundle exec rake db:create - bundle exec rake db:schema:load - - - name: Run tests - - env: - KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC: 864ef557d85ea8e603e086c0387d5154 - KNAPSACK_PRO_CI_NODE_TOTAL: ${{ matrix.ci_node_total }} - KNAPSACK_PRO_CI_NODE_INDEX: ${{ matrix.ci_node_index }} - KNAPSACK_PRO_LOG_LEVEL: info - # if you use Knapsack Pro Queue Mode you must set below env variable - # to be able to retry CI build and run previously recorded tests - # https://github.com/KnapsackPro/knapsack_pro-ruby#knapsack_pro_fixed_queue_split-remember-queue-split-on-retry-ci-node - # KNAPSACK_PRO_FIXED_QUEUE_SPLIT: false - # RSpec split test files by test examples feature - it's optional - # https://knapsackpro.com/faq/question/how-to-split-slow-rspec-test-files-by-test-examples-by-individual-it - #KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES: true - KNAPSACK_PRO_TEST_FILE_PATTERN: "spec/controllers/**/*_spec.rb" - - run: | - bundle exec rake knapsack_pro:rspec - diff --git a/.github/workflows/build_knapsack_models.yml b/.github/workflows/build_knapsack_models.yml deleted file mode 100644 index d3bea5daa1..0000000000 --- a/.github/workflows/build_knapsack_models.yml +++ /dev/null @@ -1,89 +0,0 @@ -name: Build KnapSack Models - -on: - workflow_dispatch: - push: - branches-ignore: - - 'dependabot/**' - pull_request: - -env: - DISABLE_KNAPSACK: true - DISABLE_KNAPSACK_PRO: false - TIMEZONE: UTC - COVERAGE: true - RAILS_ENV: test - -permissions: - contents: read - -jobs: - rspec: - runs-on: ubuntu-20.04 - services: - postgres: - image: postgres:10 - ports: ["5432:5432"] - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - env: - POSTGRES_DB: open_food_network_test - POSTGRES_USER: ofn - POSTGRES_PASSWORD: f00d - strategy: - fail-fast: false - matrix: - # [n] - where the n is a number of parallel jobs you want to run your tests on. - # Use a higher number if you have slow tests to split them between more parallel jobs. - # Remember to update the value of the `ci_node_index` below to (0..n-1). - ci_node_total: [5] - # Indexes for parallel jobs (starting from zero). - # E.g. use [0, 1] for 2 parallel jobs, [0, 1, 2] for 3 parallel jobs, etc. - ci_node_index: [0, 1, 2, 3, 4] - steps: - - uses: actions/checkout@v3 - - - name: Setup redis - uses: supercharge/redis-github-action@1.4.0 - with: - redis-version: 6 - - - name: Set up Ruby - uses: ruby/setup-ruby@v1 - with: - bundler-cache: true # runs 'bundle install' and caches installed gems automatically - - - uses: actions/setup-node@v3 - with: - node-version: 16 - - - name: Install JS dependencies - run: yarn install --frozen-lockfile - - - name: Set up database - run: | - bundle exec rake db:create - bundle exec rake db:schema:load - - - name: Run tests - - env: - KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC: 09476e2ce491c12083df62768667c674 - KNAPSACK_PRO_CI_NODE_TOTAL: ${{ matrix.ci_node_total }} - KNAPSACK_PRO_CI_NODE_INDEX: ${{ matrix.ci_node_index }} - KNAPSACK_PRO_LOG_LEVEL: info - # if you use Knapsack Pro Queue Mode you must set below env variable - # to be able to retry CI build and run previously recorded tests - # https://github.com/KnapsackPro/knapsack_pro-ruby#knapsack_pro_fixed_queue_split-remember-queue-split-on-retry-ci-node - # KNAPSACK_PRO_FIXED_QUEUE_SPLIT: false - # RSpec split test files by test examples feature - it's optional - # https://knapsackpro.com/faq/question/how-to-split-slow-rspec-test-files-by-test-examples-by-individual-it - #KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES: true - KNAPSACK_PRO_TEST_FILE_PATTERN: "spec/models/**/*_spec.rb" - - run: | - bundle exec rake knapsack_pro:rspec - diff --git a/.github/workflows/build_knapsack_system.yml b/.github/workflows/build_knapsack_system.yml deleted file mode 100644 index 44ac1496b2..0000000000 --- a/.github/workflows/build_knapsack_system.yml +++ /dev/null @@ -1,97 +0,0 @@ -name: Build Knapsack System - -on: - workflow_dispatch: - push: - branches-ignore: - - 'dependabot/**' - pull_request: - -env: - DISABLE_KNAPSACK: true - DISABLE_KNAPSACK_PRO: false - TIMEZONE: UTC - COVERAGE: true - RAILS_ENV: test - -permissions: - contents: read - -jobs: - rspec: - runs-on: ubuntu-20.04 - services: - postgres: - image: postgres:10 - ports: ["5432:5432"] - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - env: - POSTGRES_DB: open_food_network_test - POSTGRES_USER: ofn - POSTGRES_PASSWORD: f00d - strategy: - fail-fast: false - matrix: - # [n] - where the n is a number of parallel jobs you want to run your tests on. - # Use a higher number if you have slow tests to split them between more parallel jobs. - # Remember to update the value of the `ci_node_index` below to (0..n-1). - ci_node_total: [24] - # Indexes for parallel jobs (starting from zero). - # E.g. use [0, 1] for 2 parallel jobs, [0, 1, 2] for 3 parallel jobs, etc. - ci_node_index: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 23] - steps: - - uses: actions/checkout@v3 - - - name: Setup redis - uses: supercharge/redis-github-action@1.4.0 - with: - redis-version: 6 - - - name: Set up Ruby - uses: ruby/setup-ruby@v1 - with: - bundler-cache: true # runs 'bundle install' and caches installed gems automatically - - - uses: actions/setup-node@v3 - with: - node-version: 16 - - - name: Install JS dependencies - run: yarn install --frozen-lockfile - - - name: Set up database - run: | - bundle exec rake db:create - bundle exec rake db:schema:load - - - name: Run tests - - env: - KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC: ff2456e64c9f2aa5157eb0daf711d3c3 - KNAPSACK_PRO_CI_NODE_TOTAL: ${{ matrix.ci_node_total }} - KNAPSACK_PRO_CI_NODE_INDEX: ${{ matrix.ci_node_index }} - KNAPSACK_PRO_LOG_LEVEL: info - # if you use Knapsack Pro Queue Mode you must set below env variable - # to be able to retry CI build and run previously recorded tests - # https://github.com/KnapsackPro/knapsack_pro-ruby#knapsack_pro_fixed_queue_split-remember-queue-split-on-retry-ci-node - KNAPSACK_PRO_FIXED_QUEUE_SPLIT: true - # RSpec split test files by test examples feature - it's optional - # https://knapsackpro.com/faq/question/how-to-split-slow-rspec-test-files-by-test-examples-by-individual-it - #KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES: true - KNAPSACK_PRO_TEST_FILE_PATTERN: "spec/system/**/*_spec.rb" - - run: | - bundle exec rake knapsack_pro:queue:rspec - - - name: Archive failed tests screenshots - if: failure() - uses: actions/upload-artifact@v3 - with: - name: failed-tests-screenshots - path: tmp/capybara/screenshots/*.png - retention-days: 7 - if-no-files-found: ignore diff --git a/.github/workflows/build_knapsack_test_the_rest.yml b/.github/workflows/build_knapsack_test_the_rest.yml deleted file mode 100644 index 3cb7fe1f1e..0000000000 --- a/.github/workflows/build_knapsack_test_the_rest.yml +++ /dev/null @@ -1,90 +0,0 @@ -name: Build Knapsack test-the-rest - -on: - workflow_dispatch: - push: - branches-ignore: - - 'dependabot/**' - pull_request: - -env: - DISABLE_KNAPSACK: true - DISABLE_KNAPSACK_PRO: false - TIMEZONE: UTC - COVERAGE: true - RAILS_ENV: test - -permissions: - contents: read - -jobs: - rspec: - runs-on: ubuntu-20.04 - services: - postgres: - image: postgres:10 - ports: ["5432:5432"] - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - env: - POSTGRES_DB: open_food_network_test - POSTGRES_USER: ofn - POSTGRES_PASSWORD: f00d - strategy: - fail-fast: false - matrix: - # [n] - where the n is a number of parallel jobs you want to run your tests on. - # Use a higher number if you have slow tests to split them between more parallel jobs. - # Remember to update the value of the `ci_node_index` below to (0..n-1). - ci_node_total: [10] - # Indexes for parallel jobs (starting from zero). - # E.g. use [0, 1] for 2 parallel jobs, [0, 1, 2] for 3 parallel jobs, etc. - ci_node_index: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] - steps: - - uses: actions/checkout@v3 - - - name: Setup redis - uses: supercharge/redis-github-action@1.4.0 - with: - redis-version: 6 - - - name: Set up Ruby - uses: ruby/setup-ruby@v1 - with: - bundler-cache: true # runs 'bundle install' and caches installed gems automatically - - - uses: actions/setup-node@v3 - with: - node-version: 16 - - - name: Install JS dependencies - run: yarn install --frozen-lockfile - - - name: Set up database - run: | - bundle exec rake db:create - bundle exec rake db:schema:load - - - name: Run tests - - env: - KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC: e3b8800198d2d89b70c7edbdd85f8fd8 - KNAPSACK_PRO_CI_NODE_TOTAL: ${{ matrix.ci_node_total }} - KNAPSACK_PRO_CI_NODE_INDEX: ${{ matrix.ci_node_index }} - KNAPSACK_PRO_LOG_LEVEL: info - # if you use Knapsack Pro Queue Mode you must set below env variable - # to be able to retry CI build and run previously recorded tests - # https://github.com/KnapsackPro/knapsack_pro-ruby#knapsack_pro_fixed_queue_split-remember-queue-split-on-retry-ci-node - # KNAPSACK_PRO_FIXED_QUEUE_SPLIT: false - # RSpec split test files by test examples feature - it's optional - # https://knapsackpro.com/faq/question/how-to-split-slow-rspec-test-files-by-test-examples-by-individual-it - #KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES: true - KNAPSACK_PRO_TEST_FILE_EXCLUDE_PATTERN: "{engines/**{,/*/**}/*_spec.rb,spec/models/**{,/*/**}/*_spec.rb,spec/controllers/**{,/*/**}/*_spec.rb,spec/serializers/**{,/*/**}/*_spec.rb,spec/lib/**{,/*/**}/*_spec.rb,spec/migrations/**{,/*/**}/*_spec.rb,spec/system/**{,/*/**}/*_spec.rb}" - - - run: | - bundle exec rake knapsack_pro:rspec - From c4e75dc5571f8c972e017245c44f9769f6110d6d Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Mon, 21 Nov 2022 14:55:19 +0100 Subject: [PATCH 24/24] Removes knapsack non-pro --- Gemfile | 1 - Gemfile.lock | 3 --- Rakefile | 3 --- spec/spec_helper.rb | 8 -------- 4 files changed, 15 deletions(-) diff --git a/Gemfile b/Gemfile index 46d81be700..bbf06ea0b7 100644 --- a/Gemfile +++ b/Gemfile @@ -152,7 +152,6 @@ group :test, :development do gem "factory_bot_rails", '6.2.0', require: false gem 'fuubar', '~> 2.5.1' gem 'json_spec', '~> 1.1.4' - gem 'knapsack', require: false gem 'knapsack_pro' gem 'letter_opener', '>= 1.4.1' gem 'rspec-rails', ">= 3.5.2" diff --git a/Gemfile.lock b/Gemfile.lock index 3515da5d56..e2b0ff7d0d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -375,8 +375,6 @@ GEM jsonapi-serializer (2.2.0) activesupport (>= 4.2) jwt (2.5.0) - knapsack (4.0.0) - rake knapsack_pro (3.4.1) rake launchy (2.5.0) @@ -820,7 +818,6 @@ DEPENDENCIES json_spec (~> 1.1.4) jsonapi-serializer jwt (~> 2.3) - knapsack knapsack_pro letter_opener (>= 1.4.1) listen diff --git a/Rakefile b/Rakefile index e37edbf5b4..3a8f4a342c 100755 --- a/Rakefile +++ b/Rakefile @@ -8,6 +8,3 @@ require_relative 'config/application' Openfoodnetwork::Application.load_tasks -if !ENV['DISABLE_KNAPSACK'] && defined?(Knapsack) - Knapsack.load_tasks -end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index c9bee1d80e..4b76dbb9be 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -5,14 +5,6 @@ require 'base_spec_helper' require 'database_cleaner' require 'view_component/test_helpers' -# This spec_helper.rb is being used by the custom engines in engines/. The engines are not set up to -# use Knapsack, and this provides the option to disable it when running the tests in CI services. -unless ENV['DISABLE_KNAPSACK'] - require 'knapsack' - Knapsack.tracker.config(enable_time_offset_warning: false) unless ENV['CI'] - Knapsack::Adapters::RSpecAdapter.bind -end - Capybara.javascript_driver = :chrome Capybara.default_max_wait_time = 30 Capybara.disable_animation = true