Skip to content
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
46 changes: 0 additions & 46 deletions .github/workflows/ci.yml

This file was deleted.

47 changes: 47 additions & 0 deletions .github/workflows/javascript-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: JavaScript Tests

on:
push:
branches: [main]
pull_request:
branches:
- "**"

jobs:
javascript-tests:
name: Run JavaScript Tests
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20]

steps:
- name: Check out repository
uses: actions/checkout@v5

- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v5
with:
node-version: ${{ matrix.node-version }}
cache: "npm"

- name: Install Latest Firefox
run: |
sudo apt-get purge -y firefox
LATEST_VERSION=$(curl -s https://product-details.mozilla.org/1.0/firefox_versions.json | jq -r '.LATEST_FIREFOX_VERSION')
echo "Latest Firefox version is $LATEST_VERSION"
wget "https://ftp.mozilla.org/pub/firefox/releases/${LATEST_VERSION}/linux-x86_64/en-US/firefox-${LATEST_VERSION}.tar.xz" -O firefox.tar.xz
tar -xJf firefox.tar.xz
sudo mv firefox /opt/firefox
sudo ln -sf /opt/firefox/firefox /usr/bin/firefox

- name: Install Required System Packages
run: |
sudo apt-get update
sudo apt-get install -y libdbus-glib-1-2 libgtk-3-0 xvfb

- name: Install npm dependencies
run: npm ci

- name: Run tests
run: npm run test:ci || echo "⚠️ Tests skipped — no workspaces available"
43 changes: 43 additions & 0 deletions .github/workflows/python-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Python Tests

on:
push:
branches: [main]
pull_request:
branches:
- "**"

jobs:
python-tests:
name: Run Python Tests and Coverage
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
python-version: ["3.11", "3.12"]
toxenv: [quality, docs, django42, django52]

steps:
- name: Check out repository
uses: actions/checkout@v5

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

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

- name: Run tests with Tox (${{ matrix.toxenv }})
env:
TOXENV: ${{ matrix.toxenv }}
run: tox

- name: Upload coverage to Codecov
if: matrix.python-version == '3.12' && matrix.toxenv == 'django42'
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unittests
fail_ci_if_error: true
12 changes: 12 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"private": true,
"workspaces": [
"xblocks_contrib/*/static"
],
"scripts": {
"test": "npm run test --workspaces",
"test:ci": "npm run test:ci --workspaces"
}
}
22 changes: 3 additions & 19 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,11 @@ exclude = .git,.tox,migrations
max-line-length = 120

[pydocstyle]
; D101 = Missing docstring in public class
; D200 = One-line docstring should fit on one line with quotes
; D203 = 1 blank line required before class docstring
; D212 = Multi-line docstring summary should start at the first line
; D215 = Section underline is over-indented (numpy style)
; D404 = First word of the docstring should not be This (numpy style)
; D405 = Section name should be properly capitalized (numpy style)
; D406 = Section name should end with a newline (numpy style)
; D407 = Missing dashed underline after section (numpy style)
; D408 = Section underline should be in the line following the section's name (numpy style)
; D409 = Section underline should match the length of its name (numpy style)
; D410 = Missing blank line after section (numpy style)
; D411 = Missing blank line before section (numpy style)
; D412 = No blank lines allowed between a section header and its content (numpy style)
; D413 = Missing blank line after last section (numpy style)
; D414 = Section has no content (numpy style)
ignore = D101,D200,D203,D212,D215,D404,D405,D406,D407,D408,D409,D410,D411,D412,D413,D414
match-dir = (?!migrations)

[pytest]
DJANGO_SETTINGS_MODULE = workbench.settings
DJANGO_SETTINGS_MODULE = xblocks_contrib.test_settings
django_find_project = false
addopts = --cov xblocks_contrib --cov-report term-missing --cov-report xml
norecursedirs = .* docs requirements site-packages

Expand All @@ -45,7 +29,7 @@ allowlist_externals =
commands =
pip install -e .
mkdir -p var
pytest {posargs}
pytest {posargs} -s

[testenv:docs]
setenv =
Expand Down
4 changes: 1 addition & 3 deletions xblocks_contrib/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
"""
Init for the xblocks_contrib package.
"""
"""Init for the xblocks_contrib package."""

from .annotatable import AnnotatableBlock
from .discussion import DiscussionXBlock
Expand Down
14 changes: 14 additions & 0 deletions xblocks_contrib/test_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"""
Minimal Django settings for running tests on xblocks_contrib.
"""

INSTALLED_APPS = [
"django.contrib.auth",
"django.contrib.contenttypes",
]

DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
}
}