development-environment.yml 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. name: dev env
  2. on:
  3. pull_request:
  4. paths:
  5. - 'Makefile'
  6. - '.github/actions/*'
  7. - '.github/workflows/development-environment.yml'
  8. - '.envrc'
  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: 40
  18. strategy:
  19. matrix:
  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: Set variables for caches
  32. id: info
  33. run: |
  34. echo "::set-output name=brew-cache-dir::$(brew --cache)"
  35. echo "::set-output name=yarn-cache-dir::$(yarn cache dir)"
  36. - name: Cache (brew)
  37. uses: actions/cache@v2
  38. with:
  39. path: ${{ steps.info.outputs.brew-cache-dir }}
  40. key: devenv-${{ runner.os }}-brew-${{ hashFiles('Brewfile') }}
  41. restore-keys: devenv-${{ runner.os }}-brew
  42. - name: Install prerequisites
  43. # brew can be finicky but it does not always means that the rest of the job will fail
  44. # Xcode CLI & brew are already installed, thus, no need to call xcode-select install
  45. # Sometimes, brew needs to be updated before brew bundle would work
  46. run: |
  47. brew update -q && brew bundle -q || exit 0
  48. - name: Setup Python
  49. uses: ./.github/actions/setup-python
  50. - name: Cache (pyenv)
  51. uses: actions/cache@v2
  52. with:
  53. path: ~/.pyenv
  54. key: devenv-${{ matrix.os }}-pyenv-${{ hashFiles('.python-version') }}
  55. - name: Cache (yarn)
  56. uses: actions/cache@v1 # We are explicitly using v1 due to perf reasons
  57. with:
  58. path: ${{ steps.info.outputs.yarn-cache-dir }}
  59. key: devenv-${{ matrix.os }}-v2-yarn-${{ hashFiles('yarn.lock') }}
  60. - name: Set up development environment (mostly as per docs)
  61. run: |
  62. curl https://get.volta.sh | bash
  63. export VOLTA_HOME="$HOME/.volta"
  64. export PATH="$HOME/.volta/bin:$PATH"
  65. make setup-pyenv
  66. eval "$(pyenv init --path)"
  67. python -m venv .venv
  68. source .venv/bin/activate
  69. make develop init-config