123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- name: dev env
- on:
- pull_request:
- paths:
- - '.pre-commit-config.yaml'
- - 'Makefile'
- - '.github/workflows/development-environment.yml'
- - 'requirements-*.txt'
- - '.python-version'
- - '.envrc'
- - 'Brewfile'
- - 'scripts/*'
- - 'tools/*'
- - 'src/sentry/runner/commands/devserver.py'
- - 'src/sentry/runner/commands/devservices.py'
- - 'bin/load-mocks'
- # Cancel in progress workflows on pull_requests.
- # https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value
- concurrency:
- group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
- cancel-in-progress: true
- # hack for https://github.com/actions/cache/issues/810#issuecomment-1222550359
- env:
- SEGMENT_DOWNLOAD_TIMEOUT_MINS: 3
- jobs:
- # This workflow is optimized to test the dev env with dev services as fast as possible
- # The bootstrap workflow (see last workflow) tests the experience of first time engineers
- docker-setup:
- name: Docker set up
- runs-on: macos-11
- timeout-minutes: 30
- env:
- # Make the environment more similar to what Mac defaults to
- SHELL: /bin/zsh
- steps:
- - name: Checkout sentry
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
- - name: Set up
- id: info
- run: |
- echo "yarn-cache-dir=$(yarn cache dir)" >> "$GITHUB_OUTPUT"
- # Trick for unattended Docker installations
- # https://github.com/docker/for-mac/issues/2359#issuecomment-943131345
- # NOTE: This can sometimes take up to 10 minutes
- - name: Install Docker
- run: |
- # d4m 4.11+ never starts: https://github.com/docker/for-mac/issues/6450
- curl -o /tmp/docker.rb https://raw.githubusercontent.com/Homebrew/homebrew-cask/fe866ec0765de141599745f03e215452db7f511b/Casks/docker.rb
- HOMEBREW_NO_AUTO_UPDATE=1 brew install -v --HEAD -s /tmp/docker.rb
- sudo /Applications/Docker.app/Contents/MacOS/Docker --unattended --install-privileged-components
- open -a /Applications/Docker.app --args --unattended --accept-license
- - uses: getsentry/action-setup-volta@54775a59c41065f54ecc76d1dd5f2cdc7a1550cb # v1.1.0
- # This handles Python's cache
- - name: Setup Python & cache
- uses: actions/setup-python@13ae5bb136fac2878aff31522b9efb785519f984 # v4.3.0
- with:
- python-version: 3.8.13
- cache: 'pip'
- cache-dependency-path: requirements-dev-frozen.txt
- # This tests starting up the dev services, loading mocks and pre-commit installation
- # This can take over 15 minutes
- - name: make bootstrap
- # GHA pythons are miscompiled and report macos 10.16
- env:
- SYSTEM_VERSION_COMPAT: 0
- run: |
- python -m venv .venv
- source .venv/bin/activate
- make bootstrap
- # The pyenv set up takes long, thus, separating it into its own
- pyenv-setup:
- name: pyenv set up
- runs-on: macos-11
- timeout-minutes: 25
- env:
- # This is to support this code https://github.com/getsentry/sentry/blob/47b837a69c38e190a7555de81e6d7d216498b854/scripts/pyenv_setup.sh#L17-L40
- SHELL: /bin/zsh
- steps:
- - name: Checkout sentry
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
- - name: Install pyenv
- run: |
- HOMEBREW_NO_AUTO_UPDATE=1 brew install pyenv
- # Only after we source ~/.zprofile that the right Python will be selected
- - name: Set up pyenv
- run: |
- make setup-pyenv
- [[ $(which python) != "${HOME}/.pyenv/shims/python" ]]
- source ~/.zprofile
- [[ $(which python) == "${HOME}/.pyenv/shims/python" ]]
- [[ $(python -V) == "Python $(cat .python-version)" ]]
- python -m venv .venv
- source .venv/bin/activate
- [[ $(python -V) == "Python $(cat .python-version)" ]]
- tools-tests:
- runs-on: ubuntu-20.04
- timeout-minutes: 5
- steps:
- - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
- - uses: actions/setup-python@13ae5bb136fac2878aff31522b9efb785519f984 # v4.3.0
- with:
- python-version: 3.8.13
- cache: pip
- cache-dependency-path: |
- requirements-dev.txt
- requirements-dev-frozen.txt
- - name: install dependencies
- run: pip install -r requirements-dev.txt -c requirements-dev-frozen.txt
- - name: run tests
- run: make test-tools
- - name: Handle artifacts
- uses: ./.github/actions/artifacts
- # We don't yet test the bootstrap step
- # https://github.com/getsentry/bootstrap-sentry/blob/7af557be84920dd587e48613dbc308c937bc0e08/bootstrap.sh#L618-L619
- bootstrap-script:
- runs-on: macos-11
- timeout-minutes: 40
- env:
- # Make the environment more similar to what Mac defaults to
- SHELL: /bin/zsh
- steps:
- - name: Run bootstrap code
- env:
- STRAP_DEBUG: 1
- # This ensures that the bootstrap code will test against this branch
- CI_CHECKOUT_BRANCH: ${{ github.head_ref || github.sha }}
- run: |
- bash <(curl -s https://raw.githubusercontent.com/getsentry/bootstrap-sentry/main/bootstrap.sh)
|