Skip to content

Commit

Permalink
Merge branch 'main' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
janno42 committed Oct 11, 2022
2 parents d0bf4aa + 54fc1ef commit 51b0e51
Show file tree
Hide file tree
Showing 150 changed files with 14,022 additions and 8,627 deletions.
4 changes: 4 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
# run black code formatter
4e27f4f92663c583b5d00935565b2cdb38a8bccc
# run prettier on ts/src/ directory
822b3f38dce85fe3785965f120e5eb1accebd495
# run prettier on all other typescript files
02ea57d2c33eb2801414982662acd8582e361d10
4 changes: 2 additions & 2 deletions .github/workflows/debug-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ on:

jobs:
tests:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04

container:
image: python:3.7
image: python:3.8

services:
postgres:
Expand Down
80 changes: 53 additions & 27 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ on:
pull_request:

jobs:
tests:
runs-on: ubuntu-18.04
test:
name: Test + Coverage

runs-on: ubuntu-20.04

container:
image: python:3.7
image: python:3.8

services:
postgres:
Expand All @@ -24,15 +26,36 @@ jobs:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

strategy:
matrix:
include:
- name: Coverage
command: coverage run manage.py test && codecov -X gcov
- name: Reverse order
command: python manage.py test --reverse
steps:
- name: Check out repository code
uses: actions/checkout@v2
- name: Install dependencies
run: pip install -r requirements-dev.txt
- name: Add localsettings
run: cp evap/settings_test.py evap/localsettings.py
- name: Run tests
run: coverage run manage.py test
- name: Upload coverage
uses: codecov/codecov-action@v2

test_shuffled:
name: Test (shuffled order)

name: ${{ matrix.name }}
runs-on: ubuntu-20.04

container:
image: python:3.8

services:
postgres:
image: postgres
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: evap
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

steps:
- name: Check out repository code
Expand All @@ -42,14 +65,13 @@ jobs:
- name: Add localsettings
run: cp evap/settings_test.py evap/localsettings.py
- name: Run tests
run: ${{ matrix.command }}

run: python manage.py test --shuffle

mypy:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04

container:
image: python:3.7
image: python:3.8

name: MyPy

Expand All @@ -64,10 +86,10 @@ jobs:
run: mypy -p evap

linter:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04

container:
image: python:3.7
image: python:3.8

name: Linter

Expand All @@ -83,7 +105,7 @@ jobs:


formatter:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04

name: Formatting

Expand All @@ -92,7 +114,7 @@ jobs:
uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.7
python-version: 3.8
- name: Install Python dependencies
run: pip install -r requirements-dev.txt
- name: Setup Node
Expand All @@ -107,14 +129,14 @@ jobs:
run: isort . --check --diff
- run: ls -laR evap/static/ts
- name: Check TypeScript formatting
run: npx prettier --list-different --loglevel debug --config evap/static/ts/.prettierrc.json evap/static/ts/src
run: npx prettier --list-different --loglevel debug 'evap/static/ts/**/*.ts'


backup-process:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04

container:
image: python:3.7
image: python:3.8

services:
postgres:
Expand Down Expand Up @@ -157,7 +179,7 @@ jobs:
run: echo "yy" | deployment/load_production_backup.sh backup.json

compile_scss:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04

name: Compile Scss

Expand All @@ -180,10 +202,10 @@ jobs:


render_pages:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04

container:
image: python:3.7
image: python:3.8

name: Render Html pages

Expand Down Expand Up @@ -211,7 +233,11 @@ jobs:
- name: Add localsettings
run: cp evap/settings_test.py evap/localsettings.py
- name: Render pages
run: coverage run manage.py ts render_pages && codecov -X gcov -F render-pages
run: coverage run manage.py ts render_pages
- name: Upload coverage
uses: codecov/codecov-action@v2
with:
flags: render-pages
- name: Store rendered pages
uses: actions/upload-artifact@v2
with:
Expand All @@ -220,7 +246,7 @@ jobs:


typescript:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04

needs: [ compile_scss, render_pages ]

Expand Down
9 changes: 6 additions & 3 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
# License

