-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #102 from opendatazurich/dockerizing
Merge dockerizing into main branch
- Loading branch information
Showing
22 changed files
with
2,660 additions
and
1,473 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: Tests | ||
on: [push, pull_request] | ||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v3 | ||
- name: Install requirements | ||
run: pip install flake8 pycodestyle black isort | ||
- name: Check syntax | ||
run: flake8 . --count --select=C901,E901,E999,F401,F821,F822,F823 --show-source --statistics --extend-exclude ckan | ||
- name: Check codestyle | ||
run: | | ||
isort --diff --check ckanext/ | ||
black --diff --check ckanext/ | ||
test: | ||
needs: lint | ||
strategy: | ||
matrix: | ||
ckan-version: ["2.10"] | ||
fail-fast: false | ||
|
||
name: CKAN ${{ matrix.ckan-version }} | ||
runs-on: ubuntu-20.04 | ||
services: | ||
postgres: | ||
image: ckan/ckan-postgres-dev:${{ matrix.ckan-version }} | ||
env: | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: postgres | ||
POSTGRES_DB: postgres | ||
ports: | ||
- 5432:5432 | ||
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 | ||
WORKDIR: /__w/ckanext-stadtzh-harvest/ckanext-stadtzh-harvest | ||
SOLR_CONFIG_CKAN_DIR: /opt/solr/server/solr/configsets/ckan/conf | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Create solr container | ||
run: | | ||
/usr/bin/docker create --name test_solr --network ${{ job.container.network }} --network-alias solr \ | ||
--workdir $WORKDIR --publish 8983:8983 \ | ||
-e "SOLR_HEAP=1024m" -e "SOLR_SCHEMA_FILE=$SOLR_CONFIG_CKAN_DIR/managed-schema" \ | ||
-e GITHUB_ACTIONS=true -e CI=true -v "${{ github.workspace }}/solr/schema.xml":"$SOLR_CONFIG_CKAN_DIR/managed-schema" \ | ||
-v "${{ github.workspace }}/solr/german_dictionary.txt":"$SOLR_CONFIG_CKAN_DIR/german_dictionary.txt" \ | ||
-v "${{ github.workspace }}/solr/solrconfig.xml":"$SOLR_CONFIG_CKAN_DIR/solrconfig.xml" \ | ||
ckan/ckan-solr:${{ matrix.ckan-version }} | ||
docker start test_solr | ||
- name: Create ckan container | ||
run: | | ||
/usr/bin/docker create --name test_ckan --network ${{ job.container.network }} --network-alias ckan \ | ||
-e "HOME=/github/home" -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" \ | ||
-v "/home/runner/work":"/__w" -v "/home/runner/work/_temp":"/__w/_temp" \ | ||
-v "/home/runner/work/_actions":"/__w/_actions" -v "/opt/hostedtoolcache":"/__t" \ | ||
-v "/home/runner/work/_temp/_github_home":"/github/home" \ | ||
-v "/home/runner/work/_temp/_github_workflow":"/github/workflow" \ | ||
--entrypoint "tail" openknowledge/ckan-dev:${{ matrix.ckan-version }} "-f" "/dev/null" | ||
docker start test_ckan | ||
- name: Install requirements and set up ckanext | ||
run: | | ||
docker exec test_ckan $WORKDIR/bin/install_test_requirements.sh ${{ matrix.ckan-version }} | ||
- name: Run tests | ||
run: | | ||
docker exec test_ckan pytest --ckan-ini=$WORKDIR/test.ini \ | ||
--cov=ckanext.stadtzhharvest --disable-warnings $WORKDIR/ckanext/stadtzhharvest/tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[settings] | ||
profile = black |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/bash | ||
|
||
# Install requirements and ckanext | ||
pip install -r /__w/ckanext-stadtzh-harvest/ckanext-stadtzh-harvest/requirements.txt | ||
pip install -r /__w/ckanext-stadtzh-harvest/ckanext-stadtzh-harvest/dev-requirements.txt | ||
pip install -e /__w/ckanext-stadtzh-harvest/ckanext-stadtzh-harvest/ | ||
pip install -U requests[security] | ||
|
||
# Install ckanext dependencies | ||
pip install -e git+https://github.com/ckan/ckanext-xloader.git#egg=ckanext-xloader | ||
pip install -r https://raw.githubusercontent.com/ckan/ckanext-xloader/master/requirements.txt | ||
pip install -e git+https://github.com/opendatazurich/ckanext-stadtzh-theme.git@main#egg=ckanext-stadtzh-theme | ||
pip install -r https://raw.githubusercontent.com/opendatazurich/ckanext-stadtzh-theme/main/pip-requirements.txt | ||
pip install -e git+https://github.com/ckan/ckanext-dcat.git#egg=ckanext-dcat | ||
pip install -r https://raw.githubusercontent.com/ckan/ckanext-dcat/master/requirements.txt | ||
pip install -e git+https://github.com/ckan/ckanext-harvest.git#egg=ckanext-harvest | ||
pip install -r https://raw.githubusercontent.com/ckan/ckanext-harvest/master/requirements.txt | ||
|
||
# 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/' /__w/ckanext-stadtzh-harvest/ckanext-stadtzh-harvest/test.ini | ||
|
||
# Init db and enable required plugins | ||
echo "Removing all ckan plugins so we can initialize the database" | ||
ckan config-tool /__w/ckanext-stadtzh-harvest/ckanext-stadtzh-harvest/test.ini "ckan.plugins = " | ||
ckan -c /__w/ckanext-stadtzh-harvest/ckanext-stadtzh-harvest/test.ini db init | ||
echo "Re-enabling ckan plugins now the database is initialized" | ||
ckan config-tool /__w/ckanext-stadtzh-harvest/ckanext-stadtzh-harvest/test.ini "ckan.plugins = harvest stadtzh_harvester stadtzhtheme" | ||
echo "Plugins enabled: harvest stadtzh_harvester stadtzhtheme" | ||
ckan -c /__w/ckanext-stadtzh-harvest/ckanext-stadtzh-harvest/test.ini db upgrade -p harvest |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
# this is a namespace package | ||
try: | ||
import pkg_resources | ||
|
||
pkg_resources.declare_namespace(__name__) | ||
except ImportError: | ||
import pkgutil | ||
|
||
__path__ = pkgutil.extend_path(__path__, __name__) |
Oops, something went wrong.