Skip to content

Commit

Permalink
feat: Add django 3.2 testing support
Browse files Browse the repository at this point in the history
  • Loading branch information
UsamaSadiq committed Oct 5, 2021
1 parent 3d96586 commit f4261b4
Show file tree
Hide file tree
Showing 25 changed files with 615 additions and 313 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: CI
on:
push:
branches:
- master
pull_request:
branches:
- '**'
jobs:
python-tests:
runs-on: ubuntu-latest
strategy:
matrix:
os: [ ubuntu-20.04 ]
python-version: [ '3.8' ]
toxenv: [ django22, django30, django31, django32 ]
steps:
- uses: actions/checkout@v2

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

- name: Set up test environment
run: |
sudo apt-get install xvfb
wget https://github.com/mozilla/geckodriver/releases/download/v0.15.0/geckodriver-v0.15.0-linux64.tar.gz
mkdir geckodriver
tar -xzf geckodriver-v0.15.0-linux64.tar.gz -C geckodriver
export PATH=$PATH:$(pwd)/geckodriver
export BOTO_CONFIG=/dev/null
- name: Install Requirements
run: |
pip install -r requirements/pip.txt
pip install -r requirements/ci.txt
- name: Run Tests
run: xvfb-run --server-args=-ac -- tox -e ${{ matrix.toxenv }}

- name: Upload coverage to CodeCov
if: matrix.python-version == '3.8' && matrix.toxenv == 'django32'
uses: codecov/codecov-action@v1
with:
file: ./coverage.xml
fail_ci_if_error: true
22 changes: 22 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Push Docker Images

on:
push:
branches:
- master
jobs:
# Push image to GitHub Packages.
# See also https://docs.docker.com/docker-hub/builds/
push:
runs-on: ubuntu-latest
if: github.event_name == 'push'

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Build and Push docker image
env:
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
run : make travis_docker_push
31 changes: 31 additions & 0 deletions .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Publish package to PyPi

on:
push:
tags:
- '*'

jobs:

push:
runs-on: ubuntu-20.04

steps:
- name: Checkout
uses: actions/checkout@v2
- name: setup python
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install pip
run: pip install -r requirements/pip.txt

- name: Build package
run: python setup.py sdist bdist_wheel

