Skip to content

Commit

Permalink
Update CircleCI config: fix missing report file when build failed
Browse files Browse the repository at this point in the history
  • Loading branch information
Khang-NT committed Mar 8, 2018
1 parent 8351116 commit 277ffc3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
6 changes: 6 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ jobs:
- run:
name: Test - Build - Publish
command: ./.circleci/test_build_publish.sh
- run:
name: Copy report when build failed
command: |
if ! test "$(ls -A artifacts)"; then
./copy_artifacts.sh;
fi;
- store_artifacts:
path: artifacts

Expand Down
26 changes: 14 additions & 12 deletions copy_artifacts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,24 @@
set -e

currentDir=$(pwd)
artifact_folder="$currentDir/artifacts"; mkdir ${artifact_folder}
apk_folder="$artifact_folder/apks"; mkdir ${apk_folder}
mapping_folder="$artifact_folder/mappings"; mkdir ${mapping_folder}
report_folder="$artifact_folder/reports"; mkdir ${report_folder}
artifact_folder="$currentDir/artifacts"; mkdir -p ${artifact_folder}
apk_folder="$artifact_folder/apks"; mkdir -p ${apk_folder}
mapping_folder="$artifact_folder/mappings"; mkdir -p ${mapping_folder}
report_folder="$artifact_folder/reports"; mkdir -p ${report_folder}

for path in $(find app/build/outputs/apk -name '*.apk');
do
cp ${path} ${apk_folder}
cp ${path} ${apk_folder}
done

pushd app/build/outputs/mapping
for path in $(find . -name 'mapping.txt');
do
mkdir -p $(dirname "$mapping_folder/$path")
cp ${path} "$mapping_folder/$path"
done
popd
if [ -d app/build/outputs/mapping ]; then
pushd app/build/outputs/mapping
for path in $(find . -name 'mapping.txt');
do
mkdir -p $(dirname "$mapping_folder/$path")
cp ${path} "$mapping_folder/$path"
done
popd
fi

cp -r app/build/reports/* ${report_folder}

0 comments on commit 277ffc3

Please sign in to comment.