Skip to content

Commit

Permalink
More closely mirror tox workflow for morango integration tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
rtibbles committed Jul 3, 2024
1 parent fd6f95d commit 530ab00
Showing 1 changed file with 34 additions and 44 deletions.
78 changes: 34 additions & 44 deletions .github/workflows/morango_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ubuntu-20.04
env:
INTEGRATION_TESTS: 'true'
INTEGRATION_TEST: 'true'
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9, '3.10', '3.11']
Expand All @@ -41,27 +41,17 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Cache SQLite3
id: cache
- name: Install tox
run: |
python -m pip install --upgrade pip
pip install "tox<4"
- name: tox env cache
uses: actions/cache@v4
with:
path: |
~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements/test.txt', 'requirements/base.txt', 'requirements/cext.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
pip install -r requirements/test.txt --upgrade
pip install -r requirements/base.txt --upgrade
pip install -r requirements/cext.txt --upgrade
- name: Run pre-test script
run: python test/patch_pytest.py

- name: Run tests with SQLite
run: python -O -m pytest kolibri/core/auth/test/test_morango_integration.py
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:
Expand All @@ -70,44 +60,44 @@ jobs:
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ubuntu-latest
env:
INTEGRATION_TESTS: 'true'
INTEGRATION_TEST: 'true'

services:
# Label used to access the service container
postgres:
image: postgres:latest
# 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
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

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

- name: Set up Python
- name: Set up Python 3.9 for Postgres
uses: actions/setup-python@v5
with:
python-version: '3.9'

- name: Install dependencies
python-version: 3.9
- name: Install tox
run: |
pip install -r requirements/test.txt --upgrade
pip install -r requirements/base.txt --upgrade
pip install -r requirements/cext.txt --upgrade
pip install -r requirements/postgres.txt --upgrade
- name: Run pre-test script
run: python test/patch_pytest.py

- name: Run tests with PostgreSQL
env:
KOLIBRI_DATABASE_ENGINE: postgres
KOLIBRI_DATABASE_NAME: test
KOLIBRI_DATABASE_USER: postgres
KOLIBRI_DATABASE_PASSWORD: postgres
KOLIBRI_DATABASE_HOST: localhost
KOLIBRI_DATABASE_PORT: 5432
run: python -O -m pytest kolibri/core/auth/test/test_morango_integration.py
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

0 comments on commit 530ab00

Please sign in to comment.