Skip to content
Open
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
11 changes: 6 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,106 +2,107 @@
on: [push]
jobs:
python-tests:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04

services:
# Label used to access the service container
db:
# Docker Hub image
image: postgres:12.7
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
- 5432:5432

redis:
image: redis:5.0.8
ports:
- 6379:6379

opensearch:
image: opensearchproject/opensearch:1.2.4
env:
network.host: "0.0.0.0"
http.cors.enabled: "true"
http.cors.allow-origin: "*"
rest.action.multi.allow_explicit_index: "false"
ES_JAVA_OPTS: -Xms512m -Xmx512m"
ports:
- 9200:9200

strategy:
matrix:
opensearch-version: [1.2]
steps:
- uses: actions/checkout@v2

- name: Apt install
run: cat Aptfile | sudo xargs apt-get install

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.9.1"
python-version: "3.10.17"

- id: cache
uses: actions/cache@v1
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt', '**/test_reqirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-

- name: Install dependencies
run: pip install -r requirements.txt -r test_requirements.txt

- name: Lint
run: pylint ./**/*.py

# You must also add the Configure sysctl limits step, otherwise Opensearch will not be able to boot.
- name: Configure sysctl limits
run: |
sudo swapoff -a
sudo sysctl -w vm.swappiness=1
sudo sysctl -w fs.file-max=262144
sudo sysctl -w vm.max_map_count=262144

- name: Runs Opensearch
uses: ankane/setup-opensearch@v1
# pinned because versions after this drop support for opensearch 1.x
uses: ankane/setup-opensearch@06d8ca27e5805f1d0ad93062c0e947eab2594d64
with:
opensearch-version: ${{ matrix.opensearch-version }}

- name: Tests
run: |
export MEDIA_ROOT="$(mktemp -d)"
sudo mkdir /var/media
sudo chown -R $USER:$USER /var/media
tox
env:
DEBUG: 'False'
NODE_ENV: 'production'
DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres
MICROMASTERS_SECURE_SSL_REDIRECT: 'False'
MICROMASTERS_DB_DISABLE_SSL: 'True'
OPENSEARCH_URL: localhost:9200
CELERY_TASK_ALWAYS_EAGER: 'True'
BROKER_URL: redis://localhost:6379/4
CELERY_RESULT_BACKEND: redis://localhost:6379/4

- name: Upload coverage to CodeCov
uses: codecov/codecov-action@v1
with:
file: ./coverage.xml

javascript-tests:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -118,7 +119,7 @@
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"

- uses: actions/cache@v1
- uses: actions/cache@v4
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-candiate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ jobs:
github.event_name == 'workflow_dispatch' ||
github.event.workflow_run.conclusion == 'failure'
steps:
- run: echo 'The triggering workflow failed'
- run: echo 'The triggering workflow failed'
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.9-bullseye
FROM python:3.10-bullseye
LABEL maintainer "ODL DevOps <mitx-devops@mit.edu>"


