development-environment.yml 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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. # Cancel in progress workflows on pull_requests.
  18. # https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value
  19. concurrency:
  20. group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
  21. cancel-in-progress: true
  22. # hack for https://github.com/actions/cache/issues/810#issuecomment-1222550359
  23. env:
  24. SEGMENT_DOWNLOAD_TIMEOUT_MINS: 3
  25. jobs:
  26. # This workflow is optimized to test the dev env with dev services as fast as possible
  27. # The bootstrap workflow (see last workflow) tests the experience of first time engineers
  28. docker-setup:
  29. name: Docker set up
  30. runs-on: macos-11
  31. timeout-minutes: 30
  32. env:
  33. # Make the environment more similar to what Mac defaults to
  34. SHELL: /bin/zsh
  35. steps:
  36. - name: Checkout sentry
  37. uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
  38. - name: Set up
  39. id: info
  40. run: |
  41. echo "yarn-cache-dir=$(yarn cache dir)" >> "$GITHUB_OUTPUT"
  42. # Trick for unattended Docker installations
  43. # https://github.com/docker/for-mac/issues/2359#issuecomment-943131345
  44. # NOTE: This can sometimes take up to 10 minutes
  45. - name: Install Docker
  46. run: |
  47. # d4m 4.11+ never starts: https://github.com/docker/for-mac/issues/6450
  48. curl -o /tmp/docker.rb https://raw.githubusercontent.com/Homebrew/homebrew-cask/fe866ec0765de141599745f03e215452db7f511b/Casks/docker.rb
  49. HOMEBREW_NO_AUTO_UPDATE=1 brew install -v --HEAD -s /tmp/docker.rb
  50. sudo /Applications/Docker.app/Contents/MacOS/Docker --unattended --install-privileged-components
  51. open -a /Applications/Docker.app --args --unattended --accept-license
  52. - uses: getsentry/action-setup-volta@54775a59c41065f54ecc76d1dd5f2cdc7a1550cb # v1.1.0
  53. # This handles Python's cache
  54. - uses: getsentry/action-setup-venv@9e3bbae3836b1b6f129955bf55a19e1d99a61c67 # v1.0.5
  55. with:
  56. python-version: 3.8.16
  57. cache-dependency-path: requirements-dev-frozen.txt
  58. # This tests starting up the dev services, loading mocks and pre-commit installation
  59. # This can take over 15 minutes
  60. - name: make bootstrap
  61. # GHA pythons are miscompiled and report macos 10.16
  62. env:
  63. SYSTEM_VERSION_COMPAT: 0
  64. run: make bootstrap
  65. # The pyenv set up takes long, thus, separating it into its own
  66. pyenv-setup:
  67. name: pyenv set up
  68. runs-on: macos-11
  69. timeout-minutes: 25
  70. env:
  71. # This is to support this code https://github.com/getsentry/sentry/blob/47b837a69c38e190a7555de81e6d7d216498b854/scripts/pyenv_setup.sh#L17-L40
  72. SHELL: /bin/zsh
  73. steps:
  74. - name: Checkout sentry
  75. uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
  76. - name: Install pyenv
  77. run: |
  78. HOMEBREW_NO_AUTO_UPDATE=1 brew install pyenv
  79. # Only after we source ~/.zprofile that the right Python will be selected
  80. - name: Set up pyenv
  81. run: |
  82. make setup-pyenv
  83. [[ $(which python) != "${HOME}/.pyenv/shims/python" ]]
  84. source ~/.zprofile
  85. [[ $(which python) == "${HOME}/.pyenv/shims/python" ]]
  86. [[ $(python -V) == "Python $(cat .python-version)" ]]
  87. python -m venv .venv
  88. source .venv/bin/activate
  89. [[ $(python -V) == "Python $(cat .python-version)" ]]
  90. tools-tests:
  91. runs-on: ubuntu-20.04
  92. timeout-minutes: 5
  93. steps:
  94. - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
  95. - uses: getsentry/action-setup-venv@9e3bbae3836b1b6f129955bf55a19e1d99a61c67 # v1.0.5
  96. with:
  97. python-version: 3.8.16
  98. cache-dependency-path: |
  99. requirements-dev.txt
  100. requirements-dev-frozen.txt
  101. install-cmd: pip install -r requirements-dev.txt -c requirements-dev-frozen.txt
  102. - name: run tests
  103. run: make test-tools
  104. - name: Handle artifacts
  105. uses: ./.github/actions/artifacts
  106. # We don't yet test the bootstrap step
  107. # https://github.com/getsentry/bootstrap-sentry/blob/7af557be84920dd587e48613dbc308c937bc0e08/bootstrap.sh#L618-L619
  108. bootstrap-script:
  109. runs-on: macos-11
  110. timeout-minutes: 40
  111. env:
  112. # Make the environment more similar to what Mac defaults to
  113. SHELL: /bin/zsh
  114. steps:
  115. - name: Run bootstrap code
  116. env:
  117. STRAP_DEBUG: 1
  118. # This ensures that the bootstrap code will test against this branch
  119. CI_CHECKOUT_BRANCH: ${{ github.head_ref || github.sha }}
  120. run: |
  121. bash <(curl -s https://raw.githubusercontent.com/getsentry/bootstrap-sentry/main/bootstrap.sh)