The software is licensed under the MIT license. The source code includes other
components in whole or in part; namely Bootstrap Datepicker, Font Awesome,
jQuery, jQuery Formset, Moment, Select2, Sisyphus, Sortable.
These components are used under the MIT resp. SIL OFL licenses.
components in whole or in part, used under these licenses:
* [Apache-2.0](https://www.apache.org/licenses/LICENSE-2.0): Bootstrap Datetimepicker, Tom Select
* [CC-BY-4.0](https://creativecommons.org/licenses/by/4.0/legalcode): Font Awesome Icons
* [OFL-1.1](https://scripts.sil.org/OFL): Font Awesome Fonts
* [MIT](https://opensource.org/licenses/MIT): Bootstrap, Font Awesome Code, jQuery, Moment, Sisyphus, Sortable
* [BSD-2-Clause](https://opensource.org/licenses/bsd-license.php): jQuery Formset

The source repository may include logos, names or other trademarks of the
Hasso Plattner Institute, the Fachschaftsrat Digital Engineering or other
Expand Down
7 changes: 4 additions & 3 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ Vagrant.require_version ">= 1.8.1"

Vagrant.configure("2") do |config|
config.vm.provider :virtualbox do |v, override|
override.vm.box = "ubuntu/bionic64"
override.vm.box_version = "= 20210928.0.0 "
v.memory = 2048
override.vm.box = "ubuntu/focal64"
override.vm.box_version = "= 20220426.0.0 "
override.vm.provision "shell", path: "deployment/provision_vagrant_vm.sh"

# disable logfile
Expand All @@ -18,7 +19,7 @@ Vagrant.configure("2") do |config|
end

config.vm.provider :docker do |d, override|
d.image = "ubuntu:bionic"
d.image = "ubuntu:focal"
# Docker container really are supposed to be used differently. Hacky way to make it into a "VM".
d.cmd = ["tail", "-f", "/dev/null"]

Expand Down
4 changes: 1 addition & 3 deletions deployment/load_production_backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,9 @@ sudo -H -u "$USERNAME" "$ENVDIR/bin/python" manage.py migrate
sudo -H -u "$USERNAME" "$ENVDIR/bin/python" manage.py flush "$CONDITIONAL_NOINPUT"
sudo -H -u "$USERNAME" "$ENVDIR/bin/python" manage.py loaddata "$1"

sudo -H -u "$USERNAME" "$ENVDIR/bin/python" manage.py clear_cache
sudo -H -u "$USERNAME" "$ENVDIR/bin/python" manage.py clear_cache --all -v=1
sudo -H -u "$USERNAME" "$ENVDIR/bin/python" manage.py refresh_results_cache

sudo -H -u "$USERNAME" "$ENVDIR/bin/python" manage.py clear_cache --cache=sessions

[[ -z "$GITHUB_WORKFLOW" ]] && sudo service apache2 start

{ set +x; } 2>/dev/null # don't print the echo command, and don't print the 'set +x' itself
Expand Down
10 changes: 4 additions & 6 deletions deployment/provision_vagrant_vm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ MOUNTPOINT="/evap"
USER="evap"
REPO_FOLDER="/opt/evap"
ENV_FOLDER="/home/$USER/venv"
EVAP_PYTHON=python3.8

# force apt to not ask, just do defaults.
export DEBIAN_FRONTEND=noninteractive
Expand All @@ -18,7 +19,7 @@ apt-get -q install -y sudo wget git bash-completion
printf '#!/bin/sh\nexit 0' > /usr/sbin/policy-rc.d

# install python stuff
apt-get -q install -y python3.7 python3.7-dev python3-venv python3.7-venv gettext
apt-get -q install -y $EVAP_PYTHON $EVAP_PYTHON-dev $EVAP_PYTHON-venv gettext

# setup postgres
apt-get -q install -y postgresql
Expand All @@ -32,7 +33,7 @@ sed -i "s/^bind .*/bind 127.0.0.1/g" /etc/redis/redis.conf
service redis-server restart

# install apache
apt-get -q install -y apache2 apache2-dev
apt-get -q install -y apache2 apache2-dev libapache2-mod-wsgi-py3

# With docker for mac, root will own the mount point (uid=0). chmod does not touch the host file system in these cases.
OWNER=$(stat -c %U "$MOUNTPOINT/evap")
Expand All @@ -49,16 +50,13 @@ echo "$USER ALL=(ALL) NOPASSWD:ALL" | tee /etc/sudoers.d/evap
# link the mounted evap folder from the home directory
ln -s "$MOUNTPOINT" "$REPO_FOLDER"

sudo -H -u $USER python3.7 -m venv $ENV_FOLDER
sudo -H -u $USER $EVAP_PYTHON -m venv $ENV_FOLDER
# venv will use ensurepip to install a new version of pip. We need to update that version.
sudo -H -u $USER $ENV_FOLDER/bin/python -m pip install -U pip
sudo -H -u $USER $ENV_FOLDER/bin/pip install wheel
sudo -H -u $USER $ENV_FOLDER/bin/pip install mod_wsgi

# setup apache
a2enmod headers
cp $REPO_FOLDER/deployment/wsgi.template.conf /etc/apache2/mods-available/wsgi.load
sed -i -e "s=\${ENV_FOLDER}=$ENV_FOLDER=" /etc/apache2/mods-available/wsgi.load # note this uses '=' as alternate delimiter
a2enmod wsgi
a2enmod rewrite
cp $REPO_FOLDER/deployment/apache.maintenance-template.conf /etc/apache2/sites-available/evap-maintenance.conf
Expand Down
2 changes: 1 addition & 1 deletion deployment/update_production.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ sudo -H -u "$USERNAME" "$ENVDIR/bin/python" manage.py scss --production
sudo -H -u "$USERNAME" "$ENVDIR/bin/python" manage.py ts compile --fresh
sudo -H -u "$USERNAME" "$ENVDIR/bin/python" manage.py collectstatic --noinput
sudo -H -u "$USERNAME" "$ENVDIR/bin/python" manage.py migrate
sudo -H -u "$USERNAME" "$ENVDIR/bin/python" manage.py clear_cache
sudo -H -u "$USERNAME" "$ENVDIR/bin/python" manage.py clear_cache --all -v=1
sudo -H -u "$USERNAME" "$ENVDIR/bin/python" manage.py refresh_results_cache

[[ -z "$GITHUB_WORKFLOW" ]] && sudo ./deployment/disable_maintenance_mode.sh
Expand Down
1 change: 0 additions & 1 deletion deployment/wsgi.template.conf

This file was deleted.

4 changes: 4 additions & 0 deletions evap/context_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@ def slogan(request):

def debug(request):
return {"debug": settings.DEBUG}


def allow_anonymous_feedback_messages(request):
return {"allow_anonymous_feedback_messages": settings.ALLOW_ANONYMOUS_FEEDBACK_MESSAGES}
7 changes: 3 additions & 4 deletions evap/contributor/templates/contributor_evaluation_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@
{% blocktrans %}You cannot edit this evaluation because it has already been approved.{% endblocktrans %}
{% endif %}
</div>

<h3>
{{ evaluation.full_name }} ({{ evaluation.course.semester.name }})
</h3>

<form method="POST" class="form-horizontal multiselect-form select2form" id="evaluation-form">
<form method="POST" class="form-horizontal multiselect-form tomselectform" id="evaluation-form">
{% csrf_token %}
<div class="card mb-3">
<div class="card-body">
Expand Down Expand Up @@ -65,13 +64,13 @@ <h5 class="card-title">{% trans 'Course data' %}</h5>
<h5 class="card-title me-auto">{% trans 'Evaluation data' %}</h5>
{% if evaluation.allow_editors_to_edit %}
<div>
<button type="button" class="btn btn-sm btn-light mb-3" onclick="createAccountRequestModalShow();" id="createAccountRequestModalButtonInEvaluationForm">
<button type="button" class="btn btn-sm btn-light mb-3 createAccountRequestModalShowButton">
{% trans 'Request creation of new account' %}
</button>
</div>
{% else %}
<div>
<button type="button" class="btn btn-sm btn-light" onclick="changeEvaluationRequestModalShow();" id="changeEvaluationDataRequestModalButton">
<button type="button" class="btn btn-sm btn-light changeEvaluationRequestModalShowButton">
{% trans 'Request changes' %}
</button>
</div>
Expand Down
16 changes: 7 additions & 9 deletions evap/contributor/templates/contributor_index.html
Original file line number Diff line number Diff line change
Expand Up @@ -225,18 +225,19 @@
{% csrf_token %}
<div class="modal-header">
<h5 class="modal-title" id="{{ modal_id }}Label">{% trans 'Delegate preparation' %}</h5>
<button class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
{% trans 'Do you really want to delegate the preparation of the evaluation <strong data-label=""></strong>?' %}
<div class="pt-4">
<div class="my-4">
{% include 'bootstrap_form.html' with form=delegate_selection_form wide=True %}
</div>
<div class="modal-submit-group">
<button type="button" class="btn btn-light" data-bs-dismiss="modal">{% trans 'Cancel' %}</button>
<button type="submit" id="btn-action" class="btn btn-primary ms-2">{% trans 'Delegate preparation' %}</button>
</div>
</div>
<div class="modal-footer">
<button type="submit" id="btn-action" class="btn btn-primary">{% trans 'Delegate preparation' %}</button>
<button type="button" class="btn btn-light" data-bs-dismiss="modal">{% trans 'Cancel' %}</button>
</div>

</form>
</div>
</div>
Expand All @@ -250,9 +251,6 @@ <h5 class="modal-title" id="{{ modal_id }}Label">{% trans 'Delegate preparation'
// put the correct evaluation name in the modal
$('#{{ modal_id }} [data-label=""]').text(evaluationName);

// fix incorrect select2 width calculation that occurrs because the select2 is applied while the modal is invisible
$('#{{ modal_id }} span.select2').width("100%");

// unselect any previously selected options in the modal
$('#{{ modal_id }} select').val(null).trigger('change');

Expand Down
Loading

0 comments on commit 51b0e51

Please sign in to comment.