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

Commit

Permalink
Network prefix filter (#412)
Browse files Browse the repository at this point in the history
* Add new flag for network filtering

* force

* Update files
  • Loading branch information
thomasrockhu authored Feb 26, 2021
1 parent fb8663d commit 7100762
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 10 deletions.
2 changes: 1 addition & 1 deletion SHA1SUM
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4dc681475a004f8cb8c1d8cf7c5aff3bd53d615b codecov
20189261363b53e39287a46aa07352853646f17b codecov
2 changes: 1 addition & 1 deletion SHA256SUM
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ae4058f2f1f0d3f62e6a95e288616c2a3e9c8a4929d8cefd69e6c36da81d0963 codecov
54cce90506cc2f675a2dbd53cb6be3be0dc575ea74d873b8aa7c9d5fdaeb03e2 codecov
2 changes: 1 addition & 1 deletion SHA512SUM
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6d01cca237aaf0627165e71d384dfc4f63b538fe463138f078e9a54b434350cf008bcd7dbf489d80985156d53475f9c1bb41b425320372d5028942cde795b0a7 codecov
b26e17183e97ef5c076f7788c3b3462fd7263b2e53bfffde5f6205dc596fdfe943ee83e04f6f04a060a74ead24ab59fe24aac8bec54cf1aa68af15b57e069795 codecov
25 changes: 18 additions & 7 deletions codecov
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,16 @@ then
git_root="."
fi

url_o=""
pr_o=""
branch_o=""
build_o=""
commit_o=""
pr_o=""
prefix_o=""
network_filter_o=""
search_in_o=""
tag_o=""
branch_o=""
slug_o=""
prefix_o=""
tag_o=""
url_o=""
git_ls_files_recurse_submodules_o=""
package="bash"

Expand Down Expand Up @@ -123,6 +124,10 @@ cat << EOF
-e VAR,VAR2
-k prefix Prefix filepaths to help resolve path fixing: https://github.com/codecov/support/issues/472
-i prefix Only include files in the network with a certain prefix. Useful for upload-specific path fixing
-X feature Toggle functionalities
-X gcov Disable gcov
Expand Down Expand Up @@ -168,7 +173,6 @@ cat << EOF
-G GLOB Paths to include during gcov gathering
-p dir Project root directory
Also used when preparing gcov
-k prefix Prefix filepaths to help resolve path fixing: https://github.com/codecov/support/issues/472
-x gcovexe gcov executable to run. Defaults to 'gcov'
-a gcovargs extra arguments to pass to gcov
Expand Down Expand Up @@ -256,7 +260,7 @@ 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:Zz:N:-" o
while getopts "a:A:b:B:cC:dD:e:f:F:g:G:hi:J: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 @@ -334,6 +338,9 @@ $OPTARG"
show_help
exit 0;
;;
"i")
network_filter_o="$OPTARG"
;;
"J")
ft_xcodellvm="1"
ft_xcodeplist="0"
Expand Down Expand Up @@ -1461,6 +1468,10 @@ then
-type f -print 2>/dev/null || echo '')
fi

if [ "$network_filter_o" != "" ];
then
network=$(echo "$network" | grep -e "$network_filter_o/*")
fi
if [ "$prefix_o" != "" ];
then
network=$(echo "$network" | awk "{print \"$prefix_o/\"\$0}")
Expand Down
16 changes: 16 additions & 0 deletions tests/test
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,22 @@ function test_env_env () {
assertContains "$res" 'COMMIT=abc'
}

function test_network_filter () {
reset
res=$(./codecov -d -i tests)
assertNotContains "$res" 'ignores/file.cpp'
assertNotContains "$res" 'SHA512SUM'
assertNotContains "$res" 'install.sh'
assertContains "$res" 'tests/test'

reset
res=$(./codecov -d)
assertContains "$res" 'ignores/file.cpp'
assertContains "$res" 'SHA512SUM'
assertContains "$res" 'install.sh'
assertContains "$res" 'tests/test'
}

function test_slug_opt () {
reset
res=$(./codecov -dr myowner/myrepo | grep "https://codecov.io/")
Expand Down

0 comments on commit 7100762

Please sign in to comment.