Skip to content

Commit

Permalink
Merge branch 'master' into jenkins/zshkoor/setup-py-updated-4171d83
Browse files Browse the repository at this point in the history
  • Loading branch information
BilalQamar95 authored Dec 10, 2024
2 parents be1e153 + 28fa16a commit 7ab5a18
Show file tree
Hide file tree
Showing 42 changed files with 1,829 additions and 529 deletions.
17 changes: 11 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04]
python-version: ['3.8']
toxenv: [django32, django40, django42, quality]
os: [ubuntu-latest]
python-version: ['3.11', '3.12']
toxenv: [django42, quality]

steps:
- uses: actions/checkout@v2
Expand All @@ -31,15 +31,20 @@ jobs:
run: pip install -r requirements/pip.txt

- name: Install Dependencies
run: pip install -r requirements/ci.txt
run: |
pip install setuptools
pip install -r requirements/ci.txt
- name: Run Tests
env:
TOXENV: ${{ matrix.toxenv }}
# Sleep is needed to give elasticsearch enough time to startup.
# Longer term we should switch to the upstream ES github action to start up the server
run: sleep 10 && tox

- name: Run Coverage
if: matrix.python-version == '3.8' && matrix.toxenv=='django42'
uses: codecov/codecov-action@v3
if: matrix.python-version == '3.12' && matrix.toxenv=='django42'
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
4 changes: 2 additions & 2 deletions .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
jobs:

push:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest

steps:
- name: Checkout
Expand All @@ -27,7 +27,7 @@ jobs:
run: python setup.py sdist bdist_wheel

- name: Publish to PyPi
uses: pypa/gh-action-pypi-publish@master
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_UPLOAD_TOKEN }}
27 changes: 27 additions & 0 deletions .github/workflows/upgrade-python-requirements.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Upgrade Python Requirements

on:
schedule:
- cron: "0 0 * * 1"
workflow_dispatch:
inputs:
branch:
description: "Target branch against which to create requirements PR"
required: true
default: 'master'

jobs:
call-upgrade-python-requirements-workflow:
uses: openedx/.github/.github/workflows/upgrade-python-requirements.yml@master
with:
branch: ${{ github.event.inputs.branch || 'master' }}
# optional parameters below; fill in if you'd like github or email notifications
# user_reviewers: ""
# team_reviewers: ""
# email_address: ""
# send_success_notification: false
secrets:
requirements_bot_github_token: ${{ secrets.REQUIREMENTS_BOT_GITHUB_TOKEN }}
requirements_bot_github_email: ${{ secrets.REQUIREMENTS_BOT_GITHUB_EMAIL }}
edx_smtp_username: ${{ secrets.EDX_SMTP_USERNAME }}
edx_smtp_password: ${{ secrets.EDX_SMTP_PASSWORD }}
34 changes: 19 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
.PHONY: clean quality requirements validate test test-python quality-python
.PHONY: clean quality requirements validate test test-with-es quality-python install-local

clean:
find . -name '__pycache__' -exec rm -rf {} +
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
coverage erase
rm -rf coverage htmlcov
rm -fr build/
Expand All @@ -25,33 +25,37 @@ validate: clean
tox

test.start_elasticsearch:
docker-compose up -d
docker compose up -d

test.stop_elasticsearch:
docker-compose stop
docker compose stop

test_with_es: clean test.start_elasticsearch
coverage run --source='.' manage.py test
make test.stop_elasticsearch

upgrade: export CUSTOM_COMPILE_COMMAND=make upgrade
upgrade: ## update the requirements/*.txt files with the latest packages satisfying requirements/*.in
compile-requirements: export CUSTOM_COMPILE_COMMAND=make upgrade
compile-requirements: ## Re-compile *.in requirements to *.txt (without upgrading)
pip install -qr requirements/pip-tools.txt
# Make sure to compile files after any other files they include!
pip-compile --rebuild --allow-unsafe --rebuild -o requirements/pip.txt requirements/pip.in
pip-compile --rebuild --upgrade -o requirements/pip-tools.txt requirements/pip-tools.in
pip-compile --rebuild ${COMPILE_OPTS} -o requirements/pip-tools.txt requirements/pip-tools.in
pip install -qr requirements/pip.txt
pip install -qr requirements/pip-tools.txt
pip-compile --rebuild --upgrade -o requirements/base.txt requirements/base.in
pip-compile --rebuild --upgrade -o requirements/testing.txt requirements/testing.in
pip-compile --rebuild --upgrade -o requirements/quality.txt requirements/quality.in
pip-compile --rebuild --upgrade -o requirements/ci.txt requirements/ci.in
pip-compile --rebuild --upgrade -o requirements/dev.txt requirements/dev.in
pip-compile --rebuild ${COMPILE_OPTS} -o requirements/base.txt requirements/base.in
pip-compile --rebuild ${COMPILE_OPTS} -o requirements/testing.txt requirements/testing.in
pip-compile --rebuild ${COMPILE_OPTS} -o requirements/quality.txt requirements/quality.in
pip-compile --rebuild ${COMPILE_OPTS} -o requirements/ci.txt requirements/ci.in
pip-compile --rebuild ${COMPILE_OPTS} -o requirements/dev.txt requirements/dev.in
# Let tox control the Django version for tests
sed '/^[dD]jango==/d' requirements/testing.txt > requirements/testing.tmp
mv requirements/testing.tmp requirements/testing.txt

