From 7e951d4af22ebfc18f72f8c3b0d971e105cb8633 Mon Sep 17 00:00:00 2001 From: David Cook Date: Mon, 29 Apr 2024 17:12:38 +1000 Subject: [PATCH] Revert "Separate controllers requiring webpack for testing" Arrgh it's not so simple. It looks like both rspec and knapsack use glob for the pattern, so the pattern needs updating. Hmm that might not be too bad, but it makes it even less manageable. Considering the system specs are a much bigger bottleneck, I'm going to avoid spending more time here. --- .github/workflows/build.yml | 61 ++++++------------------------------- 1 file changed, 10 insertions(+), 51 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 95f9178b80..1b553c7b74 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -38,10 +38,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: [7] + 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] + ci_node_index: [0, 1, 2, 3, 4, 5, 6, 7] steps: - uses: actions/checkout@v3 @@ -55,6 +55,14 @@ jobs: with: bundler-cache: true # runs 'bundle install' and caches installed gems automatically + # JS is required in order for webpacker to compile, in order to render templates containing image urls + - uses: actions/setup-node@v3 + with: + node-version-file: .node-version + + - name: Install JS dependencies + run: yarn install --frozen-lockfile + - name: Set up database run: | bundle exec rake db:create db:schema:load @@ -73,59 +81,10 @@ 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 KNAPSACK_PRO_TEST_FILE_PATTERN: "{spec/controllers/**/*_spec.rb}" - KNAPSACK_PRO_TEST_FILE_EXCLUDE_PATTERN: "user_passwords_controller_spec|orders_controller_spec|mail_methods_controller_spec|groups_controller_spec|shops_controller_spec|payments_controller_spec" run: | git show --no-patch # the commit being tested (which is often a merge due to actions/checkout@v3) bundle exec rake knapsack_pro:rspec - # Controllers that render views with css or image links will need webpack - controllers_incl_webpack: - runs-on: ubuntu-22.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 - 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-file: .node-version - - - name: Install JS dependencies - run: yarn install --frozen-lockfile - - - name: Set up database - run: | - bundle exec rake db:create db:schema:load - - - name: Run tests - env: - # Copied from KNAPSACK_PRO_TEST_FILE_EXCLUDE_PATTERN above - INCLUDE_PATTERN: "user_passwords_controller_spec|orders_controller_spec|mail_methods_controller_spec|groups_controller_spec|shops_controller_spec|payments_controller_spec" - run: | - git show --no-patch # the commit being tested (which is often a merge due to actions/checkout@v3) - bundle exec rspec spec/controllers/**/*_spec.rb --pattern="$INCLUDE_PATTERN" - models: runs-on: ubuntu-22.04 services: