development-environment.yml 3.3 KB

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