jenkins-dendron-postgres.sh 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. #!/bin/bash
  2. set -eux
  3. : ${WORKSPACE:="$(pwd)"}
  4. export PYTHONDONTWRITEBYTECODE=yep
  5. export SYNAPSE_CACHE_FACTOR=1
  6. # Output test results as junit xml
  7. export TRIAL_FLAGS="--reporter=subunit"
  8. export TOXSUFFIX="| subunit-1to2 | subunit2junitxml --no-passthrough --output-to=results.xml"
  9. # Write coverage reports to a separate file for each process
  10. export COVERAGE_OPTS="-p"
  11. export DUMP_COVERAGE_COMMAND="coverage help"
  12. # Output flake8 violations to violations.flake8.log
  13. # Don't exit with non-0 status code on Jenkins,
  14. # so that the build steps continue and a later step can decided whether to
  15. # UNSTABLE or FAILURE this build.
  16. export PEP8SUFFIX="--output-file=violations.flake8.log || echo flake8 finished with status code \$?"
  17. rm .coverage* || echo "No coverage files to remove"
  18. tox --notest -e py27
  19. TOX_BIN=$WORKSPACE/.tox/py27/bin
  20. python synapse/python_dependencies.py | xargs -n1 $TOX_BIN/pip install
  21. $TOX_BIN/pip install psycopg2
  22. $TOX_BIN/pip install lxml
  23. : ${GIT_BRANCH:="origin/$(git rev-parse --abbrev-ref HEAD)"}
  24. if [[ ! -e .dendron-base ]]; then
  25. git clone https://github.com/matrix-org/dendron.git .dendron-base --mirror
  26. else
  27. (cd .dendron-base; git fetch -p)
  28. fi
  29. rm -rf dendron
  30. git clone .dendron-base dendron --shared
  31. cd dendron
  32. : ${GOPATH:=${WORKSPACE}/.gopath}
  33. if [[ "${GOPATH}" != *:* ]]; then
  34. mkdir -p "${GOPATH}"
  35. export PATH="${GOPATH}/bin:${PATH}"
  36. fi
  37. export GOPATH
  38. git checkout "${GIT_BRANCH}" || (echo >&2 "No ref ${GIT_BRANCH} found, falling back to develop" ; git checkout develop)
  39. go get github.com/constabulary/gb/...
  40. gb generate
  41. gb build
  42. cd ..
  43. if [[ ! -e .sytest-base ]]; then
  44. git clone https://github.com/matrix-org/sytest.git .sytest-base --mirror
  45. else
  46. (cd .sytest-base; git fetch -p)
  47. fi
  48. rm -rf sytest
  49. git clone .sytest-base sytest --shared
  50. cd sytest
  51. git checkout "${GIT_BRANCH}" || (echo >&2 "No ref ${GIT_BRANCH} found, falling back to develop" ; git checkout develop)
  52. : ${PORT_BASE:=8000}
  53. : ${PORT_COUNT=20}
  54. ./jenkins/prep_sytest_for_postgres.sh
  55. mkdir -p var
  56. echo >&2 "Running sytest with PostgreSQL";
  57. ./jenkins/install_and_run.sh --python $TOX_BIN/python \
  58. --synapse-directory $WORKSPACE \
  59. --dendron $WORKSPACE/dendron/bin/dendron \
  60. --pusher \
  61. --synchrotron \
  62. --port-range ${PORT_BASE}:$((PORT_BASE+PORT_COUNT-1))
  63. cd ..