f6a055e8e1
* Update tinydb manager test to current api * Add tinydb parallel tests to CI * Use filelock library to help make tinydb threadsafe The tests for parallel access sometimes failed with the previous implementation. I'm currently not 100% sure why, but it might have to do with the fact that the file is already created in the TinyDB constructor which was not protected by a lock. Also not protecting the reads can read to invalid reads in the case when a read and a write happen simultaneously and the read catches partially written data. This implementation allows for fewer concurrency but is quite simple, so we should be able to be confident about its safety. Also the TinyDB manager is not intended for high performance and its IO operations are orders of magnitude faster than requests over the network or process executions anyway.
145 lines
5.1 KiB
YAML
145 lines
5.1 KiB
YAML
name: Build
|
|
|
|
on:
|
|
push:
|
|
paths-ignore:
|
|
- '**.md'
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
paths-ignore:
|
|
- '!**.md'
|
|
release:
|
|
types:
|
|
- released
|
|
|
|
jobs:
|
|
flake8_py3:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Setup Python
|
|
uses: actions/setup-python@v1
|
|
with:
|
|
python-version: 3.7
|
|
architecture: x64
|
|
- name: Checkout pygeoapi
|
|
uses: actions/checkout@master
|
|
- name: Install flake8
|
|
run: pip install flake8
|
|
- name: Run flake8
|
|
uses: suo/flake8-github-action@releases/v1
|
|
with:
|
|
checkName: 'flake8_py3' # NOTE: this needs to be the same as the job name
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
main:
|
|
needs: [flake8_py3]
|
|
runs-on: ubuntu-20.04
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- python-version: 3.7
|
|
env:
|
|
PYGEOAPI_CONFIG: "$(pwd)/pygeoapi-config.yml"
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: actions/setup-python@v2
|
|
name: Setup Python ${{ matrix.python-version }}
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
- name: Configure sysctl limits
|
|
run: |
|
|
sudo swapoff -a
|
|
sudo sysctl -w vm.swappiness=1
|
|
sudo sysctl -w fs.file-max=262144
|
|
sudo sysctl -w vm.max_map_count=262144
|
|
- name: Install and run PostgreSQL/PostGIS 📦
|
|
uses: huaxk/postgis-action@v1
|
|
with:
|
|
postgresql password: ${{ secrets.DatabasePassword || 'postgres' }}
|
|
postgresql db: 'test'
|
|
- name: Install and run Elasticsearch 📦
|
|
uses: getong/elasticsearch-action@v1.2
|
|
with:
|
|
elasticsearch version: '8.3.1'
|
|
host port: 9200
|
|
container port: 9200
|
|
host node port: 9300
|
|
node port: 9300
|
|
discovery type: 'single-node'
|
|
- name: Install and run MongoDB
|
|
uses: supercharge/mongodb-github-action@1.5.0
|
|
with:
|
|
mongodb-version: 4.4
|
|
- name: Install and run SensorThingsAPI
|
|
uses: cgs-earth/sensorthings-action@v0.0.2
|
|
- name: Install sqlite and gpkg dependencies
|
|
uses: awalsh128/cache-apt-pkgs-action@latest
|
|
with:
|
|
packages: libsqlite3-mod-spatialite
|
|
version: 4.3.0a-6build1
|
|
- name: Install GDAL with Python bindings
|
|
uses: awalsh128/cache-apt-pkgs-action@latest
|
|
with:
|
|
packages: gdal-bin libgdal-dev
|
|
version: 3.0.4
|
|
- name: Install requirements 📦
|
|
run: |
|
|
pip3 install -r requirements.txt
|
|
pip3 install -r requirements-starlette.txt
|
|
pip3 install -r requirements-dev.txt
|
|
pip3 install -r requirements-provider.txt
|
|
pip3 install -r docs/requirements.txt
|
|
python3 setup.py install
|
|
pip3 install --upgrade numpy elasticsearch
|
|
pip3 install --upgrade numpy "sqlalchemy<2"
|
|
pip3 install --upgrade flake8
|
|
pip3 install --global-option=build_ext --global-option="-I/usr/include/gdal" GDAL==`gdal-config --version`
|
|
#pip3 install --upgrade rasterio==1.1.8
|
|
- name: setup test data ⚙️
|
|
run: |
|
|
python3 tests/load_es_data.py tests/data/ne_110m_populated_places_simple.geojson geonameid
|
|
python3 tests/load_es_data.py tests/cite/ogcapi-features/canada-hydat-daily-mean-02HC003.geojson IDENTIFIER
|
|
python3 tests/load_mongo_data.py tests/data/ne_110m_populated_places_simple.geojson
|
|
gunzip < tests/data/hotosm_bdi_waterways.sql.gz | psql postgresql://postgres:${{ secrets.DatabasePassword || 'postgres' }}@localhost:5432/test
|
|
psql postgresql://postgres:${{ secrets.DatabasePassword || 'postgres' }}@localhost:5432/test -f tests/data/dummy_data.sql
|
|
- name: run unit tests ⚙️
|
|
env:
|
|
POSTGRESQL_PASSWORD: ${{ secrets.DatabasePassword || 'postgres' }}
|
|
run: |
|
|
pytest tests/test_api.py
|
|
pytest tests/test_api_ogr_provider.py
|
|
pytest tests/test_config.py
|
|
pytest tests/test_csv__formatter.py
|
|
pytest tests/test_csv__provider.py
|
|
pytest tests/test_elasticsearch__provider.py
|
|
pytest tests/test_esri_provider.py
|
|
pytest tests/test_filesystem_provider.py
|
|
pytest tests/test_geojson_provider.py
|
|
pytest tests/test_mongo_provider.py
|
|
pytest tests/test_ogr_csv_provider.py
|
|
pytest tests/test_ogr_esrijson_provider.py
|
|
pytest tests/test_ogr_gpkg_provider.py
|
|
pytest tests/test_ogr_shapefile_provider.py
|
|
pytest tests/test_ogr_sqlite_provider.py
|
|
pytest tests/test_ogr_wfs_provider.py
|
|
pytest tests/test_openapi.py
|
|
pytest tests/test_postgresql_provider.py
|
|
pytest tests/test_rasterio_provider.py
|
|
pytest tests/test_sensorthings_provider.py
|
|
pytest tests/test_socrata_provider.py
|
|
pytest tests/test_sqlite_geopackage_provider.py
|
|
pytest tests/test_tinydb_catalogue_provider.py
|
|
pytest tests/test_tinydb_manager_for_parallel_requests.py
|
|
pytest tests/test_util.py
|
|
pytest tests/test_xarray_netcdf_provider.py
|
|
pytest tests/test_xarray_zarr_provider.py
|
|
- name: build docs 🏗️
|
|
run: cd docs && make html
|
|
- name: failed tests 🚩
|
|
if: ${{ failure() }}
|
|
run: |
|
|
pip3 list -v
|