Skip to content

Merge pull request #48 from unicef/bugfix/328327-Solve-issues-with-lo… #154

Merge pull request #48 from unicef/bugfix/328327-Solve-issues-with-lo…

Merge pull request #48 from unicef/bugfix/328327-Solve-issues-with-lo… #154

Workflow file for this run

name: Test
on:
workflow_dispatch:
push:
branches: [ "develop" ]
tags-ignore: [ "**" ]
pull_request:
jobs:
changes:
runs-on: ubuntu-latest
timeout-minutes: 1
defaults:
run:
shell: bash
outputs:
run_tests: ${{ steps.changes.outputs.run_tests }}
steps:
- name: Checkout code
uses: actions/checkout@v6
- id: changes
name: Check for file changes
uses: dorny/paths-filter@v4
with:
base: ${{ github.ref }}
token: ${{ github.token }}
filters: .github/file-filters.yml
test:
needs: [ changes ]
if: github.event_name == 'workflow_dispatch' || needs.changes.outputs.run_tests == 'true'
runs-on: ubuntu-latest
services:
db:
image: postgres:15
env:
POSTGRES_DB: country_workspace
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
options: >-
--health-cmd="pg_isready -U postgres"
--health-interval=10s
--health-timeout=5s
--health-retries=5
redis:
image: redis:7
ports:
- 6379:6379
rabbitmq:
image: rabbitmq:3-management
ports:
- 5672:5672
env:
DOCKER_DEFAULT_PLATFORM: linux/amd64
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index
DATABASE_URL: postgres://postgres:postgres@localhost:5432/country_workspace
CELERY_BROKER_URL: redis://redis:6379/1
CACHE_URL: redis://redis:6379/2
DOCKER_BUILDKIT: 1
STREAMING_BROKER_URL: "rabbit://guest:guest@localhost:5672?exchange=hope_portal"
strategy:
fail-fast: false
matrix:
cfg: [ "tests" ]
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Install GDAL
run: |
sudo apt-get update -y
sudo apt-get install -y gdal-bin libgdal-dev
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v6
with:
version: "latest"
enable-cache: true
cache-dependency-glob: |
pyproject.toml
uv.lock
cache-suffix: ${{ matrix.cfg }}
github-token: ${{ secrets.GITHUB_TOKEN }}
python-version: ${{ matrix.python }}
- name: Install tox
run: uv tool install --python-preference only-managed --python 3.14 tox --with tox-uv --with tox-gh-actions
- name: Setup test suite
run: tox run -vv --notest --skip-missing-interpreters false -e tests
- name: Run test suite tests
run: tox -e tests
- name: Archive selenium results
uses: actions/upload-artifact@v7
if: failure()
with:
name: selenium-log-report
path: latest_logs
retention-days: 5
- name: Upload pytest test results
uses: actions/upload-artifact@v7
with:
name: pytest-results-tests
path: junit.xml
if: ${{ always() }}
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v6
continue-on-error: true
with:
env_vars: OS,PYTHON
fail_ci_if_error: true
flags: unittests
files: ./coverage.xml
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}
name: codecov-${{env.GITHUB_REF_NAME}}
slug: ${{ github.repository }}