.travis.yml 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. language: go
  2. sudo: false
  3. install:
  4. - export GOPATH_FIRST="${GOPATH%%:*}"
  5. - >
  6. git clone \
  7. --depth 1 \
  8. https://github.com/tianon/markdownfmt.git \
  9. "$GOPATH_FIRST/src/github.com/shurcooL/markdownfmt"
  10. - export BLACKFRIDAY_VERSION="$(awk '$1 == "ENV" && $2 == "BLACKFRIDAY_VERSION" { print $3; exit }' "$GOPATH_FIRST/src/github.com/shurcooL/markdownfmt/Dockerfile")"
  11. - >
  12. git clone \
  13. --depth 1 \
  14. -b "$BLACKFRIDAY_VERSION" \
  15. https://github.com/russross/blackfriday.git \
  16. "$GOPATH_FIRST/src/github.com/russross/blackfriday"
  17. - go get -v github.com/shurcooL/markdownfmt
  18. script:
  19. - files="$(find -name '*.md' -print0 | xargs -0 markdownfmt -l)";
  20. if [ "$files" ]; then
  21. echo >&2 'Need markdownfmt:';
  22. echo >&2 "$files";
  23. echo >&2;
  24. echo "$files" | xargs markdownfmt -d >&2;
  25. exit 1;
  26. fi
  27. - failed='';
  28. for short in */README-short.txt; do
  29. chars="$(echo -n "$(cat "$short")" | wc -m)";
  30. lines="$(cat "$short" | wc -l)";
  31. if [ "$chars" -gt 100 -o "$lines" -gt 1 ]; then
  32. failed+=" $short";
  33. fi
  34. done;
  35. if [ "$failed" ]; then
  36. echo >&2 "Too long (or too many lines):$failed";
  37. exit 1;
  38. fi
  39. - failed='';
  40. for repo in */; do
  41. if [ ! -e "$repo/github-repo" ]; then
  42. failed+=" $repo";
  43. fi
  44. done;
  45. if [ "$failed" ]; then
  46. echo >&2 "Missing github-repo for:$failed";
  47. exit 1;
  48. fi
  49. - if [ "$TRAVIS_PULL_REQUEST" != 'false' ]; then
  50. if [ "$(git diff --numstat "$TRAVIS_COMMIT_RANGE" -- '*/README.md')" ]; then
  51. echo >&2 'Error:'' at least one repo README.md has changed';
  52. echo >&2 'These files are autogenerated, so it is unnecessary to modify them';
  53. echo >&2 'Please update content.md and docker-library-bot will take care of README.md';
  54. echo >&2 'See:'' https://github.com/docker-library/docs/#image-namereadmemd';
  55. echo >&2;
  56. exit 1;
  57. fi
  58. fi