test_configure_ci_environment.sh 924 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/bin/bash
  2. #
  3. # Short script to verify behaviour of configure_ci_environment.sh
  4. #
  5. #
  6. cd $(dirname $0) # make dir
  7. touch .gitmodules # dummy file
  8. # $1 - branch name
  9. # $2 - 1 if public, empty if private
  10. function assert_branch_public()
  11. {
  12. (
  13. CI_COMMIT_REF_NAME=$1
  14. set -e
  15. source ./configure_ci_environment.sh
  16. [[ $IS_PUBLIC = $2 ]] || exit 1
  17. ) || { echo "Expected $1 public=$2. Failing"; exit 1; }
  18. }
  19. assert_branch_public master 1
  20. assert_branch_public release/v3.0 1
  21. assert_branch_public release/invalid
  22. assert_branch_public bugfix/invalid
  23. assert_branch_public v1.0 1
  24. assert_branch_public v1.0.0 1
  25. assert_branch_public v50.50.50 1
  26. assert_branch_public v1.2-rc77 1
  27. assert_branch_public v1.2.3-rc1 1
  28. assert_branch_public v1.2.3invalid
  29. (
  30. . ./configure_ci_environment.sh
  31. [[ $PEDANTIC_CFLAGS ]] || { echo "PEDANTIC_CFLAGS is not defined"; exit 1; }
  32. ) || { exit 1; }
  33. rm -f .gitmodules