Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Enable rerunning of failed rspec tests in CircleCI #5904

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
63 changes: 49 additions & 14 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ references:
paths:
- cc-test-reporter

_persist-coverage: &persist-coverage
persist_to_workspace:
root: tmp
paths:
- coverage

_wait-for-db: &wait-for-db
run:
name: Wait for DB
Expand Down Expand Up @@ -191,18 +197,28 @@ commands:
name: Run rspec tests
command: |
tmp/cc-test-reporter before-build
TESTFILES=$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings --timings-type=filename)

bundle exec rspec --format progress \
--format RspecJunitFormatter \
-o /tmp/test-results/rspec/rspec.xml \
-- ${TESTFILES}
circleci tests glob "spec/**/*_spec.rb" \
| circleci tests run --command="xargs bundle exec rspec \
--format progress \
--format RspecJunitFormatter \
-o /tmp/test-results/rspec/rspec.xml" \
--split-by=timings \
--timings-type=filename

tmp/cc-test-reporter format-coverage -t simplecov -o "tmp/coverage/codeclimate.$CIRCLE_NODE_INDEX.json"
- store_artifacts:
path: tmp/coverage
- persist_to_workspace:
root: tmp
paths:
- coverage/codeclimate.*.json
# Save the coverage for rerunning failed tests. CircleCI will skip saving if this revision key has already been saved.
- save_cache:
key: coverage-{{.Revision}}-{{.Environment.CIRCLE_NODE_INDEX}}
paths:
- tmp/coverage/codeclimate.*.json
when: always
- store_artifacts:
path: tmp/coverage
- store_test_results:
Expand Down Expand Up @@ -395,6 +411,7 @@ jobs:
- *create-tmp-dir
- *install-codeclimate
- *persist-codeclimate
- *persist-coverage
- build-base

smoke-test:
Expand All @@ -420,6 +437,24 @@ jobs:
parallelism: 6
steps:
- checkout
- *attach-tmp-workspace
- restore_cache:
key: coverage-{{.Revision}}-{{.Environment.CIRCLE_NODE_INDEX}}
- run:
command: |
ls tmp
ls tmp/coverage
- persist_to_workspace:
root: tmp
paths:
- coverage
- run:
name: Halt if no tests to run
command: |
mkdir -p ./tmp && \
>./tmp/tests.txt && \
circleci tests glob "spec/**/*_spec.rb" | circleci tests run --command ">./tmp/tests.txt xargs echo" --split-by=timings
[ -s tmp/tests.txt ] || circleci-agent step halt
- build-base
- *wait-for-db
- *load-db
Expand Down Expand Up @@ -463,7 +498,7 @@ jobs:
- run:
name: Upload coverage results to Code Climate
command: |
tmp/cc-test-reporter sum-coverage --output - --parts 6 tmp/coverage/codeclimate.*.json | tmp/cc-test-reporter upload-coverage --input -
tmp/cc-test-reporter sum-coverage --output - --parts 6 tmp/coverage/codeclimate.*.json | tmp/cc-test-reporter upload-coverage --debug --input -

build-app-container:
executor: cloud-platform-executor
Expand Down Expand Up @@ -613,20 +648,20 @@ workflows:
branches:
ignore:
- master
- other-tests:
requires:
- build-test-container
# - other-tests:
# requires:
# - build-test-container
- rspec-tests:
requires:
- build-test-container
- cucumber-tests:
requires:
- build-test-container
# - cucumber-tests:
# requires:
# - build-test-container
- upload-coverage:
requires:
- rspec-tests
- cucumber-tests
- other-tests
# - cucumber-tests
# - other-tests

build-deploy-branch:
jobs:
Expand Down
16 changes: 0 additions & 16 deletions spec/api/entities/base_fee_type_spec.rb

This file was deleted.

10 changes: 0 additions & 10 deletions spec/api/entities/case_stage_spec.rb

This file was deleted.

10 changes: 0 additions & 10 deletions spec/api/entities/case_worker_spec.rb

This file was deleted.

23 changes: 0 additions & 23 deletions spec/api/entities/cclf/adapted_disbursement_spec.rb

This file was deleted.

23 changes: 0 additions & 23 deletions spec/api/entities/cclf/adapted_expense_spec.rb

This file was deleted.

22 changes: 0 additions & 22 deletions spec/api/entities/cclf/adapted_fixed_fee_spec.rb

This file was deleted.

31 changes: 0 additions & 31 deletions spec/api/entities/cclf/adapted_graduated_fee_spec.rb

This file was deleted.

27 changes: 0 additions & 27 deletions spec/api/entities/cclf/adapted_hardship_fee_spec.rb

This file was deleted.

77 changes: 0 additions & 77 deletions spec/api/entities/cclf/adapted_interim_fee_spec.rb

This file was deleted.

22 changes: 0 additions & 22 deletions spec/api/entities/cclf/adapted_misc_fee_spec.rb

This file was deleted.

Loading