development-environment.yml 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. # If you want to speed up the CI for your PR, you can use --no-upgrade and HOMEBREW_NO_AUTO_UPDATE=1
  40. run: |
  41. brew bundle || brew update && brew bundle
  42. - name: Install Python (via Pyenv)
  43. id: python-version
  44. # XXX: Can we cache the installed Python environments?
  45. # We echo to $GITHUB_ENV to make the PATH changes by pyenv init permanent for the rest of the execution
  46. run: |
  47. make setup-pyenv
  48. eval "$(pyenv init -)"
  49. echo "PATH=$PATH" >> $GITHUB_ENV
  50. echo "::set-output name=python-version::$(python -V | sed s/Python\ //g)"
  51. - name: Setup pip
  52. uses: ./.github/actions/setup-pip
  53. id: pip
  54. - name: Cache
  55. uses: actions/cache@v2
  56. with:
  57. path: |
  58. ${{ steps.pip.outputs.pip-cache-dir }}
  59. ~/.pyenv
  60. key: ${{ matrix.os }}-py${{ steps.python-version.outputs.python-version }}-pip${{ steps.pip.outputs.pip-version }}-${{ hashFiles('**/requirements-*.txt') }}
  61. restore-keys: |
  62. ${{ matrix.os }}-py${{ steps.python-version.outputs.python-version }}-pip${{ steps.pip.outputs.pip-version }}
  63. - name: Get yarn cache directory path
  64. id: yarn-cache-dir-path
  65. run: echo "::set-output name=dir::$(yarn cache dir)"
  66. - uses: actions/cache@v2
  67. id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
  68. with:
  69. path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
  70. key: ${{ matrix.os }}-yarn-${{ hashFiles('yarn.lock', 'api-docs/yarn.lock') }}
  71. restore-keys: |
  72. ${{ matrix.os }}-yarn-
  73. - name: Set up development environment (as per docs)
  74. run: |
  75. python -m venv .venv
  76. source .venv/bin/activate
  77. make install-py-dev
  78. make setup-git
  79. curl https://get.volta.sh | bash
  80. - name: Set up Sentry and others
  81. # We cannot call make bootstrap directly since run-dependent-services requires some Docker magic.
  82. # We have the magic in the getsentry/bootstrap-develop. We will handle this situation in the next pass of this.
  83. # make init-config will *not* prompt about overwriting ~/.sentry/config.yml' since we're on a pristine state
  84. # We cannot test the git hooks until the `sentry.lint.engine` gets installed
  85. run: |
  86. source .venv/bin/activate
  87. make develop init-config