development-environment.yml 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. name: development environment
  2. on:
  3. pull_request:
  4. paths:
  5. - 'Brewfile'
  6. - 'Makefile'
  7. - '.github/workflows/development-environment.yml'
  8. - 'scripts/*'
  9. - 'src/sentry/runner/commands/devserver.py'
  10. - 'src/sentry/runner/commands/devservices.py'
  11. jobs:
  12. dev-environment:
  13. name: python set up
  14. runs-on: ${{ matrix.os }}
  15. timeout-minutes: 20
  16. strategy:
  17. matrix:
  18. os: [ macos-11.0 ]
  19. steps:
  20. - uses: actions/checkout@v2
  21. - name: Install prerequisites
  22. if: ${{ runner.os == 'macOS' }}
  23. # Depending on the host watchman will not install (read: intermittent issue),
  24. # thus, we mark this as continue-on-error
  25. continue-on-error: true
  26. # Xcode CLI & brew are already installed, thus, no need to call xcode-select install
  27. # XXX: Can the Brew set up be cached?
  28. run: |
  29. brew bundle
  30. - name: Set environment variables
  31. shell: bash
  32. run: |
  33. echo "PYENV_ROOT=$HOME/.pyenv" >> $GITHUB_ENV
  34. echo "VOLTA_HOME=$HOME/.volta" >> $GITHUB_ENV
  35. echo "PATH=$HOME/.pyenv/shims:$HOME/.volta/bin:$PATH" >> $GITHUB_ENV
  36. - name: Install Python (via Pyenv)
  37. id: python-version
  38. shell: bash
  39. # XXX: Locally, pyenv makes 3.6.10 be the selected version in use,
  40. # however, in here it selects /usr/local/bin/python. I'm using `pyenv global` to work around it
  41. # XXX: Can we cache the installed Python environments?
  42. run: |
  43. make setup-pyenv
  44. pyenv global 3.6.10
  45. echo "::set-output name=python-version::$(python -V | sed s/Python\ //g)"
  46. - name: Setup pip
  47. uses: ./.github/actions/setup-pip
  48. id: pip
  49. - name: Cache
  50. uses: actions/cache@v2
  51. with:
  52. path: |
  53. ${{ steps.pip.outputs.pip-cache-dir }}
  54. ~/.pyenv
  55. key: ${{ runner.os }}-pip-py${{ steps.python-version.outputs.python-version }}-${{ hashFiles('**/requirements-*.txt') }}
  56. restore-keys: |
  57. ${{ runner.os }}-pip-py${{ steps.python-version.outputs.python-version }}
  58. - name: Set up development environment (as per docs)
  59. run: |
  60. python -m venv .venv
  61. source .venv/bin/activate
  62. make install-py-dev
  63. make setup-git
  64. curl https://get.volta.sh | bash
  65. - name: Set up Sentry and others
  66. # We cannot call make bootstrap directly since run-dependent-services requires some Docker magic.
  67. # We have the magic in the getsentry/bootstrap-develop. We will handle this situation in the next pass of this.
  68. # make init-config will *not* prompt about overwriting ~/.sentry/config.yml' since we're on a pristine state
  69. # We cannot test the git hooks until the `sentry.lint.engine` gets installed
  70. run: |
  71. source .venv/bin/activate
  72. make develop init-config