Skip to content

Merge branch 'main' into ci_tests #23

Merge branch 'main' into ci_tests

Merge branch 'main' into ci_tests #23

name: Tests for Mergin Maps Media Sync
on:
push:
paths:
- "test/**"
- "**.py"
- ".github/workflows/tests_mergin_media_sync.yaml"
env:
TEST_MERGIN_URL: https://test.dev.merginmaps.com
TEST_API_USERNAME: test_media_sync
TEST_API_PASSWORD: ${{ secrets.TEST_API_PASSWORD }}
TEST_API_WORKSPACE: test-media-sync
TEST_MINIO_URL: 127.0.0.1:9000
TEST_MINIO_ACCESS_KEY: minioaccesskey
TEST_MINIO_SECRET_KEY: miniosecretkey
jobs:
Tests-for-Mergin-Maps-Media-Sync:
runs-on: ubuntu-latest
steps:
- name: Install Spatialite
run: sudo apt-get install -y libsqlite3-mod-spatialite
- name: Checkout
uses: actions/checkout@v4
- name: Install Python dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install pipenv
pipenv install
pipenv install --dev
- name: Run MinIO Docker
run: |
docker run -d \
-p 127.0.0.1:9000:9000 \
-p 127.0.0.1:9001:9001 \
-e MINIO_ROOT_USER=$TEST_MINIO_ACCESS_KEY \
-e MINIO_ROOT_PASSWORD=$TEST_MINIO_SECRET_KEY \
--entrypoint /bin/bash \
minio/minio:latest -c "minio server /data --console-address :9001 --address :9000"
- name: Test MinIO and Mergin Client
shell: pipenv run python {0}
run: |
import os
from minio import Minio
from mergin import MerginClient
client = Minio(
endpoint="127.0.0.1:9000",
access_key=os.environ.get('TEST_MINIO_ACCESS_KEY'),
secret_key=os.environ.get('TEST_MINIO_SECRET_KEY'),
secure=False,
)
mc = MerginClient(os.environ.get('TEST_MERGIN_URL'),
login=os.environ.get('TEST_API_USERNAME'),
password=os.environ.get('TEST_API_PASSWORD'))
- name: Run tests
run: |
pipenv run pytest test --cov=. --cov-report=term-missing:skip-covered -vv