forked from getsentry/sentry
120 lines (104 loc) · 4 KB
/
development-environment.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
name: dev env
on:
pull_request:
paths:
- '.pre-commit-config.yaml'
- 'Makefile'
- '.github/actions/setup-python'
- '.github/workflows/development-environment.yml'
- '.envrc'
- 'Brewfile'
- 'scripts/*'
- 'src/sentry/runner/commands/devserver.py'
- 'src/sentry/runner/commands/devservices.py'
- 'requirements-*.txt'
- 'bin/load-mocks'
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@v2
- name: Set variables for caches
id: info
run: |
echo "::set-output name=yarn-cache-dir::$(yarn cache dir)"
# 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: |
HOMEBREW_NO_AUTO_UPDATE=1 brew install -v --cask docker
sudo /Applications/Docker.app/Contents/MacOS/Docker --unattended --install-privileged-components
open -a /Applications/Docker.app --args --unattended --accept-license
- name: Install missing brew packages
run: |
HOMEBREW_NO_AUTO_UPDATE=1 brew install -v libxmlsec1
- name: Install volta
run: |
curl https://get.volta.sh | bash
# This handles Python's cache
- name: Setup Python & cache
uses: ./.github/actions/setup-python
- name: Cache (yarn)
uses: actions/cache@v1 # We are explicitly using v1 due to perf reasons
with:
path: ${{ steps.info.outputs.yarn-cache-dir }}
key: devenv-${{ runner.os }}-v1-yarn-${{ hashFiles('yarn.lock') }}
# This tests starting up the dev services, loading mocks and pre-commit installation
# This can take over 15 minutes
- name: make bootstrap
run: |
export VOLTA_HOME="$HOME/.volta"
export PATH="$HOME/.volta/bin:$PATH"
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: 15
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@v2
- 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)" ]]
# 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)