build-linux.bash 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #!/bin/bash
  2. set -euo pipefail
  3. # Copyright (C) 2016 The Syncthing Authors.
  4. #
  5. # This Source Code Form is subject to the terms of the Mozilla Public
  6. # License, v. 2.0. If a copy of the MPL was not distributed with this file,
  7. # You can obtain one at http://mozilla.org/MPL/2.0/.
  8. # This script should be run by Jenkins as './src/github.com/syncthing/syncthing/jenkins/build-linux.bash',
  9. # that is, it should be run from $GOPATH.
  10. . src/github.com/syncthing/syncthing/jenkins/common.bash
  11. init
  12. # after init we are in the source directory
  13. clean
  14. fetchExtra
  15. buildSource
  16. build
  17. test
  18. testWithCoverage
  19. platforms=(
  20. dragonfly-amd64
  21. freebsd-amd64 freebsd-386
  22. linux-amd64 linux-386 linux-arm linux-arm64 linux-ppc64 linux-ppc64le
  23. netbsd-amd64 netbsd-386
  24. openbsd-amd64 openbsd-386
  25. )
  26. echo Building
  27. for plat in "${platforms[@]}"; do
  28. echo Building "$plat"
  29. goos="${plat%-*}"
  30. goarch="${plat#*-}"
  31. go run build.go -goos "$goos" -goarch "$goarch" tar
  32. mv *.tar.gz "$WORKSPACE"
  33. echo
  34. done
  35. go run build.go -goarch amd64 deb
  36. go run build.go -goarch i386 deb
  37. go run build.go -goarch armel deb
  38. go run build.go -goarch armhf deb
  39. go run build.go -goarch arm64 deb
  40. mv *.deb "$WORKSPACE"
  41. go run build.go -goarch amd64 snap
  42. go run build.go -goarch armhf snap
  43. go run build.go -goarch arm64 snap
  44. mv *.snap "$WORKSPACE"
  45. if [[ -d /usr/local/oldgo ]]; then
  46. echo
  47. echo Building with minimum supported Go version
  48. export GOROOT=/usr/local/oldgo
  49. export PATH="$GOROOT/bin:$PATH"
  50. go version
  51. echo
  52. rm -rf "$GOPATH/pkg"
  53. go run build.go install all # only compile, don't run lints and stuff
  54. fi