Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(dev): Install postgresql on Apple M1 to build psycopg2-binary #28607

Merged
merged 8 commits into from
Sep 23, 2021
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/development-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
fail-fast: false
env:
PIP_DISABLE_PIP_VERSION_CHECK: on
# Make the environment more similar to what Mac defaults to
# Make the environment more similar to hat Mac defaults to
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mistake?

SHELL: /bin/zsh

steps:
Expand All @@ -47,9 +47,9 @@ jobs:
- name: Install prerequisites
# brew can be finicky but it does not always means that the rest of the job will fail
# Xcode CLI & brew are already installed, thus, no need to call xcode-select install
# Sometimes, brew needs to be updated before brew bundle would work
continue-on-error: true
run: |
brew update -q && brew bundle -q || exit 0
make prerequisites

- name: Setup Python
uses: ./.github/actions/setup-python
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/python-deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ jobs:
- name: Install prerequisites
# brew can be finicky but it does not always means that the rest of the job will fail
run: |
# Needed for xmlsec
brew install libxmlsec1 pkg-config
make prerequisites

- name: Setup Python
uses: ./.github/actions/setup-python
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ install-py-dev :
build-platform-assets \
direnv-help \
upgrade-pip \
prerequisites \
setup-git-config :
@SENTRY_NO_VENV_CHECK=1 ./scripts/do.sh $@

Expand Down
4 changes: 3 additions & 1 deletion requirements-base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ Pillow==8.2.0; python_version == '3.6'
Pillow==8.3.1; python_version > '3.6'
progressbar2==3.32.0
python-rapidjson==1.4
psycopg2-binary==2.8.6
psycopg2-binary==2.8.6; python_version == '3.6'
# This removes needing to set CPPFLAGS & LDFLAGS
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we note that this only affects local development since we only support 3.6 in prod atm?

psycopg2-binary==2.9.1; python_version > '3.6'
PyJWT==2.1.0
python-dateutil==2.8.1
python-memcached==1.59
Expand Down
10 changes: 10 additions & 0 deletions scripts/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,16 @@ reset-db() {
apply-migrations
}

prerequisites() {
brew update -q && brew bundle -q
if query-apple-m1; then
# psycopg2-binary does not have an arm64 wheel, thus, we need to build it locally
# by installing postgresql
# See details: https://github.com/psycopg/psycopg2/issues/1286
brew install postgresql
fi
}

direnv-help() {
cat >&2 <<EOF
If you're a Sentry employee and you're stuck or have questions, ask in #discuss-dev-tooling.
Expand Down