Skip to content

Commit

Permalink
Merge pull request #12408 from rtibbles/morango_081
Browse files Browse the repository at this point in the history
Upgrade morango.
  • Loading branch information
rtibbles authored Jul 4, 2024
2 parents 6f2dca9 + 415649b commit a1767ba
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 96 deletions.
103 changes: 103 additions & 0 deletions .github/workflows/morango_integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: Morango Integration Tests

on:
schedule:
- cron: '0 0 * * 0'
pull_request:
branches:
- develop
- release-*

jobs:
pre_job:
name: Path match check
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@master
with:
github_token: ${{ github.token }}
paths: '["requirements/base.txt", ".github/workflows/morango_integration.yml"]'
morango_integration_tests_sqlite:
name: Morango Integration Tests
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ubuntu-20.04
env:
INTEGRATION_TEST: 'true'
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9, '3.10', '3.11']

steps:
- name: Checkout repository
uses: actions/checkout@v4

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

- name: Install tox
run: |
python -m pip install --upgrade pip
pip install "tox<4"
- name: tox env cache
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/.tox/py${{ matrix.python-version }}
key: ${{ runner.os }}-tox-py${{ matrix.python-version }}-${{ hashFiles('requirements/*.txt') }}
- name: Test with tox
run: tox -e py${{ matrix.python-version }} -- kolibri/core/auth/test/test_morango_integration.py


morango_integration_tests_postgres:
name: Morango Integration Tests with PostgreSQL
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ubuntu-latest
env:
INTEGRATION_TEST: 'true'

services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres:12
# Provide the password for postgres
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: test
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python 3.9 for Postgres
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Install tox
run: |
python -m pip install --upgrade pip
pip install "tox<4"
- name: tox env cache
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/.tox/py3.9
key: ${{ runner.os }}-tox-py3.9-${{ hashFiles('requirements/*.txt') }}
- name: Test with tox
run: tox -e postgres -- kolibri/core/auth/test/test_morango_integration.py
90 changes: 0 additions & 90 deletions .github/workflows/morongo_integration.yml

This file was deleted.

1 change: 1 addition & 0 deletions kolibri/core/device/management/commands/devicesettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"boolean": bool,
"string": str,
"integer": int,
"array": list,
}
DJANGO_FIELD_TYPES = {
"BooleanField": bool,
Expand Down
2 changes: 1 addition & 1 deletion requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ cheroot==8.6.0
magicbus==4.1.2
le-utils==0.2.2
jsonfield==3.1.0
morango==0.8.0
morango==0.8.1
tzlocal==2.1
pytz==2022.1
python-dateutil==2.8.2
Expand Down
13 changes: 8 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ allowlist_externals=
rm
make
sh
passenv = INTEGRATION_TEST
setenv =
KOLIBRI_HOME = {envtmpdir}/.kolibri
DJANGO_SETTINGS_MODULE = kolibri.deployment.default.settings.test
Expand All @@ -27,13 +28,15 @@ commands =
sh -c 'kolibri manage makemigrations --check'
python test/patch_pytest.py
# Run the actual tests
python -O -m pytest {posargs:--cov=kolibri --cov-report= --cov-append --color=no} kolibri
python -O -m pytest {posargs:--cov=kolibri --cov-report= --cov-append --color=no} -p no:django test
python -O -m pytest {posargs:kolibri --cov=kolibri --cov-report= --cov-append --color=no}
python -O -m pytest --cov=kolibri --cov-report= --cov-append --color=no -p no:django test
# Fail if the log is longer than 200 lines (something erroring or very noisy got added)
sh -c "if [ `cat {env:KOLIBRI_HOME}/logs/kolibri.txt | wc -l` -gt 200 ] ; then echo 'Log too long' && echo '' && tail -n 20 {env:KOLIBRI_HOME}/logs/kolibri.txt && exit 1 ; fi"

[testenv:postgres]
passenv = TOX_ENV
passenv =
TOX_ENV
INTEGRATION_TEST
setenv =
PYTHONPATH = {toxinidir}
KOLIBRI_HOME = {envtmpdir}/.kolibri
Expand All @@ -52,5 +55,5 @@ deps =
-r{toxinidir}/requirements/cext.txt
-r{toxinidir}/requirements/postgres.txt
commands =
python -O -m pytest {posargs:--cov=kolibri --cov-report= --cov-append --color=no} kolibri
python -O -m pytest {posargs:--cov=kolibri --cov-report= --cov-append --color=no} -p no:django test
python -O -m pytest {posargs:kolibri --cov=kolibri --cov-report= --cov-append --color=no}
python -O -m pytest --cov=kolibri --cov-report= --cov-append --color=no -p no:django test

0 comments on commit a1767ba

Please sign in to comment.