development-environment.yml 4.4 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. - '.github/actions/setup-python'
  11. - '.envrc'
  12. - 'Brewfile'
  13. - 'scripts/*'
  14. - 'tools/*'
  15. - 'src/sentry/runner/commands/devserver.py'
  16. - 'src/sentry/runner/commands/devservices.py'
  17. - 'bin/load-mocks'
  18. jobs:
  19. # This workflow is optimized to test the dev env with dev services as fast as possible
  20. # The bootstrap workflow (see last workflow) tests the experience of first time engineers
  21. docker-setup:
  22. name: Docker set up
  23. runs-on: macos-11
  24. timeout-minutes: 30
  25. env:
  26. # Make the environment more similar to what Mac defaults to
  27. SHELL: /bin/zsh
  28. steps:
  29. - name: Checkout sentry
  30. uses: actions/checkout@v2
  31. - name: Set up
  32. id: info
  33. run: |
  34. echo "::set-output name=yarn-cache-dir::$(yarn cache dir)"
  35. # Trick for unattended Docker installations
  36. # https://github.com/docker/for-mac/issues/2359#issuecomment-943131345
  37. # NOTE: This can sometimes take up to 10 minutes
  38. - name: Install Docker
  39. run: |
  40. HOMEBREW_NO_AUTO_UPDATE=1 brew install -v --cask docker
  41. sudo /Applications/Docker.app/Contents/MacOS/Docker --unattended --install-privileged-components
  42. open -a /Applications/Docker.app --args --unattended --accept-license
  43. - name: Install missing brew packages
  44. run: |
  45. HOMEBREW_NO_AUTO_UPDATE=1 brew install -v libxmlsec1
  46. - uses: ./.github/actions/setup-volta
  47. # This handles Python's cache
  48. - name: Setup Python & cache
  49. uses: ./.github/actions/setup-python
  50. # Remove this block when 3.8.13 becomes available in:
  51. # https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json
  52. with:
  53. python-version: 3.8.12
  54. # This tests starting up the dev services, loading mocks and pre-commit installation
  55. # This can take over 15 minutes
  56. - name: make bootstrap
  57. run: |
  58. python -m venv .venv
  59. source .venv/bin/activate
  60. make bootstrap
  61. # The pyenv set up takes long, thus, separating it into its own
  62. pyenv-setup:
  63. name: pyenv set up
  64. runs-on: macos-11
  65. timeout-minutes: 25
  66. env:
  67. # This is to support this code https://github.com/getsentry/sentry/blob/47b837a69c38e190a7555de81e6d7d216498b854/scripts/pyenv_setup.sh#L17-L40
  68. SHELL: /bin/zsh
  69. steps:
  70. - name: Checkout sentry
  71. uses: actions/checkout@v2
  72. - name: Install pyenv
  73. run: |
  74. HOMEBREW_NO_AUTO_UPDATE=1 brew install pyenv
  75. # Only after we source ~/.zprofile that the right Python will be selected
  76. - name: Set up pyenv
  77. run: |
  78. make setup-pyenv
  79. [[ $(which python) != "${HOME}/.pyenv/shims/python" ]]
  80. source ~/.zprofile
  81. [[ $(which python) == "${HOME}/.pyenv/shims/python" ]]
  82. [[ $(python -V) == "Python $(cat .python-version)" ]]
  83. python -m venv .venv
  84. source .venv/bin/activate
  85. [[ $(python -V) == "Python $(cat .python-version)" ]]
  86. tools-tests:
  87. runs-on: ubuntu-20.04
  88. timeout-minutes: 5
  89. steps:
  90. - uses: actions/checkout@v3
  91. - uses: actions/setup-python@v3
  92. with:
  93. python-version: 3.8.12
  94. cache: 'pip'
  95. cache-dependency-path: |
  96. 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)