feat: Update the Subscription factory to include g_recaptcha_response #580
Workflow file for this run
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
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 --exclude ckanext/switzerland/tests,setup.py 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-switzerland-ng/ckanext-switzerland-ng | |
SOLR_CONFIG_CKAN_DIR: /opt/solr/server/solr/ckan/conf | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Create solr container | |
run: | | |
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 }}/solr/schema.xml":"$SOLR_CONFIG_CKAN_DIR/schema.xml" \ | |
-v "${{ github.workspace }}/solr/english_stop.txt":"$SOLR_CONFIG_CKAN_DIR/english_stop.txt" \ | |
-v "${{ github.workspace }}/solr/fr_elision.txt":"$SOLR_CONFIG_CKAN_DIR/fr_elision.txt" \ | |
-v "${{ github.workspace }}/solr/french_stop.txt":"$SOLR_CONFIG_CKAN_DIR/french_stop.txt" \ | |
-v "${{ github.workspace }}/solr/german_dictionary.txt":"$SOLR_CONFIG_CKAN_DIR/german_dictionary.txt" \ | |
-v "${{ github.workspace }}/solr/german_stop.txt":"$SOLR_CONFIG_CKAN_DIR/german_stop.txt" \ | |
-v "${{ github.workspace }}/solr/italian_stop.txt":"$SOLR_CONFIG_CKAN_DIR/italian_stop.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: | | |
docker create --name test_ckan --network ${{ job.container.network }} --network-alias ckan \ | |
-e "HOME=/github/home" -e GITHUB_ACTIONS=true -e CI=true -e CKAN_SITE_URL=http://test.ckan.net \ | |
-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.switzerland --cover-inclusive --cover-erase --cover-tests \ | |
$WORKDIR/ckanext/switzerland | |
- name: Coveralls | |
run: | | |
# Upgrade certi to fix SSL error due to the version installed in CKAN-2.8 image | |
pip install --upgrade certifi | |
# Run coveralls command with retry logic to handle potential transient issues | |
for attempt in 1 2 3; do | |
coveralls && break | |
echo "Attempt $attempt: Failed to submit coverage, retrying in 10 seconds..." | |
sleep 10 | |
done |