-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tests: Add Github Actions tests #120
Merged
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
8547e5b
tests: Add Github Actions tests
bellisk d00e056
style: Fix flake8 errors
bellisk a6ac8ab
chore: Revert to pyyaml==5.3.1 due to bug
bellisk c6f9d54
tests: Remove old Travis config
bellisk 7858a21
chore: Pin pyproj version to that used by CKAN
bellisk b57bf96
tests: Output logs in tests
bellisk 2c549cf
feat: Map resource rights to license field as well
bellisk 7ef7eb3
tests: Set up solr container for testing
bellisk 4829c10
tests: Don't specify location of docker executable
bellisk 5c30349
tests: Don't run in a container
bellisk b0bf5c6
tests: Make install script executable
bellisk f466a36
tests: Use our fork of ckanext-scheming
bellisk 93f28f6
tests: Define variable in script
bellisk 18c5b8d
tests: Set port for postgres container
bellisk faadbda
tests: Update test.ini for github testing
bellisk e70ce0b
tests: Update pip before installing requirements
bellisk 58c731c
tests: Fix path to ckanext and requirements
bellisk 298f921
tests: Output logs for debugging
bellisk 6afb930
tests: Add debug statements
bellisk bb7cf21
tests: Add debug statements
bellisk 6f361ef
tests: Fix quotes in env vars
bellisk 8235777
tests: Adjust solr setup for CKAN 2.8 solr image
bellisk c07bdd3
tests: Remove debug statement
bellisk ef88bbc
tests: Remove old schema.xml
bellisk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,80 @@ | ||
name: Tests | ||
on: [push, pull_request] | ||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: python:2.7.18-buster | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Install requirements | ||
run: pip install flake8 pycodestyle | ||
- name: Check syntax | ||
run: flake8 --statistics --show-source ckanext | ||
|
||
test: | ||
needs: lint | ||
strategy: | ||
matrix: | ||
ckan-version: [2.8] | ||
fail-fast: false | ||
|
||
name: CKAN ${{ matrix.ckan-version }} | ||
runs-on: ubuntu-latest | ||
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 | ||
CKAN_SITE_URL: http://test.ckan.net | ||
WORKDIR: /__w/ckanext-geocat/ckanext-geocat | ||
SOLR_CONFIG_CKAN_DIR: /opt/solr/server/solr/ckan/conf | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Create solr container | ||
run: | | ||
git clone https://github.com/opendata-swiss/ckanext-switzerland-ng.git | ||
docker create --name test_solr --network ${{ job.container.network }} --network-alias solr \ | ||
--workdir $WORKDIR --publish 8983:8983 \ | ||
-e SOLR_HEAP=1024m -e GITHUB_ACTIONS=true -e CI=true \ | ||
-v "${{ github.workspace }}/ckanext-switzerland-ng/solr/schema.xml":"$SOLR_CONFIG_CKAN_DIR/schema.xml" \ | ||
-v "${{ github.workspace }}/ckanext-switzerland-ng/solr/english_stop.txt":"$SOLR_CONFIG_CKAN_DIR/english_stop.txt" \ | ||
-v "${{ github.workspace }}/ckanext-switzerland-ng/solr/fr_elision.txt":"$SOLR_CONFIG_CKAN_DIR/fr_elision.txt" \ | ||
-v "${{ github.workspace }}/ckanext-switzerland-ng/solr/french_stop.txt":"$SOLR_CONFIG_CKAN_DIR/french_stop.txt" \ | ||
-v "${{ github.workspace }}/ckanext-switzerland-ng/solr/german_dictionary.txt":"$SOLR_CONFIG_CKAN_DIR/german_dictionary.txt" \ | ||
-v "${{ github.workspace }}/ckanext-switzerland-ng/solr/german_stop.txt":"$SOLR_CONFIG_CKAN_DIR/german_stop.txt" \ | ||
-v "${{ github.workspace }}/ckanext-switzerland-ng/solr/italian_stop.txt":"$SOLR_CONFIG_CKAN_DIR/italian_stop.txt" \ | ||
-v "${{ github.workspace }}/ckanext-switzerland-ng/solr/solrconfig.xml":"$SOLR_CONFIG_CKAN_DIR/solrconfig.xml" \ | ||
ckan/ckan-solr:${{ matrix.ckan-version }} | ||
docker start test_solr | ||
- name: Create ckan container | ||
run: | | ||
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 database | ||
run: | | ||
docker exec test_ckan $WORKDIR/bin/install_test_requirements.sh ${{ matrix.ckan-version }} | ||
- name: Run tests | ||
run: | | ||
docker exec test_ckan nosetests --ckan --with-pylons=$WORKDIR/test.ini \ | ||
--with-coverage --cover-package=ckanext.geocat --cover-inclusive --cover-erase --cover-tests $WORKDIR/ckanext/geocat |
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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/bin/bash | ||
|
||
WORKDIR=/__w/ckanext-geocat/ckanext-geocat | ||
|
||
pip install --upgrade pip | ||
|
||
# Install ckanext-geocat | ||
pip install -r "$WORKDIR"/requirements.txt | ||
pip install -r "$WORKDIR"/dev-requirements.txt | ||
pip install -e "$WORKDIR"/ | ||
|
||
# Install ckanext dependencies | ||
pip install -e git+https://github.com/ckan/ckanext-fluent.git#egg=ckanext-fluent | ||
pip install -e git+https://github.com/ckan/ckanext-hierarchy.git#egg=ckanext-hierarchy | ||
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 | ||
|
||
# Last commit before support for Python 2 was dropped | ||
pip install -e git+https://github.com/ckan/[email protected]#egg=ckanext-harvest | ||
pip install -r https://raw.githubusercontent.com/ckan/ckanext-harvest/v1.4.2/requirements.txt | ||
|
||
# Last commit before support for Python 2 was dropped | ||
pip install -e git+https://github.com/ckan/ckanext-dcat.git@0c26bed5b7a3a7fca8e7b78e338aace096e0ebf6#egg=ckanext-dcat | ||
pip install -r https://raw.githubusercontent.com/ckan/ckanext-dcat/0c26bed5b7a3a7fca8e7b78e338aace096e0ebf6/requirements-py2.txt | ||
|
||
# Last commit before support for Python 2 was dropped | ||
pip install -e git+https://github.com/ckan/[email protected]#egg=ckanext-showcase | ||
|
||
# Our ckanexts | ||
pip install -e git+https://github.com/opendata-swiss/ckanext-dcatapchharvest.git#egg=ckanext-dcatapchharvest | ||
pip install -r https://raw.githubusercontent.com/opendata-swiss/ckanext-dcatapchharvest/master/requirements.txt | ||
pip install -e git+https://github.com/opendata-swiss/ckanext-harvester_dashboard.git#egg=ckanext-harvester_dashboard | ||
pip install -r https://raw.githubusercontent.com/opendata-swiss/ckanext-harvester_dashboard/master/requirements.txt | ||
pip install -e git+https://github.com/opendata-swiss/ckanext-subscribe.git#egg=ckanext-subscribe | ||
pip install -r https://raw.githubusercontent.com/opendata-swiss/ckanext-subscribe/master/requirements.txt | ||
pip install -e git+https://github.com/opendata-swiss/ckanext-switzerland-ng.git#egg=ckanext-switzerland-ng | ||
pip install -r https://raw.githubusercontent.com/opendata-swiss/ckanext-switzerland-ng/master/requirements.txt | ||
pip install -e git+https://github.com/opendata-swiss/ckanext-scheming.git#egg=ckanext-scheming | ||
|
||
# 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/' "$WORKDIR"/test.ini | ||
|
||
# Init db and enable required plugins | ||
paster --plugin=ckan config-tool "$WORKDIR"/test.ini "ckan.plugins = " | ||
paster --plugin=ckan db init -c "$WORKDIR"/test.ini | ||
paster --plugin=ckanext-harvest harvester initdb -c "$WORKDIR"/test.ini | ||
paster --plugin=ckan config-tool "$WORKDIR"/test.ini "ckan.plugins = harvest ckan_harvester geocat_harvester ogdch ogdch_pkg scheming_datasets fluent" |
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
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 |
---|---|---|
@@ -1,5 +1,7 @@ | ||
lxml>=4.6.2 | ||
OWSLib==0.18.0 | ||
pyproj==1.9.6 | ||
python-dateutil==2.8.1 | ||
pyyaml==5.4 | ||
# TODO: Revert to 5.4 once https://github.com/yaml/pyyaml/issues/724 is fixed | ||
pyyaml==5.3.1 | ||
rdflib==5.0.0 |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make sense to log the exception?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be honest, I'm not sure what kind of exception we could possibly be getting here. :-/ I don't think it's worth logging it, though, because when we use this rights dictionary, we actually only need it to have a valid rights name in one of the languages to get the correct rights id. (Here: https://github.com/opendata-swiss/ckanext-geocat/blob/master/ckanext/geocat/utils/csw_mapping.py#L399.)