Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 23 additions & 32 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,36 @@
name: Tests
on: [pull_request]
on: [push, pull_request]
jobs:
lint:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [ 2.7, 3.9 ]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
python-version: "3.10"
- name: Install requirements
run: pip install flake8 pycodestyle
- name: Check syntax
run: |
flake8 . --count --max-line-length=127 --show-source --statistics
run: flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics --exclude ckan,.venv,*.egg-info

test:
name: CKAN
runs-on: ubuntu-latest
needs: lint
strategy:
fail-fast: false
matrix:
include:
- ckan-container-version: "2.9-py2"
ckan-postgres-version: "2.9"
ckan-solr-version: "2.9-solr8"
- ckan-container-version: "2.9"
ckan-postgres-version: "2.9"
ckan-solr-version: "2.9-solr8"
- ckan-container-version: "2.10"
ckan-postgres-version: "2.10"
ckan-solr-version: "2.10"
ckan-version: ["2.10", "2.11"]
python-version: ["3.10"]
fail-fast: false

name: CKAN ${{ matrix.ckan-version }} Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
container:
image: openknowledge/ckan-dev:${{ matrix.ckan-container-version }}
image: ckan/ckan-dev:${{ matrix.ckan-version }}
options: --user root
services:
solr:
image: ckan/ckan-solr:${{ matrix.ckan-solr-version }}
image: ckan/ckan-solr:${{ matrix.ckan-version }}-solr9
postgres:
image: ckan/ckan-postgres-dev:${{ matrix.ckan-postgres-version }}
image: ckan/ckan-postgres-dev:${{ matrix.ckan-version }}
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
Expand All @@ -57,17 +46,19 @@ jobs:
CKAN_REDIS_URL: redis://redis:6379/1

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Install requirements
run: |
pip install -r requirements.txt
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
sed -i -e 's/use = config:.*/use = config:\/srv\/app\/src\/ckan\/test-core.ini/' test_subclass.ini
- name: Setup extension
run: |
pip install -r test-requirements.txt
ckan -c test.ini db init
- name: Run tests
run: pytest --ckan-ini=test.ini --cov=ckanext.scheming --disable-warnings ckanext/scheming/tests

- name: Run all tests
run: pytest --ckan-ini=test.ini --cov=ckanext.scheming ckanext/scheming/tests/ -v
# Temporarily disabled to focus on UNAIDS validator test
# - name: Run plugin subclassing tests
# run: pytest --ckan-ini=test_subclass.ini ckanext/scheming/tests/test_dataset_display.py ckanext/scheming/tests/test_form.py::TestDatasetFormNew ckanext/scheming/tests/test_dataset_logic.py
Loading