From bf248ac60f7c5ed404f117b94f6119bde44386e4 Mon Sep 17 00:00:00 2001 From: Shelley Nason Date: Thu, 29 Jan 2026 17:01:08 -0500 Subject: [PATCH 1/3] Configure to support CircleCI 'rerun failed tests'. (#1956) --- .circleci/config.yml | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index d73602fe4..33f624f17 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -119,13 +119,16 @@ jobs: name: Run tests command: | mkdir /tmp/test-results - TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)" + TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb")" + echo "$TEST_FILES" | circleci tests run --verbose --split-by=timings \ + --command="bundle exec rspec --format progress --format RspecJunitFormatter --out /tmp/test-results/rspec.xml" + + # collect test reports + - store_test_results: + path: /tmp/test-results + - store_artifacts: + path: coverage - bundle exec rspec --format progress \ - --format RspecJunitFormatter \ - --out /tmp/test-results/rspec.xml \ - --format progress \ - $TEST_FILES # Install Cloud Foundry cli (cf) before deploy step. cf is used to push to Cloud.gov - run: name: Install-cf-cli @@ -136,12 +139,6 @@ jobs: sudo apt-get update sudo apt-get install -y cf8-cli cf -v - # collect reports - - store_test_results: - path: /tmp/test-results - - store_artifacts: - path: coverage - - run: name: Deploy Sidekiq worker servers command: | From cf85ac18eb901daa072733cd00f61587a9fe58d2 Mon Sep 17 00:00:00 2001 From: Shelley Nason Date: Fri, 30 Jan 2026 15:14:04 -0500 Subject: [PATCH 2/3] Split deployment workflow into build-test-deploy jobs. (#1958) --- .circleci/config.yml | 99 ++++++++++++++++++++++++-------------------- 1 file changed, 55 insertions(+), 44 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 33f624f17..3351dee66 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -12,38 +12,13 @@ version: 2.1 jobs: build: docker: - - image: cimg/ruby:3.2.8-browsers # Matches deployed Ruby version in CF - environment: - RAILS_ENV: test - PGHOST: 127.0.0.1 - PGUSER: root - - - image: cimg/redis:7.2.7 - environment: - REDIS_URL: redis://redis:6379/1 - - # Specify service dependencies here if necessary - # CircleCI maintains a library of pre-built images - # documented at https://circleci.com/docs/2.0/circleci-images/ - - image: cimg/postgres:15.8 - environment: - POSTGRES_USER: root - POSTGRES_DB: touchpoints_test - - parallelism: 4 - working_directory: ~/repo + - image: cimg/ruby:3.2.8-node # Matches deployed Ruby version in CF steps: - run: name: Update packages command: sudo apt-get update - - run: - name: Ensure Chrome is available - command: | - # cimg/ruby:*-browsers images already include Chrome; skip orb command to avoid "Cannot find declaration" errors - echo "Using cimg/ruby:3.4.7-browsers which includes Chrome" - - checkout - run: @@ -94,25 +69,59 @@ jobs: # Download and cache dependencies - restore_cache: keys: - - v1-bundle-{{ checksum "Gemfile.lock" }} + - v3-bundle-{{ checksum "Gemfile.lock" }} - - run: bundle install + - run: + name: Install gems + command: | + bundle config set deployment true + bundle install - save_cache: paths: - ./vendor/bundle - key: v1-bundle-{{ checksum "Gemfile.lock" }} - - # Database setup - - run: bundle exec rake db:create - - run: bundle exec rake db:schema:load + key: v3-bundle-{{ checksum "Gemfile.lock" }} # Precompile assets (to use npm packages specified in assets.rb) - run: name: Precompile assets command: | npm i - rails assets:precompile + bundle exec rails assets:precompile + + - persist_to_workspace: + root: . + paths: + - . + + test: + docker: + - image: cimg/ruby:3.2.8-browsers # Matches deployed Ruby version in CF + environment: + RAILS_ENV: test + PGHOST: 127.0.0.1 + PGUSER: root + + - image: cimg/redis:7.2.7 + environment: + REDIS_URL: redis://redis:6379/1 + + # Specify service dependencies here if necessary + # CircleCI maintains a library of pre-built images + # documented at https://circleci.com/docs/2.0/circleci-images/ + - image: cimg/postgres:15.8 + environment: + POSTGRES_USER: root + POSTGRES_DB: touchpoints_test + + parallelism: 4 + steps: + - attach_workspace: + at: . + + # Database setup + - run: bundle exec rake db:create + - run: bundle exec rake db:schema:load # run tests! - run: @@ -129,6 +138,12 @@ jobs: - store_artifacts: path: coverage + deploy: + docker: + - image: cimg/base:2025.01 + steps: + - attach_workspace: + at: . # Install Cloud Foundry cli (cf) before deploy step. cf is used to push to Cloud.gov - run: name: Install-cf-cli @@ -142,11 +157,6 @@ jobs: - run: name: Deploy Sidekiq worker servers command: | - # Only deploy from a single parallel node to avoid concurrent CF pushes. - if [ "${CIRCLE_NODE_INDEX:-0}" != "0" ]; then - echo "Skipping Sidekiq deploy on parallel node ${CIRCLE_NODE_INDEX}" - exit 0 - fi # Keep prebuilt Rust library - extconf.rb builds it during bundle install with correct paths # The library is built with rutie which properly links against the CF Ruby installation # echo "Removing prebuilt Rust library (will be rebuilt on CF)..." @@ -158,11 +168,6 @@ jobs: - run: name: Deploy web server(s) command: | - # Only deploy from a single parallel node to avoid concurrent CF pushes. - if [ "${CIRCLE_NODE_INDEX:-0}" != "0" ]; then - echo "Skipping web deploy on parallel node ${CIRCLE_NODE_INDEX}" - exit 0 - fi # Wait for Sidekiq deployment to complete before starting web deploy sleep 120 # Keep prebuilt Rust library - extconf.rb builds it during bundle install with correct paths @@ -206,3 +211,9 @@ workflows: build-deploy: jobs: - build + - test: + requires: + - build + - deploy: + requires: + - test From d6e2b39f965230266acd0456c41585a03fc78544 Mon Sep 17 00:00:00 2001 From: Shelley Nason Date: Fri, 30 Jan 2026 16:35:25 -0500 Subject: [PATCH 3/3] Fix test splitting. (#1959) --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3351dee66..ef865aa6c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -130,7 +130,7 @@ jobs: mkdir /tmp/test-results TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb")" echo "$TEST_FILES" | circleci tests run --verbose --split-by=timings \ - --command="bundle exec rspec --format progress --format RspecJunitFormatter --out /tmp/test-results/rspec.xml" + --command="xargs bundle exec rspec --format progress --format RspecJunitFormatter --out /tmp/test-results/rspec.xml" # collect test reports - store_test_results: