Skip to content

Commit a00663b

Browse files
committed
update test_runner.sh
1 parent 242b67e commit a00663b

1 file changed

Lines changed: 27 additions & 10 deletions

File tree

test_runner.sh

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,30 @@
11
#!/bin/bash
22
set -e
3-
CURR_DIR="$2";
4-
cd "$1";
5-
gunzip -c -S .xcactivitylog `ls -t | grep 'xcactivitylog' | head -n1` > output2.log;
6-
awk '{ gsub("\r", "\n"); print }' output2.log > unixfile.txt;
7-
LOG=`echo "puts /(^Test Suite '[\w-]+?\.xctest' started at .+?Test Suite '[\w-]+?\.xctest' (failed|passed).+?\.$)/m.match(File.read(\"unixfile.txt\"))" | ruby`;
8-
cd "$CURR_DIR"
9-
[[ -s "/Users/$USER/.rvm/scripts/rvm" ]] && source "/Users/$USER/.rvm/scripts/rvm"
10-
if [[ -z "$(which learn-xcpretty)" ]]; then
11-
gem install learn-xcpretty
3+
SERVICE_URL='http://ironbroker.flatironschool.com'
4+
SERVICE_ENDPOINT='/e/flatiron_xcpretty'
5+
CURR_DIR="$2"
6+
NETRC=~/.netrc
7+
8+
if [ -f ${NETRC} ]; then
9+
if grep -q flatiron-push ${NETRC}; then
10+
GITHUB_USERNAME=`grep -A1 flatiron-push ${NETRC} | grep login | awk '{print $2}'`
11+
GITHUB_USER_ID=`grep -A2 flatiron-push ${NETRC} | grep password | awk '{print $2}'`
12+
else
13+
echo "Please run the iOS setup script before running any tests."
14+
exit 1
15+
fi
16+
else
17+
echo "Please run the iOS setup script before running any tests."
18+
exit 1
1219
fi
13-
echo "$LOG" | learn-xcpretty -t --report learn
20+
21+
cd "$1"
22+
gunzip -c -S .xcactivitylog `ls -t | grep 'xcactivitylog' | head -n1` | awk '{ gsub("\r", "\n"); print }' > unixfile.txt
23+
TOTAL_COUNT=`tail -n10 unixfile.txt | grep -A1 xctest | grep Executed | awk '{print $2}'`
24+
FAILURE_COUNT=`tail -n10 unixfile.txt | grep -A1 xctest | grep Executed | awk '{print $5}'`
25+
PASSING_COUNT=`echo "${TOTAL_COUNT} - ${FAILURE_COUNT}" | bc`
26+
REPO_NAME=`echo ${CURR_DIR} | awk -F'/' '{print $NF}'`
27+
cd ${CURR_DIR}
28+
29+
30+
curl -s -H "Content-Type: application/json" -X POST --data "{ \"username\": \"${GITHUB_USERNAME}\", \"github_user_id\": \"${GITHUB_USER_ID}\", \"repo_name\": \"${REPO_NAME}\", \"build\": { \"test_suite\": [{\"framework\": \"xcpretty\", \"formatted_output\": [], \"duration\": 0.0, \"build_output\": []}]}, \"total_count\": ${TOTAL_COUNT}, \"passing_count\": ${PASSING_COUNT}, \"failure_count\": ${FAILURE_COUNT}}" "${SERVICE_URL}${SERVICE_ENDPOINT}"

0 commit comments

Comments
 (0)