Skip to content
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.

Add upload only for bash uploader #403

Merged
merged 36 commits into from
Jan 27, 2021
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
c950269
Attempt Ruby coverage upload
thomasrockhu Jan 25, 2021
3a3096c
Adapt Ruby gem
thomasrockhu Jan 25, 2021
126a5aa
Ensure the right gem
thomasrockhu Jan 25, 2021
51a7227
Bump simplecov
thomasrockhu Jan 25, 2021
6938eed
0.18.5 simplecov
thomasrockhu Jan 25, 2021
d9b41c5
Maybe this works
thomasrockhu Jan 25, 2021
2a6e213
Update gem
thomasrockhu Jan 25, 2021
1cbf73b
Use global Simplecov
thomasrockhu Jan 25, 2021
f141c0c
New gem
thomasrockhu Jan 25, 2021
7492df8
New gem, now with files
thomasrockhu Jan 25, 2021
5a6c2fa
Global
thomasrockhu Jan 25, 2021
5109e1f
Upload
thomasrockhu Jan 25, 2021
15d2a31
verbose
thomasrockhu Jan 25, 2021
e796d77
better option
thomasrockhu Jan 25, 2021
a3d7ca4
Merge branch 'master' into use-ruby-formatter
thomasrockhu Jan 25, 2021
2f8e748
Update SHAs
thomasrockhu Jan 25, 2021
8448a53
Move back the N
thomasrockhu Jan 25, 2021
40583d1
m not z
thomasrockhu Jan 25, 2021
92317bf
I am dumb
thomasrockhu Jan 25, 2021
7b2224f
Update code
thomasrockhu Jan 25, 2021
cd1b3b6
Revert codecov-ruby ish
thomasrockhu Jan 25, 2021
42f1dd3
Fix the dump function
thomasrockhu Jan 25, 2021
41b999d
Shellcheck
thomasrockhu Jan 26, 2021
17a89e1
more shellcheck
thomasrockhu Jan 26, 2021
621de9d
Add UT
thomasrockhu Jan 27, 2021
0bd8917
Update test
thomasrockhu Jan 27, 2021
58e19b9
reset
thomasrockhu Jan 27, 2021
e12d532
Update UTs
thomasrockhu Jan 27, 2021
93774f5
Add env vars
thomasrockhu Jan 27, 2021
13adee9
no token needed
thomasrockhu Jan 27, 2021
fca5604
more things
thomasrockhu Jan 27, 2021
08f6afa
Add build num
thomasrockhu Jan 27, 2021
59baa56
Update tests
thomasrockhu Jan 27, 2021
88f637a
flag it
thomasrockhu Jan 27, 2021
d133e51
Remove res
thomasrockhu Jan 27, 2021
12198f1
Update file
thomasrockhu Jan 27, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
name: Extract shunit
command: tar --strip-components=1 -zxvf tests/shunit2-2.1.8.tar.gz
- run:
name: Install bashcov and json
name: Install Ruby dependencies
command: |
gem install json
gem install simplecov
Expand All @@ -30,7 +30,7 @@ jobs:
- run:
name: Upload Codecov
command: |
bash <(curl -s https://codecov.io/bash) -s /home/circleci/project/coverage -Z
bash ./codecov -s coverage -Z
- store_artifacts:
path: coverage
deploy:
Expand Down
2 changes: 1 addition & 1 deletion SHA1SUM
Original file line number Diff line number Diff line change
@@ -1 +1 @@
930c0975570559ee7ad02cebaa6e823c3d2795df codecov
68c009aa7edb08efd0ee5c1499e30dc7eb9bf6d1 codecov
2 changes: 1 addition & 1 deletion SHA256SUM
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2ad0f9d8237901d5fb7718d82d833379ef03d406d5ec798272486ce8449285f3 codecov
4306b518185f7c60601f0b6b081e3db3bee2d0574294f843be0e3e964bf2200a codecov
2 changes: 1 addition & 1 deletion SHA512SUM
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3517e4cb2d7c9674744a77270d46ff45d09a63e45da9ca0e640d6b0a437689af9da16a1382c1f9c9da0501709e7ba15d3a7ac8f518902ba75ab10709591cdb0f codecov
80629039e2819a192c2a1858270a40ac0a0b8003b26c943c927b5986783d3e505cedb6625ddbcab56a5434c5b0c24ec1b167c53ca5171d3e572d4c42a4b2b3fc codecov
160 changes: 96 additions & 64 deletions codecov
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ ddp="$HOME/Library/Developer/Xcode/DerivedData"
xp=""
files=""
save_to=""
direct_file_upload=""
cacert="$CODECOV_CA_BUNDLE"
gcov_ignore="-not -path './bower_components/**' -not -path './node_modules/**' -not -path './vendor/**'"
gcov_include=""
Expand Down Expand Up @@ -146,6 +147,9 @@ cat << EOF
-F ui,chrome This upload is Chrome - UI tests

-c Move discovered coverage reports to the trash
-z FILE Upload specified file directly to Codecov and bypass all report generation.
This is inteded to be used only with a pre-formatted Codecov report and is not
expected to work under any other circumstances.
-Z Exit with 1 if not successful. Default will Exit with 0

-- xcode --
Expand Down Expand Up @@ -248,10 +252,9 @@ parse_yaml() {
}'
}


