Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
10 changes: 3 additions & 7 deletions .github/actions/setup-python/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,14 @@ runs:
with:
python-version: ${{ steps.python-version.outputs.python-version }}

- name: Install pip
shell: bash
env:
WORKDIR: ${{ inputs.workdir }}
run: |
source "$WORKDIR/scripts/lib.sh" && upgrade-pip
Copy link
Member Author

Choose a reason for hiding this comment

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

This is merged in the next step.


- name: Get pip cache dir & version
id: pip-info
shell: bash
env:
WORKDIR: ${{ inputs.workdir }}
# pip versions before 20.1 do not have `pip cache`, `make upgrade-pip` ensures that version as a minimum
run: |
source "$WORKDIR/scripts/lib.sh" && upgrade-pip
echo "::set-output name=pip-cache-dir::$(pip cache dir)"
echo "::set-output name=pip-version::$(pip -V | awk -F ' ' '{print $2}')"

Expand Down
37 changes: 12 additions & 25 deletions .github/workflows/development-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,25 @@ on:
paths:
- '.pre-commit-config.yaml'
- 'Makefile'
- '.github/actions/*'
- '.github/actions/setup-python'
Copy link
Member Author

Choose a reason for hiding this comment

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

We only use the setup-python action.

- '.github/workflows/development-environment.yml'
- '.envrc'
- 'Brewfile'
- 'scripts/*'
- 'src/sentry/runner/commands/devserver.py'
- 'src/sentry/runner/commands/devservices.py'
- 'requirements-*.txt'
Copy link
Member Author

Choose a reason for hiding this comment

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

Since I've deleted the python deps workflow.


jobs:
dev-environment:
name: dev docs set up
runs-on: ${{ matrix.os }}
timeout-minutes: 90
timeout-minutes: 40
Copy link
Member Author

Choose a reason for hiding this comment

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

We don't fetch from Docker and it takes less than 15 minutes, thus, this should be plenty.

strategy:
matrix:
# Using Ubuntu 18 until I figure out this error:
# -> ImportError: libffi.so.6: cannot open shared object file: No such file or directory
os: [macos-11.0, ubuntu-18.04]
python-version: [3.8.12]
os: [macos-11.0, ubuntu-20.04]
Copy link
Member Author

Choose a reason for hiding this comment

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

It seems that Ubuntu 20 magically works now :)

fail-fast: false
env:
PIP_DISABLE_PIP_VERSION_CHECK: on
Copy link
Member Author

Choose a reason for hiding this comment

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

Dealt as part of the setup-python action.

# Make the environment more similar to what Mac defaults to
SHELL: /bin/zsh

Expand All @@ -36,27 +33,14 @@ jobs:
- name: Set variables for caches
id: info
run: |
echo "::set-output name=brew-cache-dir::$(brew --cache)"
echo "::set-output name=yarn-cache-dir::$(yarn cache dir)"

- name: Cache (brew)
uses: actions/cache@v2
with:
path: ${{ steps.info.outputs.brew-cache-dir }}
key: devenv-${{ runner.os }}-brew-${{ hashFiles('Brewfile') }}
restore-keys: devenv-${{ runner.os }}-brew
Copy link
Member Author

Choose a reason for hiding this comment

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

It was adding a couple of minutes. It's probably been growing indefinitely.


- 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
continue-on-error: true
Copy link
Member Author

Choose a reason for hiding this comment

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

make prerequisites now installs the minimum amount of packages needed to proceed. If the step fails there's no point on continuing.

run: |
make prerequisites

- name: Setup Python ${{ matrix.python-version }}
Copy link
Member Author

Choose a reason for hiding this comment

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

We don't use a matrix anymore.

- name: Setup Python
uses: ./.github/actions/setup-python
with:
python-version: ${{ matrix.python-version }}

- name: Cache (pyenv)
uses: actions/cache@v2
Expand All @@ -68,24 +52,27 @@ jobs:
uses: actions/cache@v1 # We are explicitly using v1 due to perf reasons
with:
path: ${{ steps.info.outputs.yarn-cache-dir }}
key: devenv-${{ matrix.os }}-v2-yarn-${{ hashFiles('yarn.lock') }}
key: devenv-${{ matrix.os }}-v1-yarn-${{ hashFiles('yarn.lock') }}
Copy link
Member Author

Choose a reason for hiding this comment

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

Since we're using actions/cache@v1 I assume we should have named the cache v1.


- name: Set up development environment (mostly as per docs)
run: |
curl https://get.volta.sh | bash
export VOLTA_HOME="$HOME/.volta"
export PATH="$HOME/.volta/bin:$PATH"
make setup-pyenv
eval "$(pyenv init --path)"
Copy link
Member Author

Choose a reason for hiding this comment

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

Using source below helps testing a more similar code path as engineers would. We can't use exec $SHELL.

[[ $(which python) != "${HOME}/.pyenv/shims/python" ]]
source ~/.zprofile
[[ $(which python) == "${HOME}/.pyenv/shims/python" ]]
Copy link
Member Author

Choose a reason for hiding this comment

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

After sourcing, we should be using the Python version from pyenv.

[[ $(python -V) == "Python $(cat .python-version)" ]]
python -m venv .venv
source .venv/bin/activate
make develop init-config
pre-commit

bootstrap-script:
runs-on: macos-11
timeout-minutes: 90
timeout-minutes: 40
env:
PIP_DISABLE_PIP_VERSION_CHECK: on
# Make the environment more similar to what Mac defaults to
SHELL: /bin/zsh

Expand Down
48 changes: 0 additions & 48 deletions .github/workflows/python-deps.yml

This file was deleted.

6 changes: 5 additions & 1 deletion scripts/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,11 @@ reset-db() {
}

prerequisites() {
brew update -q && brew bundle -q
if [ -z "${CI+x}" ]; then
brew update -q && brew bundle -q
else
HOMEBREW_NO_AUTO_UPDATE=on brew install libxmlsec1 pyenv
Copy link
Member Author

Choose a reason for hiding this comment

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

These are the minimum required packages on CI to get us to success.

fi
}

direnv-help() {
Expand Down