build-all.sh 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. OPT="-includeBuildNumber=false"
  17. else
  18. echo "Building incremental build for $CIRCLE_BRANCH"
  19. OPT="-buildNumber=${CIRCLE_BUILD_NUM}"
  20. fi
  21. go run build.go -goarch armv7 -cc ${CCARMV7} ${OPT} build
  22. go run build.go -goarch arm64 -cc ${CCARM64} ${OPT} build
  23. go run build.go -goos darwin -cc ${CCOSX64} ${OPT} build
  24. go run build.go -goos windows -cc ${CCWIN64} ${OPT} build
  25. CC=${CCX64} go run build.go ${OPT} build
  26. yarn install --pure-lockfile --no-progress
  27. echo "current dir: $(pwd)"
  28. if [ -d "dist" ]; then
  29. rm -rf dist
  30. fi
  31. if [ "$CIRCLE_TAG" != "" ]; then
  32. echo "Building frontend and packaging from tag $CIRCLE_TAG"
  33. else
  34. echo "Building frontend and packaging incremental build for $CIRCLE_BRANCH"
  35. fi
  36. echo "Building frontend"
  37. go run build.go ${OPT} build-frontend
  38. echo "Packaging"
  39. go run build.go -goos linux -pkg-arch amd64 ${OPT} package-only latest
  40. #removing amd64 phantomjs bin for armv7/arm64 packages
  41. rm tools/phantomjs/phantomjs
  42. go run build.go -goos linux -pkg-arch armv7 ${OPT} package-only
  43. go run build.go -goos linux -pkg-arch arm64 ${OPT} package-only
  44. if [ -d '/tmp/phantomjs/darwin' ]; then
  45. cp /tmp/phantomjs/darwin/phantomjs tools/phantomjs/phantomjs
  46. else
  47. echo 'PhantomJS binaries for darwin missing!'
  48. fi
  49. go run build.go -goos darwin -pkg-arch amd64 ${OPT} package-only
  50. if [ -d '/tmp/phantomjs/windows' ]; then
  51. cp /tmp/phantomjs/windows/phantomjs.exe tools/phantomjs/phantomjs.exe
  52. rm tools/phantomjs/phantomjs
  53. else
  54. echo 'PhantomJS binaries for darwin missing!'
  55. fi
  56. go run build.go -goos windows -pkg-arch amd64 ${OPT} package-only