build-linux.bash 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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 https://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 linux-mips linux-mipsle
  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. export BUILD_USER=deb
  36. go run build.go -goarch amd64 deb
  37. go run build.go -goarch i386 deb
  38. go run build.go -goarch armel deb
  39. go run build.go -goarch armhf deb
  40. go run build.go -goarch arm64 deb
  41. mv *.deb "$WORKSPACE"
  42. export BUILD_USER=snap
  43. go run build.go -goarch amd64 snap
  44. go run build.go -goarch armhf snap
  45. go run build.go -goarch arm64 snap
  46. mv *.snap "$WORKSPACE"
  47. if [[ -d /usr/local/oldgo ]]; then
  48. echo
  49. echo Building with minimum supported Go version
  50. export GOROOT=/usr/local/oldgo
  51. export PATH="$GOROOT/bin:$PATH"
  52. go version
  53. echo
  54. rm -rf "$GOPATH/pkg"
  55. go run build.go install all # only compile, don't run lints and stuff
  56. fi