ci.sh 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/bin/sh
  2. set -e
  3. : ${CC?"Need to set CC as clang, gcc or a specific version like clang-3.6"}
  4. : ${ARCH?"Need to set ARCH as aarch64, amd64 or riscv"}
  5. # make sure Go is gone
  6. sudo rm -rf /opt/hostedtoolcache/go/
  7. # fetch official Go toolchain release as per https://golang.org/doc/install
  8. TARFILE="go$GO_VERSION.$OS-$ARCH.tar.gz"
  9. wget "https://golang.org/dl/$TARFILE" -nv # too verbose otherwise
  10. sudo tar -C /usr/local -xzf "$TARFILE"
  11. # For some reason, GOROOT was set in GitHub's CI, so we enforce it
  12. export GOROOT=/usr/local/go/
  13. export PATH=/usr/local/go/bin:$PATH
  14. # please keep me for debugging CI ;)
  15. which go
  16. go env
  17. pwd # in case you get lost
  18. # bootstrap Harvey build utilities - what you do on your host OS otherwise
  19. ./bootstrap.sh
  20. # GO_MOD_PATH_UROOT=`grep github.com/u-root/u-root go.mod | cut -d " " -f 2`
  21. # GO_MOD_PATH_HARVEY=`grep harvey-os.org go.mod | cut -d " " -f 2`
  22. # echo u-root version: $GO_MOD_PATH_UROOT
  23. # echo Harvey version: $GO_MOD_PATH_HARVEY
  24. # TODO Is all of this still necessary?
  25. # not that we really want this, but yea... Go modules
  26. #mkdir -p ~/go/src/github.com/u-root/
  27. #cp -r ~/go/pkg/mod/github.com/u-root/u-root@$GO_MOD_PATH_UROOT ~/go/src/github.com/u-root/u-root
  28. #chmod +w ~/go/src/github.com/u-root/u-root -R
  29. #(cd ~/go/src/github.com/u-root/u-root && dep ensure)
  30. #cp -r ~/go/pkg/mod/harvey-os.org@$GO_MOD_PATH_HARVEY ~/go/src/harvey-os.org
  31. #chmod +w ~/go/src/harvey-os.org -R
  32. # extend PATH to include the build tool and u-root
  33. PATH=$PATH:$(pwd)/$(go env GOHOSTOS)_$(go env GOHOSTARCH)/bin:~/go/bin
  34. # finally build Harvey :-)
  35. build build.json