-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Extract common/lib/sandbox-packages (#1)
* feat: new package containing code jail related files for edx-platform.
- Loading branch information
Showing
44 changed files
with
3,254 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[run] | ||
data_file = .coverage | ||
source = loncapa, verifiers, eia | ||
branch = true | ||
relative_files = True | ||
|
||
[report] | ||
ignore_errors = True | ||
|
||
[html] | ||
title = Calc Python Test Coverage Report | ||
directory = cover | ||
|
||
[xml] | ||
output = coverage.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
**Description:** Describe in a couple of sentences what this PR adds | ||
|
||
**JIRA:** Link to JIRA ticket | ||
|
||
**Dependencies:** dependencies on other outstanding PRs, issues, etc. | ||
|
||
**Merge deadline:** List merge deadline (if any) | ||
|
||
**Installation instructions:** List any non-trivial installation | ||
instructions. | ||
|
||
**Testing instructions:** | ||
|
||
1. Open page A | ||
2. Do thing B | ||
3. Expect C to happen | ||
4. If D happened instead - check failed. | ||
|
||
**Reviewers:** | ||
- [ ] tag reviewer | ||
- [ ] tag reviewer | ||
|
||
**Merge checklist:** | ||
- [ ] All reviewers approved | ||
- [ ] CI build is green | ||
- [ ] Version bumped | ||
- [ ] Changelog record added | ||
- [ ] Documentation updated (not only docstrings) | ||
- [ ] Commits are squashed | ||
|
||
**Post merge:** | ||
- [ ] Create a tag | ||
- [ ] Check new version is pushed to PyPI after tag-triggered build is | ||
finished. | ||
- [ ] Delete working branch (if not needed anymore) | ||
|
||
**Author concerns:** List any concerns about this PR - inelegant | ||
solutions, hacks, quick-and-dirty implementations, concerns about | ||
migrations, etc. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Python CI | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: | ||
- '**' | ||
|
||
|
||
jobs: | ||
run_tests: | ||
name: tests | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-20.04] | ||
python-version: ['3.8'] | ||
toxenv: ["py38", "quality"] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: setup python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install pip | ||
run: pip install -r requirements/pip.txt | ||
|
||
- name: Install Dependencies | ||
run: pip install -r requirements/ci.txt | ||
|
||
- name: Run Tests | ||
env: | ||
TOXENV: ${{ matrix.toxenv }} | ||
run: tox | ||
|
||
- name: Run coverage | ||
if: matrix.python-version == '3.8' && matrix.toxenv == 'quality' | ||
uses: codecov/codecov-action@v1 | ||
with: | ||
flags: unittests | ||
fail_ci_if_error: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Run commitlint on the commit messages in a pull request. | ||
|
||
name: Lint Commit Messages | ||
|
||
on: | ||
- pull_request | ||
|
||
jobs: | ||
commitlint: | ||
uses: edx/.github/.github/workflows/commitlint.yml@master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Publish package to PyPi | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
Change Log | ||
---------- | ||
|
||
.. | ||
All enhancements and patches to codejail-includes will be documented | ||
in this file. It adheres to the structure of https://keepachangelog.com/ , | ||
but in reStructuredText instead of Markdown (for ease of incorporation into | ||
Sphinx documentation and the PyPI description). | ||
This project adheres to Semantic Versioning (https://semver.org/). | ||
.. There should always be an "Unreleased" section for changes pending release. | ||
Unreleased | ||
~~~~~~~~~~ | ||
|
||
* | ||
|
||
[1.0.0] - 2022-05-17 | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
Added | ||
_____ | ||
|
||
* First release on PyPI. | ||
* codejail includes moved from edx-platform to individual pypi package. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
include CHANGELOG.rst | ||
include LICENSE.txt | ||
include README.rst | ||
include requirements/base.in | ||
include requirements/constraints.txt | ||
include eia.py | ||
recursive-include verifiers *.html *.png *.gif *.js *.css *.jpg *.jpeg *.svg *.py | ||
recursive-include loncapa *.html *.png *.gif *.js *.css *.jpg *.jpeg *.svg *.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
.PHONY: clean compile_translations coverage diff_cover docs dummy_translations \ | ||
extract_translations fake_translations help \ | ||
quality requirements selfcheck test-all upgrade validate tests validate | ||
|
||
.DEFAULT_GOAL := help | ||
|
||
# For opening files in a browser. Use like: $(BROWSER)relative/path/to/file.html | ||
BROWSER := python -m webbrowser file://$(CURDIR)/ | ||
|
||
help: ## display this help message | ||
@echo "Please use \`make <target>' where <target> is one of" | ||
@awk -F ':.*?## ' '/^[a-zA-Z]/ && NF==2 {printf "\033[36m %-25s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) | sort | ||
|
||
clean: ## remove generated byte code, coverage reports, and build artifacts | ||
find . -name '__pycache__' -exec rm -rf {} + | ||
find . -name '*.pyc' -exec rm -f {} + | ||
find . -name '*.pyo' -exec rm -f {} + | ||
find . -name '*~' -exec rm -f {} + | ||
rm -fr build/ | ||
rm -fr dist/ | ||
rm -fr *.egg-info | ||
|
||
coverage: clean ## generate and view HTML coverage report | ||
pytest --cov-report html | ||
$(BROWSER)htmlcov/index.html | ||
|
||
docs: ## generate Sphinx HTML documentation, including API docs | ||
tox -e docs | ||
$(BROWSER)docs/_build/html/index.html | ||
|
||
# Define PIP_COMPILE_OPTS=-v to get more information during make upgrade. | ||
PIP_COMPILE = pip-compile --upgrade $(PIP_COMPILE_OPTS) | ||
|
||
upgrade: export CUSTOM_COMPILE_COMMAND=make upgrade | ||
upgrade: ## update the requirements/*.txt files with the latest packages satisfying requirements/*.in | ||
pip install -r requirements/pip-tools.txt | ||
# Make sure to compile files after any other files they include! | ||
$(PIP_COMPILE) --allow-unsafe --rebuild -o requirements/pip.txt requirements/pip.in | ||
$(PIP_COMPILE) -o requirements/pip-tools.txt requirements/pip-tools.in | ||
pip install -r requirements/pip-tools.txt | ||
$(PIP_COMPILE) -o requirements/base.txt requirements/base.in | ||
$(PIP_COMPILE) -o requirements/test.txt requirements/test.in | ||
$(PIP_COMPILE) -o requirements/doc.txt requirements/doc.in | ||
$(PIP_COMPILE) -o requirements/quality.txt requirements/quality.in | ||
$(PIP_COMPILE) -o requirements/ci.txt requirements/ci.in | ||
$(PIP_COMPILE) -o requirements/dev.txt requirements/dev.in | ||
|
||
requirements: ## install development environment requirements | ||
pip install -qr requirements/dev.txt --exists-action w | ||
|
||
tests: ## Run tests and generate coverage report | ||
pytest | ||
|
||
quality: ## check coding style with pycodestyle and pylint | ||
pylint loncapa verifiers eia | ||
|
||
test-all: quality ## run tests on every supported Python/Django combination | ||
tox | ||
|
||
validate: quality tests ## run tests and quality checks | ||
|
||
selfcheck: ## check that the Makefile is well-formed | ||
@echo "The Makefile is well-formed." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
codejail-includes | ||
============================= | ||
|
||
|pypi-badge| |license-badge| | ||
|
||
CodeJail manages execution of untrusted code in secure sandboxes. It is designed primarily for Python execution, | ||
but can be used for other languages as well. | ||
|
||
Documentation | ||
------------- | ||
|
||
(TODO: `Set up documentation <https://openedx.atlassian.net/wiki/spaces/DOC/pages/21627535/Publish+Documentation+on+Read+the+Docs>`_) | ||
|
||
Development Workflow | ||
-------------------- | ||
|
||
One Time Setup | ||
~~~~~~~~~~~~~~ | ||
.. code-block:: | ||
# Clone the repository | ||
git clone [email protected]:openedx/codejail-includes.git | ||
cd codejail-includes | ||
# Set up a virtualenv using virtualenvwrapper with the same name as the repo and activate it | ||
mkvirtualenv -p python3.8 codejail-includes | ||
Every time you develop something in this repo | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
.. code-block:: | ||
# Activate the virtualenv | ||
workon codejail-includes | ||
# Grab the latest code | ||
git checkout main | ||
git pull | ||
# Install/update the dev requirements | ||
make requirements | ||
# Run the tests and quality checks (to verify the status before you make any changes) | ||
make validate | ||
# Make a new branch for your changes | ||
git checkout -b <your_github_username>/<short_description> | ||
# Using your favorite editor, edit the code to make your change. | ||
vim … | ||
# Run your new tests | ||
pytest ./path/to/new/tests | ||
# Run all the tests and quality checks | ||
make validate | ||
# Commit all your changes | ||
git commit … | ||
git push | ||
# Open a PR and ask for review. | ||
License | ||
------- | ||
|
||
The code in this repository is licensed under the AGPL 3.0 unless | ||
otherwise noted. | ||
|
||
Please see `LICENSE.txt <LICENSE.txt>`_ for details. | ||
|
||
How To Contribute | ||
----------------- | ||
|
||
Contributions are very welcome. | ||
Please read `How To Contribute <https://github.com/edx/edx-platform/blob/master/CONTRIBUTING.rst>`_ for details. | ||
Even though they were written with ``edx-platform`` in mind, the guidelines | ||
should be followed for all Open edX projects. | ||
|
||
The pull request description template should be automatically applied if you are creating a pull request from GitHub. Otherwise you | ||
can find it at `PULL_REQUEST_TEMPLATE.md <.github/PULL_REQUEST_TEMPLATE.md>`_. | ||
|
||
The issue report template should be automatically applied if you are creating an issue on GitHub as well. Otherwise you | ||
can find it at `ISSUE_TEMPLATE.md <.github/ISSUE_TEMPLATE.md>`_. | ||
|
||
Reporting Security Issues | ||
------------------------- | ||
|
||
Please do not report security issues in public. Please email [email protected]. | ||
|
||
Getting Help | ||
------------ | ||
|
||
If you're having trouble, we have discussion forums at https://discuss.openedx.org where you can connect with others in the community. | ||
|
||
Our real-time conversations are on Slack. You can request a `Slack invitation`_, then join our `community Slack workspace`_. | ||
|
||
For more information about these options, see the `Getting Help`_ page. | ||
|
||
.. _Slack invitation: https://openedx-slack-invite.herokuapp.com/ | ||
.. _community Slack workspace: https://openedx.slack.com/ | ||
.. _Getting Help: https://openedx.org/getting-help | ||
|
||
.. |pypi-badge| image:: https://img.shields.io/pypi/v/codejail-includes.svg | ||
:target: https://pypi.python.org/pypi/codejail-includes/ | ||
:alt: PyPI | ||
|
||
.. |ci-badge| image:: https://github.com/openedx/sandboxcodejail-includes/workflows/Python%20CI/badge.svg?branch=main | ||
:target: https://github.com/openedx/codejail-includes/actions | ||
:alt: CI | ||
|
||
.. |license-badge| image:: https://img.shields.io/github/license/openedx/sandbox-packages.svg | ||
:target: https://github.com/openedx/codejail-includes/blob/main/LICENSE | ||
:alt: License |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
coverage: | ||
status: | ||
project: | ||
default: | ||
enabled: yes | ||
target: auto | ||
patch: | ||
default: | ||
enabled: yes | ||
target: 100% | ||
|
||
comment: false |
Oops, something went wrong.