-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create GitHub workflow to automatically run tests #64
-Added Dolos as submodule -Modified how to compare matches: -Created a new Django command 'recompare' to compare matches without using the "Recompare all" or the "Recompare all exercises with unmatched submissions" button -In exercise settings "Recomparing all submissions" now recompares without needing the CLI command 'matchsubmissions' -In course page "Recompare all exercises with unmatched submissions" now recompares without needing the CLI command 'matchsubmissions' -Added Python submissions for testing Radar -Updated README.md for how to compare matches
- Loading branch information
1 parent
527e01d
commit d1f84af
Showing
12 changed files
with
149 additions
and
12 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,52 @@ | ||
name: tests | ||
on: | ||
# trigger when pushed to any branch (for development) | ||
push: | ||
# trigger when a pull request is made to master | ||
pull_request: | ||
branches: | ||
- master | ||
jobs: | ||
playwright-tests: | ||
timeout-minutes: 60 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
- name: Start Dolos | ||
working-directory: dolos | ||
run: | | ||
docker pull ghcr.io/dodona-edu/dolos-cli:latest | ||
docker compose up --detach | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
- name: Ensure browsers are installed | ||
run: python -m playwright install --with-deps | ||
- name: Set up Radar | ||
run: | | ||
python manage.py migrate | ||
DJANGO_SUPERUSER_PASSWORD=Password \ | ||
python manage.py createsuperuser \ | ||
--no-input \ | ||
--username=Username \ | ||
[email protected] | ||
- name: Upload submissions and compare | ||
run: | | ||
bash run_loadsubmissions.sh e2e_tests/testing_data/radar_test_python testcourse exercise1 1 | ||
python manage.py recompare testcourse/exercise1 | ||
- name: Run Radar | ||
run: python manage.py runserver & | ||
- name: Run tests | ||
run: pytest --tracing=retain-on-failure | ||
- uses: actions/upload-artifact@v4 | ||
if: ${{ !cancelled() }} | ||
with: | ||
name: playwright-traces | ||
path: test_results/ |
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,3 @@ | ||
[submodule "dolos"] | ||
path = dolos | ||
url = https://github.com/dodona-edu/dolos |
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,20 @@ | ||
from django.core.management.base import BaseCommand | ||
|
||
from provider.filesystem import recompare | ||
from data.models import Course | ||
|
||
|
||
class Command(BaseCommand): | ||
help = ( | ||
"Calculate similarity for all submissions in the exercise." | ||
) | ||
|
||
def add_arguments(self, parser): | ||
parser.add_argument('course/exercise', type=str) | ||
|
||
def handle(self, *args, **options): | ||
(course_key, exercise_key) = options['course/exercise'].split("/", 1) | ||
course = Course.objects.get(key=course_key) | ||
exercise = course.get_exercise(exercise_key) | ||
|
||
recompare(exercise, {}) |
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
10 changes: 10 additions & 0 deletions
10
e2e_tests/testing_data/radar_test_python/A/ex2/1_file1_submission1
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 @@ | ||
import random | ||
|
||
def print_hello(): | ||
print('Hello, World!') | ||
|
||
def main(): | ||
print_hello() | ||
|
||
if __name__ == '__main__': | ||
main() |
12 changes: 12 additions & 0 deletions
12
e2e_tests/testing_data/radar_test_python/B/ex2/2_file1_submission2
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 @@ | ||
import random | ||
import math | ||
import datetime | ||
|
||
def print_hello(): | ||
print('Hello, World!') | ||
|
||
def main(): | ||
print_hello() | ||
|
||
if __name__ == '__main__': | ||
main() |
11 changes: 11 additions & 0 deletions
11
e2e_tests/testing_data/radar_test_python/C/ex2/3_file1_submission2
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,11 @@ | ||
import datetime | ||
import random | ||
|
||
def print_hello(): | ||
print('Hello, World!') | ||
|
||
def main(): | ||
print_hello() | ||
|
||
if __name__ == '__main__': | ||
main() |
8 changes: 8 additions & 0 deletions
8
e2e_tests/testing_data/radar_test_python/D/ex2/4_file1_submission1
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 @@ | ||
import random | ||
import math | ||
|
||
def add(a, b): | ||
return a + b | ||
|
||
if __name__ == '__main__': | ||
print(add(1, 2)) |
9 changes: 9 additions & 0 deletions
9
e2e_tests/testing_data/radar_test_python/E/ex2/5_file1_submission2
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,9 @@ | ||
import math | ||
import datetime | ||
import random | ||
|
||
def print_random_number(): | ||
print(f'Random number: {random.randint(1, 100)}') | ||
|
||
if __name__ == '__main__': | ||
print_random_number() |
10 changes: 10 additions & 0 deletions
10
e2e_tests/testing_data/radar_test_python/F/ex2/6_file1_submission1
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 @@ | ||
import random | ||
|
||
def print_hello(): | ||
print('Hello, World!') | ||
|
||
def main(): | ||
print_hello() | ||
|
||
if __name__ == '__main__': | ||
main() |
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