build-all.sh 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. #!/bin/bash
  2. #
  3. # This script is executed from within the container.
  4. #
  5. CCARMV7=arm-linux-gnueabihf-gcc
  6. CCARM64=aarch64-linux-gnu-gcc
  7. CCOSX64=/tmp/osxcross/target/bin/o64-clang
  8. CCWIN64=x86_64-w64-mingw32-gcc
  9. CCX64=/tmp/x86_64-centos6-linux-gnu/bin/x86_64-centos6-linux-gnu-gcc
  10. GOPATH=/go
  11. REPO_PATH=$GOPATH/src/github.com/grafana/grafana
  12. cd /go/src/github.com/grafana/grafana
  13. echo "current dir: $(pwd)"
  14. if [ "$CIRCLE_TAG" != "" ]; then
  15. echo "Building releases from tag $CIRCLE_TAG"
  16. go run build.go -goarch armv7 -cc ${CCARMV7} -includeBuildNumber=false build
  17. go run build.go -goarch arm64 -cc ${CCARM64} -includeBuildNumber=false build
  18. go run build.go -goos darwin -cc ${CCOSX64} -includeBuildNumber=false build
  19. go run build.go -goos windows -cc ${CCWIN64} -includeBuildNumber=false build
  20. CC=${CCX64} go run build.go -includeBuildNumber=false build
  21. else
  22. echo "Building incremental build for $CIRCLE_BRANCH"
  23. go run build.go -goarch armv7 -cc ${CCARMV7} -buildNumber=${CIRCLE_BUILD_NUM} build
  24. go run build.go -goarch arm64 -cc ${CCARM64} -buildNumber=${CIRCLE_BUILD_NUM} build
  25. go run build.go -goos darwin -cc ${CCOSX64} -buildNumber=${CIRCLE_BUILD_NUM} build
  26. go run build.go -goos windows -cc ${CCWIN64} -buildNumber=${CIRCLE_BUILD_NUM} build
  27. CC=${CCX64} go run build.go -buildNumber=${CIRCLE_BUILD_NUM} build
  28. fi
  29. yarn install --pure-lockfile --no-progress
  30. echo "current dir: $(pwd)"
  31. if [ -d "dist" ]; then
  32. rm -rf dist
  33. fi
  34. if [ "$CIRCLE_TAG" != "" ]; then
  35. echo "Building frontend from tag $CIRCLE_TAG"
  36. go run build.go -includeBuildNumber=false build-frontend
  37. echo "Packaging a release from tag $CIRCLE_TAG"
  38. go run build.go -goos linux -pkg-arch amd64 -includeBuildNumber=false package-only latest
  39. go run build.go -goos linux -pkg-arch armv7 -includeBuildNumber=false package-only
  40. go run build.go -goos linux -pkg-arch arm64 -includeBuildNumber=false package-only
  41. if [ -d '/tmp/phantomjs/darwin' ]; then
  42. cp /tmp/phantomjs/darwin/phantomjs tools/phantomjs/phantomjs
  43. else
  44. echo 'PhantomJS binaries for darwin missing!'
  45. fi
  46. go run build.go -goos darwin -pkg-arch amd64 -includeBuildNumber=false package-only
  47. if [ -d '/tmp/phantomjs/windows' ]; then
  48. cp /tmp/phantomjs/windows/phantomjs.exe tools/phantomjs/phantomjs.exe
  49. rm tools/phantomjs/phantomjs
  50. else
  51. echo 'PhantomJS binaries for darwin missing!'
  52. fi
  53. go run build.go -goos windows -pkg-arch amd64 -includeBuildNumber=false package-only
  54. else
  55. echo "Building frontend for $CIRCLE_BRANCH"
  56. go run build.go -buildNumber=${CIRCLE_BUILD_NUM} build-frontend
  57. echo "Packaging incremental build for $CIRCLE_BRANCH"
  58. go run build.go -goos linux -pkg-arch amd64 -buildNumber=${CIRCLE_BUILD_NUM} package-only latest
  59. go run build.go -goos linux -pkg-arch armv7 -buildNumber=${CIRCLE_BUILD_NUM} package-only
  60. go run build.go -goos linux -pkg-arch arm64 -buildNumber=${CIRCLE_BUILD_NUM} package-only
  61. if [ -d '/tmp/phantomjs/darwin' ]; then
  62. cp /tmp/phantomjs/darwin/phantomjs tools/phantomjs/phantomjs
  63. else
  64. echo 'PhantomJS binaries for darwin missing!'
  65. fi
  66. go run build.go -goos darwin -pkg-arch amd64 -buildNumber=${CIRCLE_BUILD_NUM} package-only
  67. if [ -d '/tmp/phantomjs/windows' ]; then
  68. cp /tmp/phantomjs/windows/phantomjs.exe tools/phantomjs/phantomjs.exe
  69. rm tools/phantomjs/phantomjs
  70. else
  71. echo 'PhantomJS binaries for windows missing!'
  72. fi
  73. go run build.go -goos windows -pkg-arch amd64 -buildNumber=${CIRCLE_BUILD_NUM} package-only
  74. fi