- name: Publish to PyPi
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_UPLOAD_TOKEN }}
67 changes: 36 additions & 31 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,52 @@
dist: latest
language: python
python:
- 3.8
- '3.8'
env:
matrix:
- TOXENV=django22
- TOXENV=django30
- TOXENV=django22
- TOXENV=django30
- TOXENV=django31
- TOXENV=django32
global:
- DOCKER_USERNAME=edxbuilder
- DOCKER_USERNAME=edxbuilder
# encrypted DOCKER_PASSWORD
- secure: JWmtldloBZLU/+M3FlKaVGM9Kn3jMa4RTGGB84P2VIDMoCeKk6JBgdYLvt8LXx8bLV5/1JcBL+oNOWGWE7SL/AhfTKXwGq1FYdt9Nu8UqtscfIEbzBwT0MdLZtfOHqS7c7MP0ViKIcOcyj7o+vpuauJVx6MGgAzBhFH6QlVQLZU=
- secure: ZAQze5XdSm8VEdmMdpXIxF8y163XbbnsDw+06ue5yYG41OGKcZW0u92CgzuKyjaamKJFPfST05ap9L/AxYjJ7A7bmYBUeMyMkIuHMPeJ1XOtMEtsb2x3hV5x2Z3kjxUCD/YYExDTvoGqcEbNamGZLkGPI+hJ+WXSGzw9OXqztF8=
- secure: JWmtldloBZLU/+M3FlKaVGM9Kn3jMa4RTGGB84P2VIDMoCeKk6JBgdYLvt8LXx8bLV5/1JcBL+oNOWGWE7SL/AhfTKXwGq1FYdt9Nu8UqtscfIEbzBwT0MdLZtfOHqS7c7MP0ViKIcOcyj7o+vpuauJVx6MGgAzBhFH6QlVQLZU=
- secure: ZAQze5XdSm8VEdmMdpXIxF8y163XbbnsDw+06ue5yYG41OGKcZW0u92CgzuKyjaamKJFPfST05ap9L/AxYjJ7A7bmYBUeMyMkIuHMPeJ1XOtMEtsb2x3hV5x2Z3kjxUCD/YYExDTvoGqcEbNamGZLkGPI+hJ+WXSGzw9OXqztF8=
addons:
firefox: 52.0.1
services:
- docker
- docker
cache:
directories:
- "$HOME/.cache/pip"
- $HOME/.cache/pip
before_install:
- sudo apt-get install xvfb
- wget https://github.com/mozilla/geckodriver/releases/download/v0.15.0/geckodriver-v0.15.0-linux64.tar.gz
- mkdir geckodriver
- tar -xzf geckodriver-v0.15.0-linux64.tar.gz -C geckodriver
- export PATH=$PATH:$(pwd)/geckodriver
- pip install pip==20.0.2
- export BOTO_CONFIG=/dev/null
- sudo apt-get install xvfb
- wget https://github.com/mozilla/geckodriver/releases/download/v0.15.0/geckodriver-v0.15.0-linux64.tar.gz
- mkdir geckodriver
- tar -xzf geckodriver-v0.15.0-linux64.tar.gz -C geckodriver
- export PATH=$PATH:$(pwd)/geckodriver
- export BOTO_CONFIG=/dev/null
install:
- pip install tox-travis
- pip install -r requirements/travis.txt
- pip install -r requirements/pip.txt
- pip install tox-travis
- pip install -r requirements/ci.txt
script:
- xvfb-run --server-args=-ac -- tox
- xvfb-run --server-args=-ac -- tox
after_success:
- codecov
deploy:
provider: pypi
user: edx
password:
secure: DrrqJy3pyUC7hRESSchvtPFIiYCjHMsE1Cuq78nO3Z9Y+5Vlo8LRw76ui3lx5A1npOy/cp86eOoV01pPnOwv50ieo4xYbR6BuphLTvwaaBW3d2Hf3CRuq/fgg2vVR2QBJMCvNLOgI14D3von4PDxeiaI4Gu5hWWZJvBn+7w+inY=
distributions: sdist bdist_wheel
on:
tags: true
python: 3.8
condition: "$TOXENV=django22"
after_deploy:
- make travis_docker_push
- codecov
#
# The following actions have been switched to github CI.
#
#deploy:
# provider: pypi
# user: edx
# password:
# secure: DrrqJy3pyUC7hRESSchvtPFIiYCjHMsE1Cuq78nO3Z9Y+5Vlo8LRw76ui3lx5A1npOy/cp86eOoV01pPnOwv50ieo4xYbR6BuphLTvwaaBW3d2Hf3CRuq/fgg2vVR2QBJMCvNLOgI14D3von4PDxeiaI4Gu5hWWZJvBn+7w+inY=
# distributions: sdist bdist_wheel
# on:
# tags: true
# python: 3.8
# condition: $TOXENV=django22
#after_deploy:
# - make travis_docker_push
11 changes: 11 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ Change history for XBlock SDK

These are notable changes in XBlock.

0.4.0
-----
* Added support for Django 3.0, Django 3.1 and Django 3.2 tests
* Added GitHub CI to replace Travis

0.3.0
-----
* Dropped support for Python 3.5
* Upgraded Code To Python 3.8 Standards
* Upgraded dependencies to Python 3.8

0.2.0
-----
* Released on PyPI
Expand Down
20 changes: 14 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,22 @@ coverage: clean ## generate and view HTML coverage report
pytest --cov-report html
$(BROWSER) htmlcov/index.html

export CUSTOM_COMPILE_COMMAND = make upgrade
upgrade: ## update the requirements/*.txt files with the latest packages satisfying requirements/*.in
pip install -q pip-tools
COMMON_CONSTRAINTS_TXT=requirements/common_constraints.txt
.PHONY: $(COMMON_CONSTRAINTS_TXT)
$(COMMON_CONSTRAINTS_TXT):
wget -O "$(@)" https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt || touch "$(@)"

