Skip to content

Commit

Permalink
chore(seriesci): move seriesci scripts out of travis.yml file
Browse files Browse the repository at this point in the history
  • Loading branch information
kopach committed Jun 22, 2020
1 parent d356f30 commit a3d1386
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 35 deletions.
36 changes: 1 addition & 35 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,38 +26,4 @@ script:
echo "${duration_test}s" > test-execution-time.log
after_success:
- echo "post code coverage to seriesci"
- |
echo $(npx lcov-total coverage/lcov.info)% | xargs -I {} curl \
--header "Authorization: Token ${SERIESCI_TOKEN}" \
--data-urlencode value="{}" \
--data sha="${TRAVIS_COMMIT}" \
https://seriesci.com/api/repos/kopach/karma-sabarivka-reporter/coverage/combined
- echo "post bundle size to seriesci"
- |
npm run build
du -sh dist/ | awk '{print $1}' | xargs -I {} curl \
--header "Authorization: Token ${SERIESCI_TOKEN}" \
--data-urlencode value="{}" \
--data sha="${TRAVIS_COMMIT}" \
https://seriesci.com/api/repos/kopach/karma-sabarivka-reporter/bundlesize/combined
- echo "post lint & build & test execution time to seriesci"
- |
duration_build=$(cat build-execution-time.log)
duration_test=$(cat test-execution-time.log)
duration_lint=$(cat lint-execution-time.log)
curl \
--header "Authorization: Token c698677f-ebb7-44f8-9d72-47a73b7e2121" \
--header "Content-Type: application/json" \
--data "{\"values\":[{\"line\":\"build\",\"value\":\"${duration_build}\"},{\"line\":\"test\",\"value\":\"${duration_test}\"},{\"line\":\"lint\",\"value\":\"${duration_lint}\"}],\"sha\":\"$(git rev-parse HEAD)\"}" \
https://seriesci.com/api/kopach/karma-sabarivka-reporter/time/many
- echo "post number of dependencies to seriesci"
- |
(npm ls --depth=0 --prod --parseable --silent || true) | grep node_modules | wc -l | xargs -I {} curl \
--header "Authorization: Token ${SERIESCI_TOKEN}" \
--data-urlencode value="{}" \
--data sha="${TRAVIS_COMMIT}" \
https://seriesci.com/api/repos/kopach/karma-sabarivka-reporter/dependencies/combined
- scripts/seriesci.sh
37 changes: 37 additions & 0 deletions scripts/seriesci.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env bash

echo "TRAVIS_BRANCH= $TRAVIS_BRANCH"

if [ "$TRAVIS_BRANCH" = "master" ]; then
echo "post code coverage to seriesci"
echo $(npx lcov-total coverage/lcov.info)% | xargs -I {} curl \
--header "Authorization: Token ${SERIESCI_TOKEN}" \
--data-urlencode value="{}" \
--data sha="${TRAVIS_COMMIT}" \
https://seriesci.com/api/repos/kopach/karma-sabarivka-reporter/coverage/combined

echo "post bundle size to seriesci"
du -sh dist/ | awk '{print $1}' | xargs -I {} curl \
--header "Authorization: Token ${SERIESCI_TOKEN}" \
--data-urlencode value="{}" \
--data sha="${TRAVIS_COMMIT}" \
https://seriesci.com/api/repos/kopach/karma-sabarivka-reporter/bundlesize/combined

echo "post lint & build & test execution time to seriesci"
duration_build=$(cat build-execution-time.log)
duration_test=$(cat test-execution-time.log)
duration_lint=$(cat lint-execution-time.log)
curl \
--header "Authorization: Token c698677f-ebb7-44f8-9d72-47a73b7e2121" \
--header "Content-Type: application/json" \
--data "{\"values\":[{\"line\":\"build\",\"value\":\"${duration_build}\"},{\"line\":\"test\",\"value\":\"${duration_test}\"},{\"line\":\"lint\",\"value\":\"${duration_lint}\"}],\"sha\":\"$(git rev-parse HEAD)\"}" \
https://seriesci.com/api/kopach/karma-sabarivka-reporter/time/many

echo "post number of dependencies to seriesci"
(npm ls --depth=0 --prod --parseable --silent || true) | grep node_modules | wc -l | xargs -I {} curl \
--header "Authorization: Token ${SERIESCI_TOKEN}" \
--data-urlencode value="{}" \
--data sha="${TRAVIS_COMMIT}" \
https://seriesci.com/api/repos/kopach/karma-sabarivka-reporter/dependencies/combined

fi

0 comments on commit a3d1386

Please sign in to comment.