Skip to content

Commit

Permalink
rewrite coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
chinelo-obitube authored and chinelo-obitube committed Jul 21, 2024
1 parent 8ca2943 commit 71caeb7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ jobs:
GITHUB_COMMIT_SHA: ${{ github.sha }}
GITHUB_JOB_NAME: ${{ github.job }}
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
ROLE_TO_ASSUME: ${{ secrets.AWS_ROLE_TO_ASSUME }}
AWS_REGION: eu-west-1
run: |
docker-compose exec -T -e GIT_BRANCH=$GIT_BRANCH \
-e GITHUB_PULL_REQUEST=$GITHUB_PULL_REQUEST \
Expand All @@ -133,4 +137,5 @@ jobs:
-e GIT_COMMIT_SHA=$GITHUB_COMMIT_SHA \
-e CC_TEST_REPORTER_ID=$CC_TEST_REPORTER_ID \
-e GITHUB_JOB_NAME=$GITHUB_JOB_NAME \
-e AWS_CONFIG_FILE=/app/credentials api test/test-coverage.sh
-e AWS_CONFIG_FILE=/app/credentials
api test/test-coverage.sh
14 changes: 7 additions & 7 deletions test/test-coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,22 @@ cd -
./test/cc-test-reporter format-coverage -t simplecov --output ../coverage/codeclimate.$GITHUB_JOB_NAME.json ../coverage/.resultset.json
aws s3 cp ../coverage/codeclimate.$GITHUB_JOB_NAME.json s3://check-api-travis/codeclimate/$GITHUB_REPO_SLUG/$GITHUB_BUILD_NUMBER/codeclimate.$GITHUB_JOB_NAME.json
echo 'Combining and uploading coverage...' && cd test &&
rm -rf ../coverage/*
aws s3 cp --recursive s3://check-api-travis/codeclimate/$GITHUB_REPO_SLUG/$GITHUB_BUILD_NUMBER/ ../coverage
rm -rf /coverage/*
aws s3 cp --recursive s3://check-api-travis/codeclimate/$GITHUB_REPO_SLUG/$GITHUB_BUILD_NUMBER/ /coverage
if [[ $(ls ../coverage/codeclimate.* | wc -l) -eq 3 ]]
then
# Make sure we are not dealing with a file that is still being uploaded
previous_size=0
size=$(du -s ../coverage/ | cut -f1)
size=$(du -s /coverage/ | cut -f1)
while [ $size -gt $previous_size ]
do
previous_size=$size
sleep 5
size=$(du -s ../coverage/ | cut -f1)
size=$(du -s /coverage/ | cut -f1)
done
./cc-test-reporter sum-coverage --output - --parts 3 ../coverage/codeclimate.* | sed 's/\/home\/runner\/work\/check-api\///g' > ../coverage/codeclimate.json
cat ../coverage/codeclimate.json | ./cc-test-reporter upload-coverage --input -
./cc-test-reporter show-coverage ../coverage/codeclimate.json
./cc-test-reporter sum-coverage --output - --parts 3 /coverage/codeclimate.* | sed 's/\/home\/runner\/work\/check-api\///g' > /coverage/codeclimate.json
cat /coverage/codeclimate.json | ./cc-test-reporter upload-coverage --input -
./cc-test-reporter show-coverage /coverage/codeclimate.json
fi
&& cd -
echo 'Parallel tests runtime log' && cat tmp/parallel_runtime_test.log

0 comments on commit 71caeb7

Please sign in to comment.