development-environment.yml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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. # d4m 4.11+ never starts: https://github.com/docker/for-mac/issues/6450
  40. curl -o /tmp/docker.rb https://raw.githubusercontent.com/Homebrew/homebrew-cask/fe866ec0765de141599745f03e215452db7f511b/Casks/docker.rb
  41. HOMEBREW_NO_AUTO_UPDATE=1 brew install -v --HEAD -s /tmp/docker.rb
  42. sudo /Applications/Docker.app/Contents/MacOS/Docker --unattended --install-privileged-components
  43. open -a /Applications/Docker.app --args --unattended --accept-license
  44. - name: Install missing brew packages
  45. run: |
  46. HOMEBREW_NO_AUTO_UPDATE=1 brew install -v libxmlsec1
  47. - uses: ./.github/actions/setup-volta
  48. # This handles Python's cache
  49. - name: Setup Python & cache
  50. uses: actions/setup-python@c4e89fac7e8767b327bbad6cb4d859eda999cf08 # v4
  51. with:
  52. python-version: 3.8.13
  53. cache: 'pip'
  54. cache-dependency-path: requirements-dev-frozen.txt
  55. # This tests starting up the dev services, loading mocks and pre-commit installation
  56. # This can take over 15 minutes
  57. - name: make bootstrap
  58. run: |
  59. python -m venv .venv
  60. source .venv/bin/activate
  61. make bootstrap
  62. # The pyenv set up takes long, thus, separating it into its own
  63. pyenv-setup:
  64. name: pyenv set up
  65. runs-on: macos-11
  66. timeout-minutes: 25
  67. env:
  68. # This is to support this code https://github.com/getsentry/sentry/blob/47b837a69c38e190a7555de81e6d7d216498b854/scripts/pyenv_setup.sh#L17-L40
  69. SHELL: /bin/zsh
  70. steps:
  71. - name: Checkout sentry
  72. uses: actions/checkout@7884fcad6b5d53d10323aee724dc68d8b9096a2e # v2
  73. - name: Install pyenv
  74. run: |
  75. HOMEBREW_NO_AUTO_UPDATE=1 brew install pyenv
  76. # Only after we source ~/.zprofile that the right Python will be selected
  77. - name: Set up pyenv
  78. run: |
  79. make setup-pyenv
  80. [[ $(which python) != "${HOME}/.pyenv/shims/python" ]]
  81. source ~/.zprofile
  82. [[ $(which python) == "${HOME}/.pyenv/shims/python" ]]
  83. [[ $(python -V) == "Python $(cat .python-version)" ]]
  84. python -m venv .venv
  85. source .venv/bin/activate
  86. [[ $(python -V) == "Python $(cat .python-version)" ]]
  87. tools-tests:
  88. runs-on: ubuntu-20.04
  89. timeout-minutes: 5
  90. steps:
  91. - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3
  92. - uses: actions/setup-python@c4e89fac7e8767b327bbad6cb4d859eda999cf08 # v4
  93. with:
  94. python-version: 3.8.13
  95. cache: pip
  96. cache-dependency-path: requirements-dev-only-frozen.txt
  97. - name: install dependencies
  98. run: pip install -r requirements-dev-only-frozen.txt
  99. - name: run tests
  100. run: make test-tools
  101. - name: Handle artifacts
  102. uses: ./.github/actions/artifacts
  103. # We don't yet test the bootstrap step
  104. # https://github.com/getsentry/bootstrap-sentry/blob/7af557be84920dd587e48613dbc308c937bc0e08/bootstrap.sh#L618-L619
  105. bootstrap-script:
  106. runs-on: macos-11
  107. timeout-minutes: 40
  108. env:
  109. # Make the environment more similar to what Mac defaults to
  110. SHELL: /bin/zsh
  111. steps:
  112. - name: Run bootstrap code
  113. env:
  114. STRAP_DEBUG: 1
  115. # This ensures that the bootstrap code will test against this branch
  116. CI_CHECKOUT_BRANCH: ${{ github.head_ref || github.sha }}
  117. run: |
  118. bash <(curl -s https://raw.githubusercontent.com/getsentry/bootstrap-sentry/main/bootstrap.sh)