migrate to GitHub Actions (#616) (#703)

This commit is contained in:
Tom Kralidis
2021-06-01 17:15:30 -04:00
committed by GitHub
parent f2d064656f
commit 46f84a4ed3
5 changed files with 91 additions and 107 deletions
+87
View File
@@ -0,0 +1,87 @@
name: build ⚙️
on: [ push, pull_request ]
jobs:
main:
runs-on: ubuntu-20.04
strategy:
matrix:
include:
- python-version: 3.6
- 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 }}
postgresql db: 'test'
- name: Install and run Elasticsearch 📦
uses: getong/elasticsearch-action@v1.2
with:
elasticsearch version: '7.6.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 requirements 📦
run: |
pip3 install -r requirements.txt
pip3 install -r requirements-dev.txt
pip3 install -r requirements-provider.txt
python3 setup.py install
#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 -U postgres test
- name: run unit tests ⚙️
run: |
pytest tests/test_api.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_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_sqlite_geopackage_provider.py
pytest tests/test_tinydb_catalogue_provider.py
pytest tests/test_util.py
pytest tests/test_xarray_netcdf_provider.py
pytest tests/test_xarray_zarr_provider.py
- name: run flake8 ⚙️
run: find . -type f -name "*.py" | xargs flake8
- name: build docs 🏗️
run: cd docs && make html
-103
View File
@@ -1,103 +0,0 @@
language: python
dist: bionic
sudo: false
env:
global:
- PYGEOAPI_CONFIG="$(pwd)/pygeoapi-config.yml"
- CPLUS_INCLUDE_PATH=/usr/include/gdal
- C_INCLUDE_PATH=/usr/include/gdal
- DEBIAN_FRONTEND=noninteractive
python:
- "3.6"
- "3.7"
services:
- docker
addons:
postgresql: "10"
apt:
sources:
- sourceline: 'ppa:ubuntugis/ubuntugis-unstable'
- sourceline: 'deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 multiverse'
packages:
- gdal-bin
- libgdal-dev
- libsqlite3-mod-spatialite
- python-pyspatialite
- mongodb-org
before_install:
- sudo service postgresql stop
- sudo apt-get remove -yq 'postgresql-*'
- sudo apt autoremove
- sudo rm /etc/apt/sources.list.d/pgdg.list*
- sudo apt-get -qq update
- sudo apt-get install -qq build-essential tzdata python3-dev python3-setuptools python-all python3-all python-setuptools python3-pip
- sudo apt-get install -y devscripts fakeroot debhelper
- sudo apt-get install -y postgresql-10-postgis-3
# install Elasticsearch 7
- curl -s -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.5.1-amd64.deb
- sudo dpkg -i --force-confnew elasticsearch-7.5.1-amd64.deb
- sudo sed -i.old 's/-Xms1g/-Xms128m/' /etc/elasticsearch/jvm.options
- sudo sed -i.old 's/-Xmx1g/-Xmx128m/' /etc/elasticsearch/jvm.options
- echo -e '-XX:+DisableExplicitGC\n-Djdk.io.permissionsUseCanonicalPath=true\n-Dlog4j.skipJansi=true\n-server\n' | sudo tee -a /etc/elasticsearch/jvm.options
- sudo chown -R elasticsearch:elasticsearch /etc/default/elasticsearch
- sudo systemctl start elasticsearch
# start MongoDB
- sudo systemctl enable mongod
- sudo systemctl start mongod
- sudo systemctl status mongod
# start postgresql installed from ubuntugis postgis
- sudo systemctl enable postgresql
- sudo systemctl start postgresql
- sudo systemctl status postgresql
install:
# follow GDAL installed version for Python bindings
- pip3 install GDAL==`gdalinfo --version | cut -d' ' -f2 | cut -d',' -f1`
- pip3 install -r requirements.txt
- pip3 install -r requirements-dev.txt
- pip3 install -r requirements-provider.txt
- python3 setup.py install
- pip3 install --upgrade rasterio==1.1.8
# verify docker build
- docker build --build-arg BUILD_DEV_IMAGE=true -t geopython/pygeoapi:latest .
before_script:
- sleep 20
- python3 tests/load_es_data.py tests/data/ne_110m_populated_places_simple.geojson geonameid
- python3 tests/load_mongo_data.py tests/data/ne_110m_populated_places_simple.geojson
- pygeoapi generate-openapi-document -c pygeoapi-config.yml > pygeoapi-openapi.yml
- psql -U postgres -c 'create database test'
- psql -U postgres -d test -c 'create extension postgis'
- gunzip < tests/data/hotosm_bdi_waterways.sql.gz | psql -U postgres test
# load cite data
- python3 tests/load_es_data.py tests/cite/ogcapi-features/canada-hydat-daily-mean-02HC003.geojson IDENTIFIER
script:
- pytest --cov=pygeoapi
- make -C ./docs html
- find . -type f -name "*.py" | xargs flake8
# run docker image with cite configuration
- docker run -d -p 5001:5001 --network host --add-host="localhost:127.0.0.1" --rm -it -v $(pwd)/tests/cite/ogcapi-features/cite.config.yml:/pygeoapi/local.config.yml --name pygeoapi-travis-master geopython/pygeoapi:latest run
- docker ps | grep -wq 'pygeoapi-travis-master'
- sleep 10
- docker logs pygeoapi-travis-master 2>&1 | grep -wq 'Listening at:'
- docker run --rm --name pygeoapi-travis-runtests-master geopython/pygeoapi:latest test
after_success:
# run linting openapi document through dockerized spectral cli
- docker run --rm -it -v $(pwd):/tmp stoplight/spectral lint "/tmp/pygeoapi-openapi.yml"
- python3 setup.py sdist bdist_wheel --universal
- sudo debuild -b -uc -us
notifications:
irc:
channels:
- "irc.freenode.org#pygeoapi-activity"
use_notice: true
+1 -1
View File
@@ -1,6 +1,6 @@
# pygeoapi
[![Build Status](https://travis-ci.org/geopython/pygeoapi.png)](https://travis-ci.org/geopython/pygeoapi)
[![Build Status](https://github.com/geopython/pygeoapi/workflows/build%20%E2%9A%99%EF%B8%8F/badge.svg)](https://github.com/geopython/pygeoapi/actions)
<a href="https://json-ld.org"><img src="https://json-ld.org/images/json-ld-button-88.png" height="20"/></a>
[pygeoapi](https://pygeoapi.io) is a Python server implementation of the [OGC API](https://ogcapi.ogc.org) suite of standards. The project emerged as part of the next generation OGC API efforts in 2018 and provides the capability for organizations to deploy a RESTful OGC API endpoint using OpenAPI, GeoJSON, and HTML. pygeoapi is [open source](https://opensource.org/) and released under an [MIT license](https://github.com/geopython/pygeoapi/blob/master/LICENSE.md).
+2 -2
View File
@@ -17,7 +17,7 @@ exist in ``/tests`` and are developed for providers, formatters, processes, as w
overall API.
Tests can be run locally as part of development workflow. They are also run on pygeoapis
`Travis setup`_ against all commits and pull requests to the code repository.
`GitHub Actions setup`_ against all commits and pull requests to the code repository.
To run all tests, simply run ``pytest`` in the repository. To run a specific test file,
run ``pytest tests/test_api.py``, for example.
@@ -68,4 +68,4 @@ Set the variable for the Spatialite library under OSX:
SPATIALITE_LIBRARY_PATH=/usr/local/lib/mod_spatialite.dylib
.. _`Travis setup`: https://github.com/geopython/pygeoapi/blob/master/.travis.yml
.. _`GitHub Actions setup`: https://github.com/geopython/pygeoapi/blob/master/.github/workflows/main.yml
+1 -1
View File
@@ -1,6 +1,6 @@
elasticsearch==7.1.0
fiona
GDAL>=3.0.0
#GDAL>=3.0.0
netCDF4
psycopg2-binary==2.8.4
pygeometa