Skip to content

Commit

Permalink
Separate controllers requiring webpack for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
dacook committed Apr 29, 2024
1 parent f992fb1 commit e19aeef
Showing 1 changed file with 49 additions and 8 deletions.
57 changes: 49 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,6 @@ 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
Expand All @@ -81,10 +73,59 @@ 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:
Expand Down

0 comments on commit e19aeef

Please sign in to comment.