test-python: clean ## run tests using pytest and generate coverage report
pytest
upgrade: ## update the requirements/*.txt files with the latest packages satisfying requirements/*.in
$(MAKE) compile-requirements COMPILE_OPTS="--upgrade"

test: test_with_es ## run tests and generate coverage report

test: test-python ## run tests and generate coverage report
install-local: ## installs your local edx-search into the LMS and CMS python virtualenvs
docker exec -t edx.devstack.lms bash -c '. /edx/app/edxapp/venvs/edxapp/bin/activate && cd /edx/app/edxapp/edx-platform && pip uninstall -y edx-search && pip install -e /edx/src/edx-search && pip freeze | grep edx-search'
docker exec -t edx.devstack.cms bash -c '. /edx/app/edxapp/venvs/edxapp/bin/activate && cd /edx/app/edxapp/edx-platform && pip uninstall -y edx-search && pip install -e /edx/src/edx-search && pip freeze | grep edx-search'
13 changes: 13 additions & 0 deletions catalog-info.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# This file records information about this repo. Its use is described in OEP-55:
# https://open-edx-proposals.readthedocs.io/en/latest/processes/oep-0055-proc-project-maintainers.html

apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: 'edx-search'
description: "A django application to provide access to search services"
links: []
spec:
owner: group:openedx-unmaintained
type: 'service'
lifecycle: 'production'
1 change: 0 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: '2.2'
services:

test_elasticsearch:
Expand Down
2 changes: 1 addition & 1 deletion edxsearch/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
""" Container module for testing / demoing search """

__version__ = '3.6.0'
__version__ = '4.1.1'
29 changes: 29 additions & 0 deletions edxsearch/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'eventtracking.django',
'waffle',
)

Expand Down Expand Up @@ -99,3 +100,31 @@
# https://docs.djangoproject.com/en/1.6/howto/static-files/

STATIC_URL = '/static/'

# EVENT TRACKING #################################

TRACK_MAX_EVENT = 50000

TRACKING_BACKENDS = {
'logger': {
'ENGINE': 'track.backends.logger.LoggerBackend',
'OPTIONS': {
'name': 'tracking'
}
}
}

# We're already logging events, and we don't want to capture user
# names/passwords. Heartbeat events are likely not interesting.
TRACKING_IGNORE_URL_PATTERNS = [r'^/event', r'^/login', r'^/heartbeat']

EVENT_TRACKING_ENABLED = True
EVENT_TRACKING_BACKENDS = {
'logger': {
'ENGINE': 'eventtracking.backends.logger.LoggerBackend',
'OPTIONS': {
'name': 'tracking',
'max_event_size': TRACK_MAX_EVENT,
}
}
}
7 changes: 4 additions & 3 deletions pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
# SERIOUSLY.
#
# ------------------------------
# Generated by edx-lint version: 5.3.0
# Generated by edx-lint version: 5.3.7
# ------------------------------
[MASTER]
ignore =
Expand Down Expand Up @@ -259,6 +259,7 @@ enable =
useless-suppression,
disable =
bad-indentation,
broad-exception-raised,
consider-using-f-string,
duplicate-code,
file-ignored,
Expand Down Expand Up @@ -380,6 +381,6 @@ ext-import-graph =
int-import-graph =

[EXCEPTIONS]
overgeneral-exceptions = Exception
overgeneral-exceptions = builtins.Exception

# e79d284912469e90087c79e80233e873551b6ca9
# 1a9b016a2ea1ded8c5b79b0e520a5566eba73b62
1 change: 1 addition & 0 deletions requirements/base.in
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ Django # Web application framework
elasticsearch>=7.8.0,<8.0.0
edx-toggles
event-tracking
meilisearch
Loading

0 comments on commit 7ab5a18

Please sign in to comment.