spatial-d4science/.github/workflows/ci.yml

114 lines
4.2 KiB
YAML
Raw Normal View History

2021-01-06 06:37:38 +01:00
name: ckanext-spatial ci
on: [push, pull_request]
jobs:
2021-01-15 06:01:12 +01:00
lint:
2021-01-06 06:37:38 +01:00
runs-on: ubuntu-latest
2021-01-15 06:01:12 +01:00
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.6'
- name: Install requirements
run: pip install flake8 pycodestyle
- name: Check syntax
run: flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics --exclude ckan
test:
needs: lint
strategy:
matrix:
ckan-version: [2.9, 2.9-py2, 2.8, 2.7]
fail-fast: false
name: CKAN ${{ matrix.ckan-version }}
runs-on: ubuntu-latest
container:
image: openknowledge/ckan-dev:${{ matrix.ckan-version }}
2021-01-06 06:37:38 +01:00
services:
2021-01-15 06:01:12 +01:00
solr:
image: ckan/ckan-solr-dev:${{ matrix.ckan-version }}
postgres:
2021-01-06 12:04:33 +01:00
image: postgis/postgis:12-2.5
2021-01-06 06:37:38 +01:00
env:
2021-01-15 06:01:12 +01:00
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
redis:
2021-01-06 06:37:38 +01:00
image: redis:3
2021-01-15 06:01:12 +01:00
env:
CKAN_SQLALCHEMY_URL: postgresql://ckan_default:pass@postgres/ckan_test
CKAN_DATASTORE_WRITE_URL: postgresql://datastore_write:pass@postgres/datastore_test
CKAN_DATASTORE_READ_URL: postgresql://datastore_read:pass@postgres/datastore_test
CKAN_SOLR_URL: http://solr:8983/solr/ckan
CKAN_REDIS_URL: redis://redis:6379/1
PGPASSWORD: postgres
2021-01-06 06:37:38 +01:00
steps:
2021-01-15 06:01:12 +01:00
- uses: actions/checkout@v2
- name: Create Database
run: |
2021-01-15 07:48:48 +01:00
psql --host=postgres --username=postgres --command="CREATE USER ckan_default WITH PASSWORD 'pass' NOSUPERUSER NOCREATEDB NOCREATEROLE;"
createdb --encoding=utf-8 --host=postgres --username=postgres --owner=ckan_default ckan_test
2021-01-15 06:20:08 +01:00
psql --host=postgres --username=postgres --command="CREATE USER datastore_write WITH PASSWORD 'pass' NOSUPERUSER NOCREATEDB NOCREATEROLE;"
psql --host=postgres --username=postgres --command="CREATE USER datastore_read WITH PASSWORD 'pass' NOSUPERUSER NOCREATEDB NOCREATEROLE;"
createdb --encoding=utf-8 --host=postgres --username=postgres --owner=datastore_write datastore_test
2021-01-15 06:01:12 +01:00
- name: Install harvester
run: |
git clone https://github.com/ckan/ckanext-harvest
cd ckanext-harvest
pip install -r pip-requirements.txt
2021-01-15 06:33:28 +01:00
pip install -r dev-requirements.txt
pip install -e .
2021-01-15 07:21:55 +01:00
- name: Install dependency (common)
2021-01-15 06:44:45 +01:00
run: |
2021-01-15 07:09:23 +01:00
apk add --no-cache \
geos \
2021-01-15 07:42:29 +01:00
geos-dev \
2021-01-15 07:09:23 +01:00
proj-util \
2021-01-15 07:42:29 +01:00
proj-dev \
2021-01-15 07:09:23 +01:00
libxml2 \
2021-01-15 07:38:13 +01:00
libxslt \
2021-01-15 07:09:23 +01:00
gcc \
libxml2-dev \
libxslt-dev
2021-01-15 07:21:55 +01:00
- name: Install dependency (python2)
if: ${{ matrix.ckan-version != '2.9' }}
run: |
2021-01-15 07:38:13 +01:00
apk add --no-cache \
2021-01-15 07:31:53 +01:00
python2-dev
2021-01-15 07:21:55 +01:00
- name: Install dependency (python3)
if: ${{ matrix.ckan-version == '2.9' }}
2021-01-15 07:21:55 +01:00
run: |
2021-01-15 07:38:13 +01:00
apk add --no-cache \
2021-01-15 07:21:55 +01:00
python3-dev
- name: Install requirements (python2)
if: ${{ matrix.ckan-version != '2.9' }}
2021-01-15 06:01:12 +01:00
run: |
pip install -r pip-requirements.txt
- name: Install requirements (python3)
if: ${{ matrix.ckan-version == '2.9' }}
run: |
pip install -r pip3-requirements.txt
- name: Install requirements
run: |
2021-01-15 06:01:12 +01:00
pip install -e .
# Replace default path to CKAN core config file with the one on the container
sed -i -e 's/use = config:.*/use = config:\/srv\/app\/src\/ckan\/test-core.ini/' test.ini
- name: Setup extension (CKAN >= 2.9)
if: ${{ matrix.ckan-version != '2.7' && matrix.ckan-version != '2.8' }}
run: |
ckan -c test.ini db init
ckan -c test.ini harvester initdb
2021-01-15 07:52:32 +01:00
ckan -c test.ini spatial initdb
2021-01-15 06:01:12 +01:00
- name: Setup extension (CKAN < 2.9)
if: ${{ matrix.ckan-version == '2.7' || matrix.ckan-version == '2.8' }}
run: |
paster --plugin=ckan db init -c test.ini
paster --plugin=ckanext-harvest harvester initdb -c test.ini
paster --plugin=ckanext-spatial spatial initdb -c test.ini
- name: Run tests
run: pytest --ckan-ini=test.ini --cov=ckanext.harvest --disable-warnings ckanext/spatial/tests
2021-01-06 06:37:38 +01:00