if [ $# != 0 ];
then
while getopts "a:A:b:B:cC:dD:e:f:F:g:G:hJ:k:Kn:p:P:Q:q:r:R:s:S:t:T:u:U:vx:X:ZN:-" o
while getopts "a:A:b:B:cC:dD:e:f:F:g:G:hJ:k:Kn:p:P:Q:q:r:R:s:S:t:T:u:U:vx:X:Zz:N:-" o
do
codecov_flags+=( "$o" )
case "$o" in
Expand Down Expand Up @@ -451,6 +454,17 @@ $OPTARG"
"Z")
exit_with=1
;;
"z")
direct_file_upload="$OPTARG"
ft_gcov="0"
ft_coveragepy="0"
ft_fix="0"
ft_search="0"
ft_network="0"
ft_xcodellvm="0"
ft_gcovout="0"
include_cov=""
;;
*)
echo -e "${r}Unexpected flag not supported${x}"
;;
Expand All @@ -471,16 +485,19 @@ say "

# check for installed tools
# git/hg
if [ -x "$(command -v git)" ];
if [ "$direct_file_upload" = "" ];
then
say "$b==>$x $(git --version) found"
else
say "$y==>$x git not installed, testing for mercurial"
if [ -x "$(command -v hg)" ];
if [ -x "$(command -v git)" ];
then
say "$b==>$x $(hg --version) found"
say "$b==>$x $(git --version) found"
else
say "$r==>$x git nor mercurial are installed. Uploader may fail or have unintended consequences"
say "$y==>$x git not installed, testing for mercurial"
if [ -x "$(command -v hg)" ];
then
say "$b==>$x $(hg --version) found"
else
say "$r==>$x git nor mercurial are installed. Uploader may fail or have unintended consequences"
fi
fi
fi
# curl
Expand Down Expand Up @@ -1373,6 +1390,9 @@ $PWD/coverage.xml"
elif [ "$include_cov" != "" ];
then
files=$(eval "find $search_in -type f \( ${include_cov:5} \)$exclude_cov 2>/dev/null" || echo '')
elif [ "$direct_file_upload" != "" ];
then
files=$direct_file_upload
fi

