-
Notifications
You must be signed in to change notification settings - Fork 110
99 lines (93 loc) · 3.2 KB
/
ckan-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
---
name: CKAN Testing Template
on: # yamllint disable-line rule:truthy
workflow_call:
inputs:
ext_name:
required: true
type: string
plugins:
required: true
type: string
env:
CODE_COVERAGE_THRESHOLD_REQUIRED: 35
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.8"
- name: Install requirements
run: pip install flake8 pycodestyle
- name: Run flake8
run: flake8 . --count --show-source --statistics --exclude ckan
test:
strategy:
matrix:
ckan-version: ["2.10", "2.10.1"]
include:
- ckan-version: "2.10"
services-version: "2.10"
- ckan-version: "2.10.1"
services-version: "2.10"
fail-fast: false
name: CKAN ${{ matrix.ckan-version }}
runs-on: ubuntu-latest
container:
image: openknowledge/ckan-dev:${{ matrix.ckan-version }}
services:
solr:
image: datagov/catalog.data.gov.solr:latest
db:
image: ckan/ckan-postgres-dev:${{ matrix.services-version }}
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@db/ckan_test
CKAN_DATASTORE_WRITE_URL: postgresql://datastore_write:pass@db/datastore_test
CKAN_DATASTORE_READ_URL: postgresql://datastore_read:pass@db/datastore_test
CKAN_SOLR_URL: http://solr:8983/solr/ckan
CKAN_REDIS_URL: redis://redis:6379/1
CKAN_DATAPUSHER_URL: http://localhost:8080/ # datapusher is not really enabled
CKAN_SITE_ID: default
CKAN_SITE_URL: http://ckan:5000
CKAN_SYSADMIN_NAME: admin
CKAN_SYSADMIN_PASSWORD: password
CKAN_SYSADMIN_EMAIL: [email protected]
CKAN__STORAGE_PATH: /var/lib/ckan
CKAN__PLUGINS: ${{ inputs.plugins }}
PYTHONDONTWRITEBYTECODE: 1
steps:
- uses: actions/checkout@v4
- name: Install requirements
run: |
sudo apk add tzdata swig python3-dev
sudo apk add proj-util proj-dev geos-dev
cp /usr/share/zoneinfo/America/New_York /etc/localtime
if [[ -f requirements.txt ]]; then
pip install -r requirements.txt
fi
if [[ -f dev-requirements.txt ]]; then
pip install -r dev-requirements.txt
fi
pip install -e .
- name: Setup extension (CKAN >= 2.9)
run: |
ckan -c test.ini db init
if [[ $(cat requirements.txt | grep 'ckanext-harvest') ]]; then
ckan -c test.ini harvester initdb
fi
- name: Run tests
run: |
set -o pipefail
pytest --ckan-ini=test.ini --cov=ckanext.${{ inputs.ext_name }} --cov-fail-under=${CODE_COVERAGE_THRESHOLD_REQUIRED} --disable-warnings ckanext/${{ inputs.ext_name }}/tests | tee pytest-coverage.txt
- name: Report test coverage
if: ${{ always() }}
uses: coroo/[email protected]