Expand Down
12 changes: 5 additions & 7 deletions requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ celery==5.2.2
certifi==2018.1.18
dj-database-url==0.3.0
dj-static==0.0.6
django-cors-headers==2.1.0
django-cors-headers==3.11.0
django-compat==1.0.15
django-hijack==2.1.10
django-hijack-admin==2.1.10
Expand All @@ -21,8 +21,6 @@ edx-api-client==1.2.0
edx-opaque-keys==0.4
opensearch-py==1.0.0
opensearch-dsl==1.0.0
factory_boy
faker
html5lib==0.999999999
l18n==2021.3
ipython
Expand All @@ -34,17 +32,17 @@ phonenumbers==8.10.23
psycopg2==2.8.6
pycountry==16.11.27.1
python-dateutil
sentry-sdk==1.1.0
sentry-sdk==2.40.0
redis==3.5.3
requests>=2.20.0
setuptools==67.6.1
six>=1.11.0
social-auth-app-django==3.1.0
robohash
robohash==1.1
tornado>=6
static3==0.5.1
urllib3>=1.24.2
uwsgi
wagtail==2.12.5
flaky==3.7.0
pyOpenSSL
social-auth-core==3.4.0
social-auth-core==3.4.0
33 changes: 12 additions & 21 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#
# This file is autogenerated by pip-compile with Python 3.9
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile
# pip-compile requirements.in
#
amqp==5.0.9
# via kombu
Expand Down Expand Up @@ -32,7 +32,7 @@ certifi==2018.1.18
# sentry-sdk
cffi==1.15.0
# via cryptography
chardet==3.0.4
charset-normalizer==3.4.3
# via requests
click==8.0.3
# via
Expand Down Expand Up @@ -63,6 +63,7 @@ dj-static==0.0.6
django==2.2.28
# via
# -r requirements.in
# django-cors-headers
# django-filter
# django-redis
# django-role-permissions
Expand All @@ -78,7 +79,7 @@ django-compat==1.0.15
# -r requirements.in
# django-hijack
# django-hijack-admin
django-cors-headers==2.1.0
django-cors-headers==3.11.0
# via -r requirements.in
django-discover-runner==1.0
# via django-role-permissions
Expand Down Expand Up @@ -124,14 +125,6 @@ et-xmlfile==1.1.0
# via openpyxl
executing==1.2.0
# via stack-data
factory-boy==2.8.1
# via -r requirements.in
faker==0.9.1
# via
# -r requirements.in
# factory-boy
flaky==3.7.0
# via -r requirements.in
html5lib==0.999999999
# via
# -r requirements.in
Expand Down Expand Up @@ -160,6 +153,8 @@ l18n==2021.3
# wagtail
matplotlib-inline==0.1.3
# via ipython
natsort==8.4.0
# via robohash
newrelic==6.0.1.155
# via -r requirements.in
oauthlib==2.1.0
Expand Down Expand Up @@ -220,7 +215,6 @@ python-dateutil==2.5.3
# -r requirements.in
# botocore
# edx-api-client
# faker
# opensearch-dsl
python3-openid==3.1.0
# via social-auth-core
Expand All @@ -244,11 +238,11 @@ requests==2.32.2
# wagtail
requests-oauthlib==1.0.0
# via social-auth-core
robohash==1.0
robohash==1.1
# via -r requirements.in
s3transfer==0.3.7
# via boto3
sentry-sdk==1.1.0
sentry-sdk==2.40.0
# via -r requirements.in
six==1.14.0
# via
Expand All @@ -259,7 +253,6 @@ six==1.14.0
# django-compat
# django-role-permissions
# edx-opaque-keys
# faker
# html5lib
# l18n
# opensearch-dsl
Expand Down Expand Up @@ -288,15 +281,13 @@ stevedore==1.29.0
# via edx-opaque-keys
tablib[xls,xlsx]==3.0.0
# via wagtail
text-unidecode==1.2
# via faker
tornado==5.1.1
# via robohash
tornado==6.5.2
# via -r requirements.in
traitlets==5.9.0
# via
# ipython
# matplotlib-inline
urllib3==1.26.5
urllib3==1.26.20
# via
# -r requirements.in
# botocore
Expand Down
2 changes: 1 addition & 1 deletion runtime.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
python-3.9.1
python-3.10.17
7 changes: 5 additions & 2 deletions test_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@ astroid==2.4.2
bpython
ddt
django-debug-toolbar
factory-boy==2.8.1
faker==0.9.1
flaky==3.8.1
ipdb
nplusone>=0.8.1
pdbpp
pip-tools
pylint==2.6.0
pylint-django==2.1.0
pylint-plugin-utils==0.6
pytest==5.3.5
pytest==8.4.2
pytest-cov
pytest-django==3.8.0
pytest-django==4.11.1
pytest-mock
semantic-version
selenium==3.141.0
Expand Down
5 changes: 3 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
[tox]
envlist = py39
envlist = py310
skipsdist = True

[testenv]
sitepackages = True
deps =
-r{toxinidir}/requirements.txt
-r{toxinidir}/test_requirements.txt
allowlist_externals = pytest
commands =
py.test {posargs}
pytest {posargs}
{toxinidir}/scripts/test/detect_missing_migrations.sh
{toxinidir}/scripts/test/no_auto_migrations.sh

Expand Down
Loading