Skip to content
This repository was archived by the owner on May 14, 2024. It is now read-only.
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
81 changes: 0 additions & 81 deletions .circleci/config.yml

This file was deleted.

94 changes: 94 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: CI

on:
push:
branches: [master]
pull_request:
branches:
- '**'

jobs:

run_tests:
name: Tests

runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-20.04]
python-version: ['3.8']

env:
MYSQL_HOST: "127.0.0.1" # For Django DATABASES setting.
VIRTUAL_ENV: ${{ github.workspace }}/venv

services:
mysql:
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
MYSQL_DATABASE: "blockstore_db"
MYSQL_ROOT_PASSWORD: ""
ports:
- 3306:3306

defaults:
run:
working-directory: app

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Need to fetch main branch for diff-cover.
path: app

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

- name: Create Virtual Environment
run: python3.8 -m venv $VIRTUAL_ENV

- name: Install Dependencies
run: make requirements-test

- name: Run Tests
run: make test

run_quality:
name: Quality

runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-20.04]
python-version: ['3.8']

env:
VIRTUAL_ENV: ${{ github.workspace }}/venv

defaults:
run:
working-directory: app

steps:
- uses: actions/checkout@v2
with:
path: app

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

- name: Create Virtual Environment
run: python3.8 -m venv $VIRTUAL_ENV

- name: Install Dependencies
run: make requirements-test

- name: Run Quality
run: make quality
17 changes: 13 additions & 4 deletions Dockerfile-3.8
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,21 @@

FROM ubuntu:20.04

ENV VIRTUAL_ENV=/blockstore/venv

RUN apt-get update
RUN apt-get install libmysqlclient-dev libjpeg-dev libssl-dev libffi-dev python3 python3-venv python3-pip git -y

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

libssl-dev and libffi-dev were required by the cryptography package but according to the docs, with the latest version of pip, a binary wheel is installed so those are no longer needed.


RUN python3.8 -m venv $VIRTUAL_ENV
# git is required by diff-cover
# build-essential, libmysqlclient-dev and python3-dev are required by mysqlclient.
RUN apt-get install -qy --no-install-recommends \
build-essential \
git \
libmysqlclient-dev \
make \
python3-dev \
python3-pip \
python3-venv

ENV VIRTUAL_ENV=/blockstore/venv
RUN python3 -m venv $VIRTUAL_ENV

RUN echo 'cd /blockstore/app/' > ~/.bashrc.new
RUN echo 'export PATH=$VIRTUAL_ENV/bin:$PATH' >> ~/.bashrc.new
Expand Down
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,15 @@ clean: ## Remove all generated files

requirements: ## Install requirements for development
# We can't add this to requirements. It changes the way pip itself works.
${VENV_BIN}/pip install wheel
${VENV_BIN}/pip install -U pip wheel
${VENV_BIN}/pip install -r requirements/local.txt --exists-action w

requirements-test: ## Install requirements for testing
${VENV_BIN}/pip install -U pip wheel
${VENV_BIN}/pip install -r requirements/test.txt --exists-action w

production-requirements:
${VENV_BIN}/pip install -U pip wheel
${VENV_BIN}/pip install -r requirements/production.txt --exists-action w

migrate: ## Apply database migrations
Expand Down
2 changes: 1 addition & 1 deletion blockstore/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
urlpatterns += make_docs_urls(api_info)

if settings.DEBUG: # pragma: no cover
import debug_toolbar
import debug_toolbar # pylint: disable=import-error
urlpatterns.append(url(r'^__debug__/', include(debug_toolbar.urls)))

if settings.DEBUG or os.environ['DJANGO_SETTINGS_MODULE'] == 'blockstore.settings.test':
Expand Down
1 change: 0 additions & 1 deletion docker-compose-3.8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ services:

networks:
devstack:
external:
name: ${OPENEDX_PROJECT_NAME:-devstack}_default

