-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added github workflow to run tests for all open-edx plugins on …
…different edx distributions (#277) * feat: added ci actions * feat: added ci actions new * feat: added ci actions new1 * feat: added ci actions new2 * feat: added ci actions new2 * feat: added ci actions final * feat: added ci actions final * feat: added ci actions finalv2 * feat: added ci actions finalv2 * feat: added ci actions finalv2 * feat: added ci actions finalv2 * feat: added ci actions finalv2 * feat: added ci actions finalv2 * feat: added ci actions finalv2 * feat: removed the pylint and pycodestyle * feat: pytest github step * feat: looping through plugins and running tests * feat: looping through plugins and running tests * feat: looping through plugins and running tests * feat: enabling tests for different edx distributions * feat: some cleanup * feat: added ruff in git workflow --------- Co-authored-by: root <[email protected]>
- Loading branch information
1 parent
7e3c695
commit a8444d2
Showing
6 changed files
with
146 additions
and
10 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,50 @@ | ||
--- | ||
name: CI | ||
on: [push] | ||
jobs: | ||
integration-tests: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
devstack-branch: | ||
- master | ||
- open-release/quince.master | ||
- open-release/palm.master | ||
- open-release/olive.master | ||
# Add more branches as needed | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.8.15" | ||
|
||
- name: Set up Pants | ||
run: | | ||
# Install Pants | ||
export PATH=$PATH:/root/.local/bin | ||
curl --proto '=https' --tlsv1.2 -fsSL https://static.pantsbuild.org/setup/get-pants.sh | bash | ||
pants package :: | ||
- name: Checking formatting with Ruff | ||
run: | | ||
pip install ruff | ||
ruff check --extend-ignore=D1 | ||
- name: Setup edX & Run Tests | ||
run: | | ||
cd .. | ||
git clone https://github.com/edx/devstack.git | ||
cd devstack | ||
sed -i 's/:cached//g' ./docker-compose-host.yml | ||
git checkout ${{ matrix.devstack-branch }} | ||
make dev.clone.https | ||
DEVSTACK_WORKSPACE=$PWD/.. docker-compose -f docker-compose.yml -f docker-compose-host.yml run -v $PWD/../open-edx-plugins:/open-edx-plugins lms /open-edx-plugins/run_devstack_integration_tests.sh | ||
- name: Upload coverage to CodeCov | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
file: ./coverage.xml | ||
fail_ci_if_error: false |
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 |
---|---|---|
|
@@ -110,6 +110,7 @@ ignore = [ | |
"D205", | ||
"D301", | ||
"D400", | ||
"E902", | ||
"N803", | ||
"N806", | ||
"N999", | ||
|
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,62 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
source /edx/app/edxapp/venvs/edxapp/bin/activate | ||
|
||
cd /edx/app/edxapp/edx-platform | ||
mkdir -p reports | ||
|
||
pip install -r ./requirements/edx/testing.txt | ||
pip install -r ./requirements/edx/paver.txt | ||
|
||
mkdir -p test_root # for edx | ||
paver update_assets lms --settings=test_static_optimized | ||
|
||
cp test_root/staticfiles/lms/webpack-stats.json test_root/staticfiles/webpack-stats.json | ||
|
||
|
||
cd /open-edx-plugins | ||
|
||
pip install dist/edx-sysadmin-0.3.0.tar.gz | ||
pip install dist/ol-openedx-canvas-integration-0.3.0.tar.gz | ||
pip install dist/ol-openedx-checkout-external-0.1.3.tar.gz | ||
pip install dist/ol-openedx-course-export-0.1.2.tar.gz | ||
pip install dist/ol-openedx-course-structure-api-0.1.3.tar.gz | ||
pip install dist/ol-openedx-git-auto-export-0.3.1.tar.gz | ||
pip install dist/ol-openedx-logging-0.1.0.tar.gz | ||
pip install dist/ol-openedx-rapid-response-reports-0.3.0.tar.gz | ||
pip install dist/ol-openedx-sentry-0.1.2.tar.gz | ||
|
||
# Install codecov so we can upload code coverage results | ||
pip install codecov | ||
|
||
# output the packages which are installed for logging | ||
pip freeze | ||
|
||
set +e | ||
|
||
|
||
set +e | ||
for subdir in "src"/*; do | ||
if [ -d "$subdir" ]; then | ||
tests_directory="$subdir/tests" | ||
|
||
# Check if tests directory exists | ||
if [ -d "$tests_directory" ]; then | ||
cp -r /edx/app/edxapp/edx-platform/test_root/ "/open-edx-plugins/$subdir/test_root" | ||
echo "==============Running $subdir test===================" | ||
cd "$subdir" | ||
pytest . --cov . | ||
PYTEST_SUCCESS=$? | ||
|
||
if [[ $PYTEST_SUCCESS -ne 0 ]] | ||
then | ||
echo "pytest exited with a non-zero status" | ||
exit $PYTEST_SUCCESS | ||
fi | ||
coverage xml | ||
cd ../.. | ||
fi | ||
fi | ||
done | ||
set -e |
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
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 @@ | ||
[tool:pytest] | ||
pep8maxlinelength = 119 | ||
DJANGO_SETTINGS_MODULE = lms.envs.test | ||
addopts = --nomigrations --reuse-db --durations=20 | ||
# Enable default handling for all warnings, including those that are ignored by default; | ||
# but hide rate-limit warnings (because we deliberately don't throttle test user logins) | ||
# and field_data deprecation warnings (because fixing them requires a major low-priority refactoring) | ||
filterwarnings = | ||
default | ||
ignore::xblock.exceptions.FieldDataDeprecationWarning | ||
ignore::pytest.PytestConfigWarning | ||
ignore:No request passed to the backend, unable to rate-limit:UserWarning | ||
ignore:Flags not at the start of the expression:DeprecationWarning | ||
ignore:Using or importing the ABCs from 'collections' instead of from 'collections.abc':DeprecationWarning | ||
ignore:invalid escape sequence:DeprecationWarning | ||
ignore:`formatargspec` is deprecated since Python 3.5:DeprecationWarning | ||
ignore:the imp module is deprecated in favour of importlib:DeprecationWarning | ||
ignore:"is" with a literal:SyntaxWarning | ||
ignore:defusedxml.lxml is no longer supported:DeprecationWarning | ||
ignore: `np.int` is a deprecated alias for the builtin `int`.:DeprecationWarning | ||
ignore: `np.float` is a deprecated alias for the builtin `float`.:DeprecationWarning | ||
ignore: `np.complex` is a deprecated alias for the builtin `complex`.:DeprecationWarning | ||
ignore: 'etree' is deprecated. Use 'xml.etree.ElementTree' instead.:DeprecationWarning | ||
ignore: defusedxml.cElementTree is deprecated, import from defusedxml.ElementTree instead.:DeprecationWarning | ||
|
||
|
||
junit_family = xunit2 | ||
norecursedirs = .* *.egg build conf dist node_modules test_root cms/envs lms/envs | ||
python_classes = | ||
python_files = tests.py test_*.py tests_*.py *_tests.py __init__.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