I tried using CircleCI 2.0 for Java automatic test execution, but the official document method resulted in permission denied at mkdir
, so make a note of the corresponding procedure. (Maybe I made a mistake in the document or lacked information ...)
Collecting Test Metadata - CircleCI
Official documentation method
steps:
- run: |
mkdir -p /junit/
find . -type f -regex ".*/target/surefire-reports/.*xml" -exec cp {} /junit/ \;
- store_test_results:
path: /junit
- store_artifacts:
path: /junit
How to fix(Created under a directory in the workspace, not from the root directory)
- run: |
mkdir -p ~/repo/junit/
find . -type f -regex ".*/target/surefire-reports/.*xml" -exec cp {} ~/repo/junit/ \;
- store_test_results:
path: ~/repo/junit
- store_artifacts:
path: ~/repo/junit
When 1.0 has $ CIRCLE_TEST_REPORTS
and specify that I was doing it, but it seems that this environment variable has been deleted when it is 2.0.
.Circleci / config.yml
for Java 8 environmentSince it is only the aggregated part of the test, I will also post the full text of the settings verified this time. (I just added a test aggregation task for Maven to the sample)
# Java Maven CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-java/ for more details
#
version: 2
jobs:
build:
docker:
# specify the version you desire here
- image: circleci/openjdk:8-jdk
# 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: circleci/postgres:9.4
working_directory: ~/repo
environment:
# Customize the JVM maximum heap limit
MAVEN_OPTS: -Xmx3200m
steps:
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "pom.xml" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run: mvn dependency:go-offline
- save_cache:
paths:
- ~/.m2
key: v1-dependencies-{{ checksum "pom.xml" }}
# run tests!
- run: mvn integration-test
- run: |
mkdir -p ~/repo/junit/
find . -type f -regex ".*/target/surefire-reports/.*xml" -exec cp {} ~/repo/junit/ \;
- store_test_results:
path: ~/repo/junit
- store_artifacts:
path: ~/repo/junit
Recommended Posts