|
| 1 | +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions |
| 2 | + |
| 3 | +name: openapi |
| 4 | + |
| 5 | +on: workflow_call |
| 6 | +jobs: |
| 7 | + build: |
| 8 | + runs-on: ubuntu-24.04 |
| 9 | + env: |
| 10 | + DATABASE_URL: postgis://kobo:kobo@localhost:5432/kpi_test |
| 11 | + DJANGO_LANGUAGE_CODES: "ar cs de-DE en es fr hi ku pl pt tr zh-hans" |
| 12 | + DJANGO_SECRET_KEY: notSecretJustForTestingYep |
| 13 | + DJANGO_SETTINGS_MODULE: kobo.settings.testing |
| 14 | + REDIS_SESSION_URL: redis://localhost:6379/2 |
| 15 | + CACHE_URL: redis://localhost:6379/3 |
| 16 | + ENKETO_REDIS_MAIN_URL: redis://localhost:6379/0 |
| 17 | + CELERY_BROKER_URL: redis://localhost:6379/1 |
| 18 | + KOBOCAT_MEDIA_ROOT: /tmp/test_media |
| 19 | + KOBOCAT_URL: http://kobocat |
| 20 | + KOBOCAT_INTERNAL_URL: http://kobocat |
| 21 | + KOBOFORM_URL: http://kpi |
| 22 | + SKIP_TESTS_WITH_CONCURRENCY: 'True' |
| 23 | + KPI_SRC_DIR: '.' |
| 24 | + strategy: |
| 25 | + matrix: |
| 26 | + python-version: ['3.10'] |
| 27 | + services: |
| 28 | + postgres: |
| 29 | + image: postgis/postgis:14-3.4 |
| 30 | + env: |
| 31 | + POSTGRES_USER: kobo |
| 32 | + POSTGRES_PASSWORD: kobo |
| 33 | + POSTGRES_DB: kpi_test |
| 34 | + ports: |
| 35 | + - 5432:5432 |
| 36 | + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 |
| 37 | + redis_cache: |
| 38 | + image: redis:6.2 |
| 39 | + ports: |
| 40 | + - 6379:6379 |
| 41 | + steps: |
| 42 | + |
| 43 | + - uses: actions/checkout@v4 |
| 44 | + |
| 45 | + - name: Set up Python ${{ matrix.python-version }} |
| 46 | + uses: actions/setup-python@v5 |
| 47 | + with: |
| 48 | + python-version: ${{ matrix.python-version }} |
| 49 | + |
| 50 | + - name: Install pip-tools |
| 51 | + run: python -m pip install pip-tools==7.\* |
| 52 | + |
| 53 | + - name: Update Debian package lists |
| 54 | + run: sudo DEBIAN_FRONTEND=noninteractive apt-get -y update |
| 55 | + |
| 56 | + - name: Install Debian dependencies |
| 57 | + # All about YAML line breaks: https://stackoverflow.com/a/21699210 |
| 58 | + run: >- |
| 59 | + sudo DEBIAN_FRONTEND=noninteractive apt-get -y install |
| 60 | + gdal-bin gettext libproj-dev postgresql-client ffmpeg |
| 61 | + gcc libc-dev build-essential |
| 62 | +
|
| 63 | + - name: Install Python dependencies |
| 64 | + run: pip-sync dependencies/pip/dev_requirements.txt |
| 65 | + |
| 66 | + - name: Generate OpenAPI |
| 67 | + run: ./scripts/generate_openapi_schemas.sh |
| 68 | + |
| 69 | + - name: Fail on uncommitted OpenAPI changes |
| 70 | + run: | |
| 71 | + git diff |
| 72 | + git diff-index --exit-code HEAD |
0 commit comments