diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 000000000..de8b0f7bd --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,42 @@ +name: Documentation + +on: + push: + branches: [ master ] + paths-ignore: + - 'src/pretix/locale/**' + - 'src/pretix/static/**' + - 'src/tests/**' + pull_request: + branches: [ master ] + paths-ignore: + - 'src/pretix/locale/**' + - 'src/pretix/static/**' + - 'src/tests/**' + +jobs: + spelling: + name: Spellcheck + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.8 + uses: actions/setup-python@v1 + with: + python-version: 3.8 + - uses: actions/cache@v1 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip- + - name: Install system packages + run: sudo apt install enchant hunspell aspell-en + - name: Install Dependencies + run: pip3 install --no-use-pep517 -Ur doc/requirements.txt + - name: Spellcheck docs + run: make spelling + working-directory: ./doc + - name: + run: '[ ! -s _build/spelling/output.txt ]' + working-directory: ./doc diff --git a/.github/workflows/strings.yml b/.github/workflows/strings.yml new file mode 100644 index 000000000..af78ae2fd --- /dev/null +++ b/.github/workflows/strings.yml @@ -0,0 +1,60 @@ +name: Strings + +on: + push: + branches: [ master ] + paths: + - 'src/pretix/locale/**' + pull_request: + branches: [ master ] + paths: + - 'src/pretix/locale/**' + +jobs: + compile: + runs-on: ubuntu-latest + name: Check gettext syntax + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.8 + uses: actions/setup-python@v1 + with: + python-version: 3.8 + - uses: actions/cache@v1 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip- + - name: Install system packages + run: sudo apt install gettext + - name: Install Dependencies + run: pip3 install --no-use-pep517 -Ur src/requirements.txt + - name: Compile messages + run: python manage.py compilemessages + working-directory: ./src + - name: Compile jsi18n + run: python manage.py compilejsi18n + working-directory: ./src + spelling: + runs-on: ubuntu-latest + name: Spellcheck + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.8 + uses: actions/setup-python@v1 + with: + python-version: 3.8 + - uses: actions/cache@v1 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip- + - name: Install system packages + run: sudo apt install enchant hunspell hunspell-de-de aspell-en aspell-de + - name: Install Dependencies + run: pip3 install --no-use-pep517 -Ur src/requirements/dev.txt + - name: Spellcheck translations + run: potypo + working-directory: ./src diff --git a/.github/workflows/style.yml b/.github/workflows/style.yml new file mode 100644 index 000000000..ebc020114 --- /dev/null +++ b/.github/workflows/style.yml @@ -0,0 +1,55 @@ +name: Code Style + +on: + push: + branches: [ master ] + paths-ignore: + - 'src/pretix/locale/**' + - 'src/pretix/static/**' + pull_request: + branches: [ master ] + paths-ignore: + - 'src/pretix/locale/**' + - 'src/pretix/static/**' + +jobs: + isort: + name: isort + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.8 + uses: actions/setup-python@v1 + with: + python-version: 3.8 + - uses: actions/cache@v1 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip- + - name: Install Dependencies + run: pip3 install --no-use-pep517 -Ur src/requirements/dev.txt + - name: Run flake8 + run: flake8 . + working-directory: ./src + flake: + name: flake8 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.8 + uses: actions/setup-python@v1 + with: + python-version: 3.8 + - uses: actions/cache@v1 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip- + - name: Install Dependencies + run: pip3 install -r src/requirements.txt --no-use-pep517 -Ur src/requirements/dev.txt + - name: Run flake8 + run: flake8 . + working-directory: ./src diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 000000000..dd64d2e2d --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,73 @@ +name: Tests + +on: + push: + branches: [ master ] + paths-ignore: + - 'doc/**' + pull_request: + branches: [ master ] + paths-ignore: + - 'doc/**' + +jobs: + test: + runs-on: ubuntu-latest + name: Tests + strategy: + matrix: + python-version: [3.6, 3.7, 3.8] + database: [sqlite, postgres, mysql] + exclude: + - database: mysql + python-version: 3.7 + - database: sqlite + python-version: 3.7 + - database: mysql + python-version: 3.6 + - database: sqlite + python-version: 3.6 + steps: + - uses: actions/checkout@v2 + - uses: getong/mariadb-action@v1.1 + with: + mariadb version: '10.4' + mysql database: 'pretix' + mysql root password: '' + if: matrix.database == 'mysql' + - uses: harmon758/postgresql-action@v1 + with: + postgresql version: '11' + postgresql db: 'pretix' + postgresql user: 'postgres' + postgresql password: 'postgres' + if: matrix.database == 'postgres' + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python-version }} + - uses: actions/cache@v1 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip- + - name: Install system dependencies + run: sudo apt install gettext mysql-client + - name: Install Python dependencies + run: pip3 install -r src/requirements.txt --no-use-pep517 -Ur src/requirements/dev.txt mysqlclient psycopg2-binary + - name: Run checks + run: python manage.py check + working-directory: ./src + - name: Compile + working-directory: ./src + run: make all compress + - name: Run tests + working-directory: ./src + run: PRETIX_CONFIG_FILE=tests/travis_${{ matrix.database }}.cfg py.test -n 3 -p no:sugar --cov=./ --cov-report=xml --reruns 3 tests --maxfail=100 + - name: Upload coverage + uses: codecov/codecov-action@v1 + with: + file: src/coverage.xml + fail_ci_if_error: true + if: matrix.database == 'postgres' && matrix.python-version == '3.8' diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e101decc1..c36356056 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,7 +5,11 @@ tests: - virtualenv env - source env/bin/activate - pip install -U pip wheel setuptools - - XDG_CACHE_HOME=/cache bash .travis.sh tests + - XDG_CACHE_HOME=/cache pip3 install -r src/requirements.txt --no-use-pep517 -Ur src/requirements/dev.txt + - cd src + - python manage.py check + - make all compress + - py.test --reruns 3 -n 3 tests tags: - python3 except: diff --git a/.travis.sh b/.travis.sh deleted file mode 100755 index 10bfd8ce2..000000000 --- a/.travis.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/bash -set -e -set -x - -echo "Executing job $1" - -if [ "$PRETIX_CONFIG_FILE" == "tests/travis_mysql.cfg" ]; then - mysql -u root -e 'CREATE DATABASE pretix DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;' - pip3 install -Ur src/requirements/mysql.txt -fi - -if [ "$PRETIX_CONFIG_FILE" == "tests/travis_postgres.cfg" ]; then - psql -c 'create database travis_ci_test;' -U postgres -fi - -if [ "$1" == "style" ]; then - XDG_CACHE_HOME=/cache pip3 install --no-use-pep517 -Ur src/requirements.txt -r src/requirements/dev.txt - cd src - flake8 . - isort -c -rc -df . -fi -if [ "$1" == "doctests" ]; then - XDG_CACHE_HOME=/cache pip3 install --no-use-pep517 -Ur doc/requirements.txt - cd doc - make doctest -fi -if [ "$1" == "doc-spelling" ]; then - XDG_CACHE_HOME=/cache pip3 install --no-use-pep517 -Ur doc/requirements.txt - cd doc - make spelling - if [ -s _build/spelling/output.txt ]; then - exit 1 - fi -fi -if [ "$1" == "translation-spelling" ]; then - XDG_CACHE_HOME=/cache pip3 install --no-use-pep517 -Ur src/requirements/dev.txt - cd src - potypo -fi -if [ "$1" == "tests" ]; then - pip3 install -r src/requirements.txt --no-use-pep517 -Ur src/requirements/dev.txt - cd src - python manage.py check - make all compress - py.test --reruns 5 -n 3 tests -fi -if [ "$1" == "tests-cov" ]; then - pip3 install -r src/requirements.txt --no-use-pep517 -Ur src/requirements/dev.txt - cd src - python manage.py check - make all compress - coverage run -m py.test --reruns 5 tests && codecov -fi -if [ "$1" == "plugins" ]; then - pip3 install -r src/requirements.txt --no-use-pep517 -Ur src/requirements/dev.txt - cd src - python setup.py develop - make all compress - - pushd ~ - git clone --depth 1 https://github.com/pretix/pretix-cartshare.git - cd pretix-cartshare - python setup.py develop - make - py.test --reruns 5 tests - popd - -fi diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index bfd309e5e..000000000 --- a/.travis.yml +++ /dev/null @@ -1,45 +0,0 @@ -language: python -dist: xenial -sudo: false -install: - - pip install -U pip wheel setuptools -script: - - bash .travis.sh $JOB -cache: - directories: - - $HOME/.cache/pip -services: - - mysql - - postgresql -matrix: - include: - - python: 3.8 - env: JOB=tests PRETIX_CONFIG_FILE=tests/travis_sqlite.cfg - - python: 3.8 - env: JOB=tests-cov PRETIX_CONFIG_FILE=tests/travis_postgres.cfg - - python: 3.8 - env: JOB=style - - python: 3.8 - env: JOB=tests PRETIX_CONFIG_FILE=tests/travis_mysql.cfg - - python: 3.8 - env: JOB=tests PRETIX_CONFIG_FILE=tests/travis_postgres.cfg - - python: 3.7 - env: JOB=tests PRETIX_CONFIG_FILE=tests/travis_postgres.cfg - - python: 3.8 - env: JOB=doc-spelling - - python: 3.8 - env: JOB=translation-spelling -addons: - postgresql: "10" - mariadb: '10.3' - apt: - packages: - - enchant - - myspell-de-de - - aspell-en - - sqlite3 - sources: - - travis-ci/sqlite3 -branches: - except: - - /^weblate-.*/ diff --git a/README.rst b/README.rst index 824608ab7..1891e61ee 100644 --- a/README.rst +++ b/README.rst @@ -4,11 +4,10 @@ pretix .. image:: https://img.shields.io/pypi/v/pretix.svg :target: https://pypi.python.org/pypi/pretix -.. image:: https://readthedocs.org/projects/pretix/badge/?version=latest +.. image:: https://github.com/pretix/pretix/workflows/Documentation/badge.svg :target: https://docs.pretix.eu/en/latest/ -.. image:: https://travis-ci.org/pretix/pretix.svg?branch=master - :target: https://travis-ci.org/pretix/pretix +.. image:: https://github.com/pretix/pretix/workflows/Tests/badge.svg .. image:: https://codecov.io/gh/pretix/pretix/branch/master/graph/badge.svg :target: https://codecov.io/gh/pretix/pretix diff --git a/doc/development/contribution/style.rst b/doc/development/contribution/style.rst index 989c6b349..cfdf33436 100644 --- a/doc/development/contribution/style.rst +++ b/doc/development/contribution/style.rst @@ -18,7 +18,7 @@ Coding style and quality * We expect all new code to come with proper tests. When writing new tests, please write them using `pytest-style`_ test functions and raw ``assert`` statements. Use `fixtures`_ to prevent repetitive code. Some old parts of pretix' test suite are in the style of Python's unit test module. If you extend those files, you might continue in this style, - but please use pytest style for any new test files. + but please use ``pytest`` style for any new test files. * Please keep the first line of your commit messages short. When referencing an issue, please phrase it like ``Fix #123 -- Problems with order creation`` or ``Refs #123 -- Fix this part of that bug``. diff --git a/src/pretix/api/serializers/order.py b/src/pretix/api/serializers/order.py index 2fee37326..d799f9edd 100644 --- a/src/pretix/api/serializers/order.py +++ b/src/pretix/api/serializers/order.py @@ -751,7 +751,7 @@ class OrderCreateSerializer(I18nAwareModelSerializer): sales_channel = get_all_sales_channels()[self.initial_data['sales_channel']] if testmode and not sales_channel.testmode_supported: - raise ValidationError('This sales channel does not provide support for testmode.') + raise ValidationError('This sales channel does not provide support for test mode.') except KeyError: # We do not need to raise a ValidationError here, since there is another check to validate the # sales_channel diff --git a/src/pretix/base/exporters/orderlist.py b/src/pretix/base/exporters/orderlist.py index 891794fb7..c4303960c 100644 --- a/src/pretix/base/exporters/orderlist.py +++ b/src/pretix/base/exporters/orderlist.py @@ -712,7 +712,7 @@ class InvoiceDataExporter(MultiSheetListExporter): class GiftcardRedemptionListExporter(ListExporter): identifier = 'giftcardredemptionlist' - verbose_name = gettext_lazy('Giftcard Redemptions') + verbose_name = gettext_lazy('Gift card redemptions') def iterate_list(self, form_data): tz = pytz.timezone(self.event.settings.timezone) diff --git a/src/pretix/base/models/giftcards.py b/src/pretix/base/models/giftcards.py index 4162eb309..8bdea4ae5 100644 --- a/src/pretix/base/models/giftcards.py +++ b/src/pretix/base/models/giftcards.py @@ -55,7 +55,7 @@ class GiftCard(LoggedModel): validators=[ RegexValidator( regex="^[a-zA-Z0-9][a-zA-Z0-9.-]+$", - message=_("The giftcard code may only contain letters, numbers, dots and dashes."), + message=_("The gift card code may only contain letters, numbers, dots and dashes."), ) ], ) diff --git a/src/pretix/base/pdf.py b/src/pretix/base/pdf.py index d7c93e181..04abe3572 100644 --- a/src/pretix/base/pdf.py +++ b/src/pretix/base/pdf.py @@ -212,7 +212,7 @@ DEFAULT_VARIABLES = OrderedDict(( }), ("addons", { "label": _("List of Add-Ons"), - "editor_sample": _("Addon 1\nAddon 2"), + "editor_sample": _("Add-on 1\nAdd-on 2"), "evaluate": lambda op, order, ev: "\n".join([ '{} - {}'.format(p.item, p.variation) if p.variation else str(p.item) for p in ( diff --git a/src/pretix/base/services/cart.py b/src/pretix/base/services/cart.py index 68e518e01..3bbb55099 100644 --- a/src/pretix/base/services/cart.py +++ b/src/pretix/base/services/cart.py @@ -1108,7 +1108,7 @@ def add_items_to_cart(self, event: int, items: List[dict], cart_id: str=None, lo :param event: The event ID in question :param items: A list of dicts with the keys item, variation, count, custom_price, voucher, seat ID :param cart_id: Session ID of a guest - :raises CartError: On any error that occured + :raises CartError: On any error that occurred """ with language(locale): ia = False diff --git a/src/pretix/base/settings.py b/src/pretix/base/settings.py index 8ab761d83..e07c979aa 100644 --- a/src/pretix/base/settings.py +++ b/src/pretix/base/settings.py @@ -857,7 +857,7 @@ DEFAULTS = { 'form_kwargs': dict( label=_("Generate tickets for all products"), help_text=_('If turned off, tickets are only issued for products that are marked as an "admission ticket"' - 'in the product settings. You can also turn off tickt issuing in every product separately.'), + 'in the product settings. You can also turn off ticket issuing in every product separately.'), widget=forms.CheckboxInput(attrs={'data-checkbox-dependency': '#id_ticket_download', 'data-checkbox-dependency-visual': 'on'}), ) @@ -980,7 +980,7 @@ DEFAULTS = { widget_kwargs={'attrs': {'rows': '2'}}, help_text=_("This text will be shown in between the explanation of how the refunds work and the slider " "which your customers can use to choose the amount they would like to receive. You can use it " - "e.g. to explain choosing a lower refund will help your organisation.") + "e.g. to explain choosing a lower refund will help your organization.") ) }, 'cancel_allow_user_paid_require_approval': { diff --git a/src/pretix/control/forms/event.py b/src/pretix/control/forms/event.py index be3a644db..001337a17 100644 --- a/src/pretix/control/forms/event.py +++ b/src/pretix/control/forms/event.py @@ -396,7 +396,7 @@ class EventSettingsForm(SettingsForm): name_scheme = forms.ChoiceField( label=_("Name format"), help_text=_("This defines how pretix will ask for human names. Changing this after you already received " - "orders might lead to unexpected behaviour when sorting or changing names."), + "orders might lead to unexpected behavior when sorting or changing names."), required=True, ) name_scheme_titles = forms.ChoiceField( diff --git a/src/pretix/control/forms/orders.py b/src/pretix/control/forms/orders.py index a9abb194b..39a6e24f3 100644 --- a/src/pretix/control/forms/orders.py +++ b/src/pretix/control/forms/orders.py @@ -194,7 +194,7 @@ class OtherOperationsForm(forms.Form): initial=True, help_text=_( 'If an invoice exists for this order and this operation would change its contents, the old invoice will ' - 'be cancelled and a new invoice will be issued.' + 'be canceled and a new invoice will be issued.' ) ) notify = forms.BooleanField( diff --git a/src/pretix/control/forms/organizer.py b/src/pretix/control/forms/organizer.py index 304626f46..879af6091 100644 --- a/src/pretix/control/forms/organizer.py +++ b/src/pretix/control/forms/organizer.py @@ -323,7 +323,7 @@ class OrganizerSettingsForm(SettingsForm): ext_whitelist=(".ico", ".png", ".jpg", ".gif", ".jpeg"), required=False, help_text=_('If you provide a favicon, we will show it instead of the default pretix icon. ' - 'We recommend a size of at least 200x200px to accomodate most devices.') + 'We recommend a size of at least 200x200px to accommodate most devices.') ) giftcard_length = forms.IntegerField( label=_('Length of gift card codes'), diff --git a/src/pretix/control/forms/subevents.py b/src/pretix/control/forms/subevents.py index 7e65d2b13..9edb52baa 100644 --- a/src/pretix/control/forms/subevents.py +++ b/src/pretix/control/forms/subevents.py @@ -254,7 +254,7 @@ class RRuleForm(forms.Form): widget=forms.RadioSelect ) count = forms.IntegerField( - label=_('Number of repititions'), + label=_('Number of repetitions'), initial=10 ) until = forms.DateField( diff --git a/src/pretix/control/logdisplay.py b/src/pretix/control/logdisplay.py index 65d313b1c..72d9a6bb4 100644 --- a/src/pretix/control/logdisplay.py +++ b/src/pretix/control/logdisplay.py @@ -233,7 +233,7 @@ def pretixcontrol_logentry_display(sender: Event, logentry: LogEntry, **kwargs): 'pretix.event.order.email.resend': _('An email with a link to the order detail page has been resent to the user.'), 'pretix.event.order.payment.confirmed': _('Payment {local_id} has been confirmed.'), 'pretix.event.order.payment.canceled': _('Payment {local_id} has been canceled.'), - 'pretix.event.order.payment.canceled.failed': _('Cancelling payment {local_id} has failed.'), + 'pretix.event.order.payment.canceled.failed': _('Canceling payment {local_id} has failed.'), 'pretix.event.order.payment.started': _('Payment {local_id} has been started.'), 'pretix.event.order.payment.failed': _('Payment {local_id} has failed.'), 'pretix.event.order.quotaexceeded': _('The order could not be marked as paid: {message}'), diff --git a/src/pretix/control/templates/pretixcontrol/event/dangerzone.html b/src/pretix/control/templates/pretixcontrol/event/dangerzone.html index 4668f87e8..24d7a3259 100644 --- a/src/pretix/control/templates/pretixcontrol/event/dangerzone.html +++ b/src/pretix/control/templates/pretixcontrol/event/dangerzone.html @@ -58,7 +58,7 @@
{% blocktrans trimmed %} You can remove personal data such as names and email addresses from your event and only retain the - finanical information such as the number and type of ticekts sold. + financial information such as the number and type of tickets sold. {% endblocktrans %}
diff --git a/src/pretix/control/templates/pretixcontrol/event/live.html b/src/pretix/control/templates/pretixcontrol/event/live.html index ff84b2dcb..5d5c53a18 100644 --- a/src/pretix/control/templates/pretixcontrol/event/live.html +++ b/src/pretix/control/templates/pretixcontrol/event/live.html @@ -68,7 +68,7 @@ {% csrf_token %}

- {% trans "Your shop is currently in test mode. All orders are not persistant and can be deleted at any point." %} + {% trans "Your shop is currently in test mode. All orders are not persistent and can be deleted at any point." %}

-
+