upgrade: export CUSTOM_COMPILE_COMMAND=make upgrade
upgrade: $(COMMON_CONSTRAINTS_TXT) ## update the requirements/*.txt files with the latest packages satisfying requirements/*.in
pip install -qr requirements/pip-tools.txt
# Make sure to compile files after any other files they include!
pip-compile --upgrade --allow-unsafe --rebuild -o requirements/pip.txt requirements/pip.in
pip-compile --upgrade -o requirements/pip-tools.txt requirements/pip-tools.in
pip-compile --rebuild --upgrade -o requirements/base.txt requirements/base.in
pip-compile --rebuild --upgrade -o requirements/test.txt requirements/base.in requirements/test.in
pip-compile --rebuild --upgrade -o requirements/test.txt requirements/test.in
pip-compile --rebuild --upgrade -o requirements/quality.txt requirements/quality.in
pip-compile --rebuild --upgrade -o requirements/travis.txt requirements/travis.in
pip-compile --rebuild --upgrade -o requirements/dev.txt requirements/base.in requirements/test.in requirements/quality.in
pip-compile --rebuild --upgrade -o requirements/ci.txt requirements/ci.in
pip-compile --rebuild --upgrade -o requirements/dev.txt requirements/test.in requirements/quality.in
# Let tox control the Django version for tests
sed '/^[dD]jango==/d' requirements/test.txt > requirements/test.tmp
mv requirements/test.tmp requirements/test.txt
Expand Down
2 changes: 1 addition & 1 deletion requirements/base.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Pinned versions here match edx-platform versions, and should be upgraded frequently

-c ../constraints.txt
-c constraints.txt

boto
cookiecutter
Expand Down
62 changes: 31 additions & 31 deletions requirements/base.txt
Original file line number Diff line number Diff line change
@@ -1,57 +1,57 @@
#
# This file is autogenerated by pip-compile
# This file is autogenerated by pip-compile with python 3.8
# To update, run:
#
# make upgrade
#
appdirs==1.4.4
# via fs
arrow==1.1.0
arrow==1.2.0
# via jinja2-time
binaryornot==0.4.4
# via cookiecutter
boto3==1.17.78
# via fs-s3fs
boto==2.49.0
# via -r requirements/base.in
botocore==1.20.78
boto3==1.18.54
# via fs-s3fs
botocore==1.21.54
# via
# boto3
# s3transfer
certifi==2020.12.5
certifi==2021.5.30
# via requests
chardet==4.0.0
# via
# binaryornot
# requests
# via binaryornot
charset-normalizer==2.0.6
# via requests
click==8.0.1
# via cookiecutter
cookiecutter==1.7.3
# via -r requirements/base.in
django-pyfs==3.0
# via -r requirements/base.in
django==2.2.23
# via
# -c https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt
# -r requirements/base.in
# django-pyfs
fs-s3fs==1.1.1
django==2.2.24
# via
# -c requirements/common_constraints.txt
# -r requirements/base.in
# django-pyfs
django-pyfs==3.1.0
# via -r requirements/base.in
fs==2.4.13
# via
# django-pyfs
# fs-s3fs
# xblock
idna==2.10
fs-s3fs==1.1.1
# via
# -r requirements/base.in
# django-pyfs
idna==3.2
# via requests
jinja2-time==0.2.0
# via cookiecutter
jinja2==3.0.1
jinja2==3.0.2
# via
# cookiecutter
# jinja2-time
jinja2-time==0.2.0
# via cookiecutter
jmespath==0.10.0
# via
# boto3
Expand All @@ -68,53 +68,53 @@ markupsafe==2.0.1
# xblock
poyo==0.5.0
# via cookiecutter
pypng==0.0.20
pypng==0.0.21
# via -r requirements/base.in
python-dateutil==2.8.1
python-dateutil==2.8.2
# via
# arrow
# botocore
# xblock
python-slugify==5.0.2
# via cookiecutter
pytz==2021.1
pytz==2021.3
# via
# django
# fs
# xblock
pyyaml==5.4.1
# via xblock
requests==2.25.1
requests==2.26.0
# via
# -r requirements/base.in
# cookiecutter
s3transfer==0.4.2
s3transfer==0.5.0
# via boto3
simplejson==3.17.2
simplejson==3.17.5
# via -r requirements/base.in
six==1.16.0
# via
# cookiecutter
# fs
# fs-s3fs
# python-dateutil
sqlparse==0.4.1
sqlparse==0.4.2
# via django
text-unidecode==1.3
# via python-slugify
urllib3==1.26.4
urllib3==1.26.7
# via
# botocore
# requests
web-fragments==1.0.0
web-fragments==1.1.0
# via
# -r requirements/base.in
# xblock
webob==1.8.7
# via
# -r requirements/base.in
# xblock
xblock==1.4.1
xblock==1.5.1
# via -r requirements/base.in

# The following packages are considered to be unsafe in a requirements file:
Expand Down
2 changes: 1 addition & 1 deletion requirements/travis.in → requirements/ci.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Requirements for running tests in Travis

-c ../constraints.txt
-c constraints.txt

codecov # Code coverage reporting
tox # Virtualenv management for tests
Expand Down
Loading

0 comments on commit f4261b4

Please sign in to comment.