development-environment.yml 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. name: dev env
  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: set up
  14. runs-on: ${{ matrix.os }}
  15. timeout-minutes: 35
  16. strategy:
  17. matrix:
  18. # macosx-10.15 is Catalina
  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-10.15, 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. - uses: actions/checkout@v2
  30. - name: Set environment variables & others
  31. run: |
  32. echo "VOLTA_HOME=$HOME/.volta" >> $GITHUB_ENV
  33. echo "PATH=$HOME/.volta/bin:$PATH" >> $GITHUB_ENV
  34. touch "$HOME/.zshrc"
  35. - name: Install prerequisites
  36. # Xcode CLI & brew are already installed, thus, no need to call xcode-select install
  37. # XXX: Can the Brew set up be cached?
  38. # Sometimes, brew needs to be updated before brew bundle would work
  39. # After installing Docker (via homebrew) we need to make sure that it is properly initialized on Mac
  40. run: |
  41. brew update -q && brew bundle -q
  42. # This code is mentioned in our dev docs. Only remove if you adjust the docs as well
  43. SENTRY_NO_VENV_CHECK=1 ./scripts/do.sh init-docker
  44. - name: Install Python (via Pyenv)
  45. id: python-version
  46. # We echo to $GITHUB_ENV to make the PATH changes by pyenv init permanent for the rest of the execution
  47. run: |
  48. make setup-pyenv
  49. eval "$(pyenv init -)"
  50. echo "PATH=$PATH" >> $GITHUB_ENV
  51. echo "::set-output name=python-version::$(python -V | sed s/Python\ //g)"
  52. - name: Setup pip
  53. uses: ./.github/actions/setup-pip
  54. id: pip
  55. - name: Cache
  56. uses: actions/cache@v2
  57. with:
  58. path: |
  59. ${{ steps.pip.outputs.pip-cache-dir }}
  60. ~/.pyenv
  61. key: |
  62. devenv-${{ matrix.os }}-py${{ steps.python-version.outputs.python-version }}-pip${{ steps.pip.outputs.pip-version }}-${{ hashFiles('requirements-*.txt') }}
  63. restore-keys: |
  64. devenv-${{ matrix.os }}-py${{ steps.python-version.outputs.python-version }}-pip${{ steps.pip.outputs.pip-version }}
  65. - name: Get yarn cache directory path
  66. id: yarn-cache-dir-path
  67. run: echo "::set-output name=dir::$(yarn cache dir)"
  68. - uses: actions/cache@v2
  69. id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
  70. with:
  71. path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
  72. key: ${{ matrix.os }}-yarn-${{ hashFiles('yarn.lock', 'api-docs/yarn.lock') }}
  73. restore-keys: |
  74. ${{ matrix.os }}-yarn-
  75. # make develop calls "ensure-venv", thus, needing to be within a venv
  76. # TODO: We need to streamline the installation of the wheel package
  77. - name: Set up development environment (mostly as per docs)
  78. run: |
  79. python -m venv .venv
  80. source .venv/bin/activate
  81. pip install wheel
  82. curl https://get.volta.sh | bash
  83. make bootstrap