diff --git a/README.md b/README.md index 74b71d1..ff15b41 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +[![codecov](https://codecov.workiva.net/gh/Workiva/platform_detect/branch/master/graph/badge.svg?token=BF7AmHyx4L)](https://codecov.workiva.net/gh/Workiva/platform_detect) + # platform_detect A library for detecting browser and platform type and version. diff --git a/smithy.yml b/smithy.yml index 4e2d873..710c0dd 100644 --- a/smithy.yml +++ b/smithy.yml @@ -1,6 +1,9 @@ project: dart language: dart +env: + - CODECOV_TOKEN='ba029200-53f5-4804-87b4-261d4fac4479' + # dart 1.19.1, built from https://github.com/Workiva/smithy-runner-dart/tree/0.0.4 runner_image: drydock-prod.workiva.org/workiva/smithy-runner-dart:74173 @@ -9,11 +12,13 @@ script: - pub run dart_dev format --check - pub run dart_dev analyze - pub run dart_dev test + - xvfb-run pub run dart_dev coverage --no-html after_script: - pub run dart_dev docs --no-open - cd doc/api && tar -zcvf api.tar.gz * && cd ../.. - tar czvf platform_detect.pub.tgz LICENSE README.md pubspec.yaml lib/ + - ./tool/codecov.sh artifacts: build: diff --git a/tool/codecov.sh b/tool/codecov.sh new file mode 100755 index 0000000..cfde141 --- /dev/null +++ b/tool/codecov.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +if [ -z "$GIT_BRANCH" ] +then + echo "GIT_BRANCH environment variable not set, skipping codecov push" +else + TRACKING_REMOTE="$(git for-each-ref --format='%(upstream:short)' $(git symbolic-ref -q HEAD) | cut -d'/' -f1 | xargs git ls-remote --get-url | cut -d':' -f2 | sed 's/.git$//')" + bash <(curl -s https://codecov.workiva.net/bash) -u https://codecov.workiva.net -t $CODECOV_TOKEN -r $TRACKING_REMOTE -f coverage/coverage.lcov || echo "ERROR: Codecov failed to upload reports." +fi