Skip to content

Commit

Permalink
Copy all test results to specified directory
Browse files Browse the repository at this point in the history
This was necessary because CircleCI was trying to read from other
directories containing XML files like .idea and pnpm. These were not
tests results. While using the find command feels a bit awkward,
store_test_results does not appear to have glob, ignore, or support for
multiple paths.

This shell script trickery is the documented method described in the
docs. https://circleci.com/docs/collect-test-data/#gradle-junit-test-results

It's awkward, but it works.
  • Loading branch information
jonnybot0 committed Oct 4, 2024
1 parent 648fae9 commit f58d9ef
Showing 1 changed file with 48 additions and 8 deletions.
56 changes: 48 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,13 @@ jobs:
- gradle-home-check-master
- gradle-home-check
- run: ./gradlew --no-daemon --max-workers 4 --parallel -Pci module:check internal:check integration:check doc:site:check --continue
- run:
name: Copy all test results to a directory
command: |
mkdir -p ~/test-results/junit/
find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} ~/test-results/junit/ \;
- store_test_results:
path: .
path: ~/test-results/
- store_artifacts:
path: build/reports
- save_cache:
Expand All @@ -38,8 +43,13 @@ jobs:
command: |
export WORKING_DIRECTORY=`pwd`
docker run -v ${WORKING_DIRECTORY}:${WORKING_DIRECTORY} -v /var/run/docker.sock:/var/run/docker.sock -w ${WORKING_DIRECTORY} -e OCI_WRITER_KEY_PASSPHRASE=$OCI_WRITER_KEY_PASSPHRASE gebish/ci:v7 /bin/bash -c "Xvfb :99 -screen 1 1280x1024x16 -nolisten tcp -fbdir /var/run > /dev/null 2>&1 & export DISPLAY=:99 ; GRADLE_OPTS=\"-Xmx1024m -XX:MaxMetaspaceSize=256m\" GRADLE_USER_HOME=\".gradle-home\" ./gradlew --no-daemon --max-workers 4 --parallel -Pci :doc:manual-snippets:check :doc:manual-snippets:fixtures:check :doc:manual-snippets:real-browser:check :doc:manual:build :doc:asciidoctor-extension:check"
- run:
name: Copy all test results to a directory
command: |
mkdir -p ~/test-results/junit/
find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} ~/test-results/junit/ \;
- store_test_results:
path: .
path: ~/test-results/
- store_artifacts:
path: build/reports
- save_cache:
Expand All @@ -61,8 +71,13 @@ jobs:
command: |
export WORKING_DIRECTORY=`pwd`
docker run -v ${WORKING_DIRECTORY}:${WORKING_DIRECTORY} -v /var/run/docker.sock:/var/run/docker.sock -w ${WORKING_DIRECTORY} -e OCI_WRITER_KEY_PASSPHRASE=$OCI_WRITER_KEY_PASSPHRASE gebish/ci:v7 /bin/bash -c "GRADLE_OPTS=\"-Xmx1024m -XX:MaxMetaspaceSize=256m\" GRADLE_USER_HOME=\".gradle-home\" ./gradlew --no-daemon --max-workers 4 --parallel -Pci allDockerisedCrossBrowserTests"
- run:
name: Copy all test results to a directory
command: |
mkdir -p ~/test-results/junit/
find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} ~/test-results/junit/ \;
- store_test_results:
path: .
path: ~/test-results/
- store_artifacts:
path: build/reports
- save_cache:
Expand All @@ -84,8 +99,13 @@ jobs:
- gradle-home-local-crossbrowser-master
- gradle-home-local-crossbrowser
- run: ./gradlew --no-daemon --max-workers 4 --parallel -p module -Pci localChromeTest
- run:
name: Copy all test results to a directory
command: |
mkdir -p ~/test-results/junit/
find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} ~/test-results/junit/ \;
- store_test_results:
path: .
path: ~/test-results/
- store_artifacts:
path: build/reports
- save_cache:
Expand All @@ -109,8 +129,13 @@ jobs:
- run:
command: |
./gradlew --no-daemon -Pci --max-workers 5 --parallel allSauceLabsTests
- run:
name: Copy all test results to a directory
command: |
mkdir -p ~/test-results/junit/
find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} ~/test-results/junit/ \;
- store_test_results:
path: .
path: ~/test-results/
- store_artifacts:
path: build/reports
- save_cache:
Expand All @@ -134,8 +159,13 @@ jobs:
- run:
command: |
./gradlew --no-daemon -Pci --max-workers 5 --parallel allLambdaTestTests
- run:
name: Copy all test results to a directory
command: |
mkdir -p ~/test-results/junit/
find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} ~/test-results/junit/ \;
- store_test_results:
path: .
path: ~/test-results/
- store_artifacts:
path: build/reports
- save_cache:
Expand All @@ -159,8 +189,13 @@ jobs:
- run:
command: |
./gradlew --no-daemon -Pci --max-workers 5 --parallel nonIeBrowserStackTests
- run:
name: Copy all test results to a directory
command: |
mkdir -p ~/test-results/junit/
find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} ~/test-results/junit/ \;
- store_test_results:
path: .
path: ~/test-results/
- store_artifacts:
path: build/reports
- save_cache:
Expand All @@ -184,8 +219,13 @@ jobs:
- run:
command: |
./gradlew --no-daemon -Pci --max-workers 5 --parallel ieBrowserStackTests
- run:
name: Copy all test results to a directory
command: |
mkdir -p ~/test-results/junit/
find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} ~/test-results/junit/ \;
- store_test_results:
path: .
path: ~/test-results/
- store_artifacts:
path: build/reports
- save_cache:
Expand Down

0 comments on commit f58d9ef

Please sign in to comment.