development-environment.yml 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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_MIN: 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@7884fcad6b5d53d10323aee724dc68d8b9096a2e # v2
  38. - name: Set up
  39. id: info
  40. run: |
  41. echo "::set-output name=yarn-cache-dir::$(yarn cache dir)"
  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: ./.github/actions/setup-volta
  53. # This handles Python's cache
  54. - name: Setup Python & cache
  55. uses: actions/setup-python@b4fe97ecda6b7a5fcd2448cdbf6a8fc76b3bedb0
  56. with:
  57. python-version: 3.8.13
  58. cache: 'pip'
  59. cache-dependency-path: requirements-dev-frozen.txt
  60. # This tests starting up the dev services, loading mocks and pre-commit installation
  61. # This can take over 15 minutes
  62. - name: make bootstrap
  63. # GHA pythons are miscompiled and report macos 10.16
  64. env:
  65. SYSTEM_VERSION_COMPAT: 0
  66. run: |
  67. python -m venv .venv
  68. source .venv/bin/activate
  69. make bootstrap
  70. # The pyenv set up takes long, thus, separating it into its own
  71. pyenv-setup:
  72. name: pyenv set up
  73. runs-on: macos-11
  74. timeout-minutes: 25
  75. env:
  76. # This is to support this code https://github.com/getsentry/sentry/blob/47b837a69c38e190a7555de81e6d7d216498b854/scripts/pyenv_setup.sh#L17-L40
  77. SHELL: /bin/zsh
  78. steps:
  79. - name: Checkout sentry
  80. uses: actions/checkout@7884fcad6b5d53d10323aee724dc68d8b9096a2e # v2
  81. - name: Install pyenv
  82. run: |
  83. HOMEBREW_NO_AUTO_UPDATE=1 brew install pyenv
  84. # Only after we source ~/.zprofile that the right Python will be selected
  85. - name: Set up pyenv
  86. run: |
  87. make setup-pyenv
  88. [[ $(which python) != "${HOME}/.pyenv/shims/python" ]]
  89. source ~/.zprofile
  90. [[ $(which python) == "${HOME}/.pyenv/shims/python" ]]
  91. [[ $(python -V) == "Python $(cat .python-version)" ]]
  92. python -m venv .venv
  93. source .venv/bin/activate
  94. [[ $(python -V) == "Python $(cat .python-version)" ]]
  95. tools-tests:
  96. runs-on: ubuntu-20.04
  97. timeout-minutes: 5
  98. steps:
  99. - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3
  100. - uses: actions/setup-python@b4fe97ecda6b7a5fcd2448cdbf6a8fc76b3bedb0
  101. with:
  102. python-version: 3.8.13
  103. cache: pip
  104. cache-dependency-path: requirements-dev-only-frozen.txt
  105. - name: install dependencies
  106. run: pip install -r requirements-dev-only-frozen.txt
  107. - name: run tests
  108. run: make test-tools
  109. - name: Handle artifacts
  110. uses: ./.github/actions/artifacts
  111. # We don't yet test the bootstrap step
  112. # https://github.com/getsentry/bootstrap-sentry/blob/7af557be84920dd587e48613dbc308c937bc0e08/bootstrap.sh#L618-L619
  113. bootstrap-script:
  114. runs-on: macos-11
  115. timeout-minutes: 40
  116. env:
  117. # Make the environment more similar to what Mac defaults to
  118. SHELL: /bin/zsh
  119. steps:
  120. - name: Run bootstrap code
  121. env:
  122. STRAP_DEBUG: 1
  123. # This ensures that the bootstrap code will test against this branch
  124. CI_CHECKOUT_BRANCH: ${{ github.head_ref || github.sha }}
  125. run: |
  126. bash <(curl -s https://raw.githubusercontent.com/getsentry/bootstrap-sentry/main/bootstrap.sh)