num_of_files=$(echo "$files" | wc -l | tr -d ' ')
Expand Down Expand Up @@ -1442,6 +1462,7 @@ cleanup() {

trap cleanup INT ABRT TERM


if [ "$env" != "" ];
then
inc_env=""
Expand All @@ -1455,13 +1476,16 @@ then
"
fi
done

echo "$inc_env<<<<<< ENV" >> "$upload_file"
echo "$inc_env<<<<<< ENV" >> "$upload_file"
fi

# Append git file list
# write discovered yaml location
echo "$yaml" >> "$upload_file"
if [ "$direct_file_upload" = "" ];
then
echo "$yaml" >> "$upload_file"
fi

if [ "$ft_network" == "1" ];
then
i="woff|eot|otf" # fonts
Expand All @@ -1473,70 +1497,78 @@ then
then
i="$i|html"
fi

echo "$network" | grep -vwE "($i)$" >> "$upload_file"
fi
echo "<<<<<< network" >> "$upload_file"

fr=0
say "${e}==>${x} Reading reports"
while IFS='' read -r file;
do
# read the coverage file
if [ "$(echo "$file" | tr -d ' ')" != '' ];
then
if [ -f "$file" ];
if [ "$direct_file_upload" = "" ];
then
fr=0
say "${e}==>${x} Reading reports"
while IFS='' read -r file;
do
# read the coverage file
if [ "$(echo "$file" | tr -d ' ')" != '' ];
then
report_len=$(wc -c < "$file")
if [ "$report_len" -ne 0 ];
if [ -f "$file" ];
then
say " ${g}+${x} $file ${e}bytes=$(echo "$report_len" | tr -d ' ')${x}"
# append to to upload
_filename=$(basename "$file")
if [ "${_filename##*.}" = 'gcov' ];
report_len=$(wc -c < "$file")
if [ "$report_len" -ne 0 ];
then
{
echo "# path=$(echo "$file.reduced" | sed "s|^$git_root/||")";
# get file name
head -1 "$file";
} >> "$upload_file"
# 1. remove source code
# 2. remove ending bracket lines
# 3. remove whitespace
# 4. remove contextual lines
# 5. remove function names
awk -F': *' '{print $1":"$2":"}' "$file" \
| sed '\/: *} *$/d' \
| sed 's/^ *//' \
| sed '/^-/d' \
| sed 's/^function.*/func/' >> "$upload_file"
say " ${g}+${x} $file ${e}bytes=$(echo "$report_len" | tr -d ' ')${x}"
# append to to upload
_filename=$(basename "$file")
if [ "${_filename##*.}" = 'gcov' ];
then
{
echo "# path=$(echo "$file.reduced" | sed "s|^$git_root/||")";
# get file name
head -1 "$file";
} >> "$upload_file"
# 1. remove source code
# 2. remove ending bracket lines
# 3. remove whitespace
# 4. remove contextual lines
# 5. remove function names
awk -F': *' '{print $1":"$2":"}' "$file" \
| sed '\/: *} *$/d' \
| sed 's/^ *//' \
| sed '/^-/d' \
| sed 's/^function.*/func/' >> "$upload_file"
else
{
echo "# path=${file//^$git_root/||}";
cat "$file";
} >> "$upload_file"
fi
echo "<<<<<< EOF" >> "$upload_file"
fr=1
if [ "$clean" = "1" ];
then
rm "$file"
fi
else
{
echo "# path=${file//^$git_root/||}";
cat "$file";
} >> "$upload_file"
fi
echo "<<<<<< EOF" >> "$upload_file"
fr=1
if [ "$clean" = "1" ];
then
rm "$file"
say " ${r}-${x} Skipping empty file $file"
fi
else
say " ${r}-${x} Skipping empty file $file"
say " ${r}-${x} file not found at $file"
fi
else
say " ${r}-${x} file not found at $file"
fi
fi
done <<< "$(echo -e "$files")"
done <<< "$(echo -e "$files")"

if [ "$fr" = "0" ];
then
say "${r}-->${x} No coverage data found."
say " Please visit ${b}http://docs.codecov.io/docs/supported-languages${x}"
say " search for your projects language to learn how to collect reports."
exit ${exit_with};
if [ "$fr" = "0" ];
then
say "${r}-->${x} No coverage data found."
say " Please visit ${b}http://docs.codecov.io/docs/supported-languages${x}"
say " search for your projects language to learn how to collect reports."
exit ${exit_with};
fi
else
cp "$direct_file_upload" "$upload_file"
if [ "$clean" = "1" ];
then
rm "$direct_file_upload"
fi
fi

if [ "$ft_fix" = "1" ];
Expand Down Expand Up @@ -1725,7 +1757,7 @@ else
if [ "$save_to" != "" ];
then
say "${e}==>${x} Copying upload file to ${save_to}"
mkdir --parents "$save_to"
mkdir -p `dirname "$save_to"`
cp "$upload_file" "$save_to"
fi

Expand Down