-
Notifications
You must be signed in to change notification settings - Fork 15
/
upload_artifacts.sh
executable file
·85 lines (72 loc) · 3.42 KB
/
upload_artifacts.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/bin/bash
if [ "$TEST_SUITE" = "SystemTests" ] || [ "$TEST_SUITE" = "PluginTests" ] || [ "$TEST_SUITE" = "SystemTestsCore" ] || [ "$TEST_SUITE" = "SystemTestsPlugins" ];
then
echo "Uploading artifacts for $TEST_SUITE..."
if [ "$TEST_SUITE" = "SystemTestsCore" ];
then
url="https://builds-artifacts.matomo.org/build?auth_key=$ARTIFACTS_PASS&repo=$TRAVIS_REPO_SLUG&artifact_name=system&branch=$TRAVIS_BRANCH&build_id=$TRAVIS_BUILD_NUMBER"
tar -cjf processed.tar.bz2 tests/PHPUnit/System/processed/* --exclude='.gitkeep' --transform 's/.*\///'
else
if [ "$TEST_SUITE" = "PluginTests" ];
then
url="https://builds-artifacts.matomo.org/build?auth_key=$ARTIFACTS_PASS&repo=$TRAVIS_REPO_SLUG&artifact_name=system&branch=$TRAVIS_BRANCH&build_id=$TRAVIS_BUILD_NUMBER"
if [ "$PROTECTED_ARTIFACTS" = "1" ];
then
echo "Artifacts will be protected (premium plugin)..."
url="$url&protected=1"
fi
tar -cjf processed.tar.bz2 plugins/$PLUGIN_NAME/tests/System/processed/* --exclude='.gitkeep' --transform "s/plugins\/$PLUGIN_NAME\/tests\/System\/processed\///"
else
url="https://builds-artifacts.matomo.org/build?auth_key=$ARTIFACTS_PASS&repo=$TRAVIS_REPO_SLUG&artifact_name=system.plugin&branch=$TRAVIS_BRANCH&build_id=$TRAVIS_BUILD_NUMBER"
tar -cjf processed.tar.bz2 plugins/*/tests/System/processed/* --exclude='.gitkeep' --transform 's/plugins\///g' --transform 's/\/tests\/System\/processed\//~~/'
fi
fi
# upload processed tarball
curl -X POST --data-binary @processed.tar.bz2 "$url"
else
if [ "$TEST_SUITE" = "UITests" ];
then
url_base="https://builds-artifacts.matomo.org/build?auth_key=$ARTIFACTS_PASS&repo=$TRAVIS_REPO_SLUG&build_id=$TRAVIS_BUILD_NUMBER&build_entity_id=$TRAVIS_BUILD_ID&branch=$TRAVIS_BRANCH"
if [ -n "$PLUGIN_NAME" ];
then
if [ "$PROTECTED_ARTIFACTS" = "1" ];
then
echo "Artifacts will be protected (premium plugin)..."
url_base="$url_base&protected=1"
fi
fi
echo "Uploading artifacts for $TEST_SUITE..."
base_dir=`pwd`
if [ -n "$PLUGIN_NAME" ];
then
if [ -d "./plugins/$PLUGIN_NAME/Test/UI" ]; then
cd "./plugins/$PLUGIN_NAME/Test/UI"
else
cd "./plugins/$PLUGIN_NAME/tests/UI"
fi
else
cd ./tests/UI
fi
echo "[NOTE] Processed Screenshots:"
ls processed-ui-screenshots
echo ""
# upload processed tarball
tar -cjf processed-ui-screenshots.tar.bz2 processed-ui-screenshots --exclude='.gitkeep'
curl -X POST --data-binary @processed-ui-screenshots.tar.bz2 "$url_base&artifact_name=processed-screenshots"
# upload diff tarball if it exists
cd $base_dir/tests/UI
if [ -d "./screenshot-diffs" ];
then
echo "Uploading artifacts..."
echo "[NOTE] screenshot diff dir:"
echo "`pwd`/screenshot-diffs"
echo "[NOTE] uploading following diffs:"
ls screenshot-diffs
tar -cjf screenshot-diffs.tar.bz2 screenshot-diffs
curl -X POST --data-binary @screenshot-diffs.tar.bz2 "$url_base&artifact_name=screenshot-diffs"
fi
else
echo "No artifacts for $TEST_SUITE tests."
exit
fi
fi