development-environment.yml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. name: dev env
  2. on:
  3. pull_request:
  4. paths:
  5. - 'Makefile'
  6. - '.github/workflows/development-environment.yml'
  7. - '.envrc'
  8. - 'requirements*'
  9. - 'Brewfile'
  10. - 'scripts/*'
  11. - 'src/sentry/runner/commands/devserver.py'
  12. - 'src/sentry/runner/commands/devservices.py'
  13. jobs:
  14. dev-environment:
  15. name: set up
  16. runs-on: ${{ matrix.os }}
  17. timeout-minutes: 35
  18. strategy:
  19. matrix:
  20. # macosx-10.15 is Catalina
  21. # macosx-11.0 is Big Sur, however, it takes long for jobs to get started
  22. # Using Ubuntu 18 until I figure out this error:
  23. # -> ImportError: libffi.so.6: cannot open shared object file: No such file or directory
  24. os: [ macos-10.15, macos-11.0, ubuntu-18.04 ]
  25. fail-fast: false
  26. env:
  27. PIP_DISABLE_PIP_VERSION_CHECK: on
  28. # Make the environment more similar to what Mac defaults to
  29. SHELL: /bin/zsh
  30. steps:
  31. - name: Checkout sentry
  32. uses: actions/checkout@v2
  33. - name: Install prerequisites
  34. # Xcode CLI & brew are already installed, thus, no need to call xcode-select install
  35. # Sometimes, brew needs to be updated before brew bundle would work
  36. # After installing Docker (via homebrew) we need to make sure that it is properly initialized on Mac
  37. run: |
  38. brew update -q && brew bundle -q
  39. # This code is mentioned in our dev docs. Only remove if you adjust the docs as well
  40. SENTRY_NO_VENV_CHECK=1 ./scripts/do.sh init-docker
  41. # The next few steps are to set up the cache quickly
  42. - name: Set environment variables & others
  43. id: info
  44. run: |
  45. echo "::set-output name=python-version::$(cat .python-version)"
  46. echo "::set-output name=pip-cache-dir::$(pip3 cache dir)"
  47. echo "::set-output name=pip-version::$(pip -V | awk -F ' ' '{print $2}')"
  48. echo "::set-output name=yarn-cache-dir::$(yarn cache dir)"
  49. # In a sense, we set up Python two times (once here and once via pyenv). Setting
  50. # it up here is instant and it helps us to get the cache primed sooner
  51. - name: Setup Python
  52. uses: actions/setup-python@v2
  53. with:
  54. python-version: ${{ steps.info.outputs.python-version }}
  55. - name: Cache (pyenv)
  56. uses: actions/cache@v2
  57. with:
  58. path: ~/.pyenv
  59. key: devenv-${{ matrix.os }}-pyenv-${{ hashFiles('.python-version') }}
  60. restore-keys: |
  61. devenv-${{ matrix.os }}-pyenv-
  62. - name: Cache (pip)
  63. uses: actions/cache@v2
  64. with:
  65. path: ${{ steps.info.outputs.pip-cache-dir }}
  66. key: devenv-${{ matrix.os }}-py${{ steps.info.outputs.python-version }}-pip${{ steps.info.outputs.pip-version }}-${{ hashFiles('**/requirements.txt') }}
  67. restore-keys: |
  68. devenv-${{ matrix.os }}-py${{ steps.info.outputs.python-version }}-pip${{ steps.info.outputs.pip-version }}-
  69. - name: Cache (yarn)
  70. uses: actions/cache@v2
  71. id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
  72. with:
  73. path: ${{ steps.info.outputs.yarn-cache-dir }}
  74. key: devenv-${{ matrix.os }}-yarn-${{ hashFiles('yarn.lock') }}
  75. restore-keys: |
  76. devenv-${{ matrix.os }}-yarn-
  77. - name: Set up development environment (mostly as per docs)
  78. run: |
  79. curl https://get.volta.sh | bash
  80. export VOLTA_HOME="$HOME/.volta"
  81. export PATH="$HOME/.volta/bin:$PATH"
  82. make setup-pyenv
  83. eval "$(pyenv init --path)"
  84. python -m venv .venv
  85. source .venv/bin/activate
  86. make bootstrap
  87. - name: Test direnv
  88. run: |
  89. brew install direnv
  90. direnv allow