Skip to content

Open code (#5)

Open code (#5) #72

Workflow file for this run

name: Tests
on:
push:
branches:
- '**'
jobs:
test:
# needs: lint
strategy:
matrix:
ckan-base-version: [2.9]
ckan-version: [py3.9]
solr-version: [solr8]
fail-fast: false
name: CKAN ${{ matrix.ckan-base-version }}
runs-on: ubuntu-latest
container:
image: ckan/ckan-dev:${{ matrix.ckan-base-version }}-${{ matrix.ckan-version }}
options: --user root
services:
solr:
image: ckan/ckan-solr:${{ matrix.ckan-base-version }}-${{ matrix.solr-version }}
postgres:
image: postgis/postgis:10-3.1
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
redis:
image: redis:3
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
steps:
- uses: actions/checkout@v2
- name: Install CURL
run: apt install curl -y
- name: Install psql
run: apt install postgresql-client -y
- name: Create Database
run: |
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
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
- name: Install ckanext-harvest
run: |
git clone --branch v1.4.2 https://github.com/ckan/ckanext-harvest
cd ckanext-harvest
pip install -r pip-requirements.txt
pip install -r dev-requirements.txt
pip install -e .
- name: Install ckanext-spatial dependencies
run: |
apk add --no-cache \
geos \
geos-dev \
proj-util \
proj-dev \
libxml2 \
libxslt \
gcc \
libxml2-dev \
libxslt-dev
- name: Patch to test pyproj
if: ${{ matrix.ckan-version == '2.9' }}
run: |
pip install cython==0.29.36
pip install --no-use-pep517 pyproj==2.6.1
- name: Install ckanext-spatial
run: |
git clone https://github.com/ckan/ckanext-spatial
cd ckanext-spatial
git checkout tags/v2.1.1
pip install -e .
pip install -r requirements.txt
- name: Install own requirements
run: |
pip install -r dev-requirements.txt
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)
run: |
ckan -c test.ini db init
- name: Run tests
run: pytest --ckan-ini=test.ini --cov=ckanext.fisbroker --cov-report=xml --cov-append --disable-warnings ckanext/fisbroker/tests
- name: Upload coverage reports to Codecov
run: |
curl -Os https://uploader.codecov.io/latest/linux/codecov
chmod +x codecov
./codecov