volumes:
Expand Down
18 changes: 5 additions & 13 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ coreschema==0.0.4
# via
# coreapi
# drf-yasg
cryptography==3.3.2
cryptography==3.4.8
# via
# -c requirements/constraints.txt
# pyjwt
# social-auth-core
defusedxml==0.7.1
Expand Down Expand Up @@ -66,7 +65,7 @@ git+https://github.com/alanjds/drf-nested-routers.git@8686392f91b114e01f3781807d
# via -r requirements/github.in
drf-yasg==1.20.0
# via edx-api-doc-tools
edx-api-doc-tools==1.4.3
edx-api-doc-tools==1.5.0
# via -r requirements/base.in
edx-auth-backends==4.0.0
# via -r requirements/base.in
Expand All @@ -82,10 +81,8 @@ jinja2==3.0.1
# via coreschema
markupsafe==2.0.1
# via jinja2
mysqlclient==1.3.14
# via
# -c requirements/constraints.txt
# -r requirements/base.in
mysqlclient==2.0.3
# via -r requirements/base.in
oauthlib==3.1.1
# via
# requests-oauthlib
Expand Down Expand Up @@ -123,23 +120,18 @@ ruamel.yaml.clib==0.2.6
# via ruamel.yaml
six==1.16.0
# via
# cryptography
# edx-auth-backends
# edx-django-release-util
# social-auth-app-django
social-auth-app-django==4.0.0
# via
# -c https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt
# edx-auth-backends
social-auth-core==4.0.2
# via
# -c requirements/common_constraints.txt
# edx-auth-backends
social-auth-core==4.1.0
# via
# edx-auth-backends
# social-auth-app-django
sqlparse==0.4.1
sqlparse==0.4.2
# via
# -r requirements/base.in
# django
Expand Down
11 changes: 0 additions & 11 deletions requirements/constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,3 @@ django-cors-headers>=2.2.0,<2.3
django-environ-2==2.1.0

django-filter==2.1.0

mysqlclient==1.3.14

# We want >=3.3.2 to fix a moderate-severity security issue
# reported here: https://github.com/pyca/cryptography/issues/5615.
# However, we want <3.4 because the usage of Rust in cryptography>=3.4
# causes the package to fail to install on the Alpine Linux image used for CI.
# When someone has the time to switch that image to Ubuntu, then we can probably
# remove this pin (as far as I can tell, there is no production reason not to
# upgrade to the latest version of this package).
cryptography>=3.3.2,<3.4
14 changes: 5 additions & 9 deletions requirements/local.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,8 @@ coverage==5.5
# via
# -r requirements/test.txt
# pytest-cov
cryptography==3.3.2
cryptography==3.4.8
# via
# -c requirements/constraints.txt
# -r requirements/test.txt
# pyjwt
# social-auth-core
Expand Down Expand Up @@ -131,7 +130,7 @@ drf-yasg==1.20.0
# via
# -r requirements/test.txt
# edx-api-doc-tools
edx-api-doc-tools==1.4.3
edx-api-doc-tools==1.5.0
# via -r requirements/test.txt
edx-auth-backends==4.0.0
# via -r requirements/test.txt
Expand Down Expand Up @@ -208,10 +207,8 @@ mypy-extensions==0.4.3
# via
# -r requirements/test.txt
# mypy
mysqlclient==1.3.14
# via
# -c requirements/constraints.txt
# -r requirements/test.txt
mysqlclient==2.0.3
# via -r requirements/test.txt
oauthlib==3.1.1
# via
# -r requirements/test.txt
Expand Down Expand Up @@ -338,7 +335,6 @@ six==1.16.0
# via
# -r requirements/docs.txt
# -r requirements/test.txt
# cryptography
# django-dynamic-fixture
# edx-auth-backends
# edx-django-release-util
Expand Down Expand Up @@ -373,7 +369,7 @@ sphinxcontrib-websupport==1.2.4
# via
# -r requirements/docs.txt
# sphinx
sqlparse==0.4.1
sqlparse==0.4.2
# via
# -r requirements/test.txt
# django
Expand Down
Loading