Skip to content

Wrap inline runs in text entry prompts so images and small text save #8146

Wrap inline runs in text entry prompts so images and small text save

Wrap inline runs in text entry prompts so images and small text save #8146

Workflow file for this run

name: Python tests
on:
push:
branches:
- unstable
- hotfixes
- master
pull_request:
permissions:
contents: read
jobs:
pre_job:
name: Path match check
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
# Map a step output to a job output
outputs:
python: ${{ steps.filter.outputs.python }}
steps:
# paths-filter needs a checkout to diff push events
- uses: actions/checkout@v7
- id: filter
uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3
with:
filters: |
python:
- '**.py'
- 'requirements.txt'
- 'requirements-dev.txt'
- '.github/workflows/pythontest.yml'
- 'webpack.config.js'
- 'webpackDevServerAddress.js'
unit_test:
name: Python unit tests
needs: pre_job
if: ${{ needs.pre_job.outputs.python == 'true' }}
runs-on: ubuntu-latest
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres:16
# Provide the password for postgres
env:
POSTGRES_USER: learningequality
POSTGRES_PASSWORD: kolibri
POSTGRES_DB: kolibri-studio
# 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
# Label used to access the service container
redis:
# Docker Hub image
image: redis:6.0.9
# Set health checks to wait until redis has started
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps port 6379 on service container to the host
- 6379:6379
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Use Node.js
# Binary only: the module under test is dependency-free, so no pnpm install.
uses: actions/setup-node@v7
with:
node-version: '20.x'
- name: Set up minio
run: |
docker run -d -p 9000:9000 --name minio \
-e "MINIO_ROOT_USER=development" \
-e "MINIO_ROOT_PASSWORD=development" \
-e "MINIO_DEFAULT_BUCKETS=content:public" \
bitnamilegacy/minio:2024.5.28
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
python-version: '3.10'
activate-environment: "true"
enable-cache: "true"
- name: Install python dependencies with uv
run: |
# Use uv to install dependencies directly from requirements files
uv pip sync requirements.txt requirements-dev.txt
- name: Lint new migrations for unsafe operations
if: github.event_name == 'pull_request'
env:
BASE_REF: ${{ github.base_ref }}
DJANGO_SETTINGS_MODULE: contentcuration.not_production_settings
run: |
set -euo pipefail
git fetch --no-tags origin "$BASE_REF"
base="$(git merge-base "origin/$BASE_REF" HEAD)"
test -n "$base"
python contentcuration/manage.py lintmigrations --git-commit-id "$base" --no-cache --warnings-as-errors
- name: Test pytest
run: |
sh -c './contentcuration/manage.py makemigrations --check'
pytest