development-environment.yml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. name: dev env
  2. on:
  3. pull_request:
  4. paths:
  5. - '.pre-commit-config.yaml'
  6. - 'Makefile'
  7. - '.github/workflows/development-environment.yml'
  8. - 'requirements-*.txt'
  9. - '.python-version'
  10. - '.envrc'
  11. - 'Brewfile'
  12. - 'scripts/*'
  13. - 'tools/*'
  14. - 'src/sentry/runner/commands/devserver.py'
  15. - 'src/sentry/runner/commands/devservices.py'
  16. - 'bin/load-mocks'
  17. jobs:
  18. # This workflow is optimized to test the dev env with dev services as fast as possible
  19. # The bootstrap workflow (see last workflow) tests the experience of first time engineers
  20. docker-setup:
  21. name: Docker set up
  22. runs-on: macos-11
  23. timeout-minutes: 30
  24. env:
  25. # Make the environment more similar to what Mac defaults to
  26. SHELL: /bin/zsh
  27. steps:
  28. - name: Checkout sentry
  29. uses: actions/checkout@7884fcad6b5d53d10323aee724dc68d8b9096a2e # v2
  30. - name: Set up
  31. id: info
  32. run: |
  33. echo "::set-output name=yarn-cache-dir::$(yarn cache dir)"
  34. # Trick for unattended Docker installations
  35. # https://github.com/docker/for-mac/issues/2359#issuecomment-943131345
  36. # NOTE: This can sometimes take up to 10 minutes
  37. - name: Install Docker
  38. run: |
  39. HOMEBREW_NO_AUTO_UPDATE=1 brew install -v --cask docker
  40. sudo /Applications/Docker.app/Contents/MacOS/Docker --unattended --install-privileged-components
  41. open -a /Applications/Docker.app --args --unattended --accept-license
  42. - name: Install missing brew packages
  43. run: |
  44. HOMEBREW_NO_AUTO_UPDATE=1 brew install -v libxmlsec1
  45. - uses: ./.github/actions/setup-volta
  46. # This handles Python's cache
  47. - name: Setup Python & cache
  48. uses: actions/setup-python@c4e89fac7e8767b327bbad6cb4d859eda999cf08 # v4
  49. with:
  50. python-version: 3.8.13
  51. cache: 'pip'
  52. cache-dependency-path: requirements-dev-frozen.txt
  53. # This tests starting up the dev services, loading mocks and pre-commit installation
  54. # This can take over 15 minutes
  55. - name: make bootstrap
  56. run: |
  57. python -m venv .venv
  58. source .venv/bin/activate
  59. make bootstrap
  60. # The pyenv set up takes long, thus, separating it into its own
  61. pyenv-setup:
  62. name: pyenv set up
  63. runs-on: macos-11
  64. timeout-minutes: 25
  65. env:
  66. # This is to support this code https://github.com/getsentry/sentry/blob/47b837a69c38e190a7555de81e6d7d216498b854/scripts/pyenv_setup.sh#L17-L40
  67. SHELL: /bin/zsh
  68. steps:
  69. - name: Checkout sentry
  70. uses: actions/checkout@7884fcad6b5d53d10323aee724dc68d8b9096a2e # v2
  71. - name: Install pyenv
  72. run: |
  73. HOMEBREW_NO_AUTO_UPDATE=1 brew install pyenv
  74. # Only after we source ~/.zprofile that the right Python will be selected
  75. - name: Set up pyenv
  76. run: |
  77. make setup-pyenv
  78. [[ $(which python) != "${HOME}/.pyenv/shims/python" ]]
  79. source ~/.zprofile
  80. [[ $(which python) == "${HOME}/.pyenv/shims/python" ]]
  81. [[ $(python -V) == "Python $(cat .python-version)" ]]
  82. python -m venv .venv
  83. source .venv/bin/activate
  84. [[ $(python -V) == "Python $(cat .python-version)" ]]
  85. tools-tests:
  86. runs-on: ubuntu-20.04
  87. timeout-minutes: 5
  88. steps:
  89. - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3
  90. - uses: actions/setup-python@c4e89fac7e8767b327bbad6cb4d859eda999cf08 # v4
  91. with:
  92. python-version: 3.8.13
  93. cache: pip
  94. cache-dependency-path: requirements-dev-only-frozen.txt
  95. - name: install dependencies
  96. run: pip install -r requirements-dev-only-frozen.txt
  97. - name: run tests
  98. run: make test-tools
  99. - name: Handle artifacts
  100. uses: ./.github/actions/artifacts
  101. # We don't yet test the bootstrap step
  102. # https://github.com/getsentry/bootstrap-sentry/blob/7af557be84920dd587e48613dbc308c937bc0e08/bootstrap.sh#L618-L619
  103. bootstrap-script:
  104. runs-on: macos-11
  105. timeout-minutes: 40
  106. env:
  107. # Make the environment more similar to what Mac defaults to
  108. SHELL: /bin/zsh
  109. steps:
  110. - name: Run bootstrap code
  111. env:
  112. STRAP_DEBUG: 1
  113. # This ensures that the bootstrap code will test against this branch
  114. CI_CHECKOUT_BRANCH: ${{ github.head_ref || github.sha }}
  115. run: |
  116. bash <(curl -s https://raw.githubusercontent.com/getsentry/bootstrap-sentry/main/bootstrap.sh)