setup_complement_prerequisites.sh 1.4 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #!/bin/sh
  2. #
  3. # Common commands to set up Complement's prerequisites in a GitHub Actions CI run.
  4. #
  5. # Must be called after Synapse has been checked out to `synapse/`.
  6. #
  7. set -eu
  8. alias block='{ set +x; } 2>/dev/null; func() { echo "::group::$*"; set -x; }; func'
  9. alias endblock='{ set +x; } 2>/dev/null; func() { echo "::endgroup::"; set -x; }; func'
  10. block Set Go Version
  11. # The path is set via a file given by $GITHUB_PATH. We need both Go 1.17 and GOPATH on the path to run Complement.
  12. # See https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#adding-a-system-path
  13. # Add Go 1.17 to the PATH: see https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-Readme.md#environment-variables-2
  14. echo "$GOROOT_1_17_X64/bin" >> $GITHUB_PATH
  15. # Add the Go path to the PATH: We need this so we can call gotestfmt
  16. echo "~/go/bin" >> $GITHUB_PATH
  17. endblock
  18. block Install Complement Dependencies
  19. sudo apt-get -qq update && sudo apt-get install -qqy libolm3 libolm-dev
  20. go get -v github.com/haveyoudebuggedit/gotestfmt/v2/cmd/gotestfmt@latest
  21. endblock
  22. block Install custom gotestfmt template
  23. mkdir .gotestfmt/github -p
  24. cp synapse/.ci/complement_package.gotpl .gotestfmt/github/package.gotpl
  25. endblock
  26. block Check out Complement
  27. # Attempt to check out the same branch of Complement as the PR. If it
  28. # doesn't exist, fallback to HEAD.
  29. synapse/.ci/scripts/checkout_complement.sh
  30. endblock