From 5a4f3d35d242e5e466f72653ca64a5aa7e1fb516 Mon Sep 17 00:00:00 2001 From: Sergey Motornyuk Date: Fri, 28 Jun 2024 18:52:15 +0300 Subject: [PATCH 1/5] feat: CKAN v2.11 support --- .github/workflows/test.yml | 2 +- ckanext/googleanalytics/tests/test_plugin.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8f9c2ab..d76db57 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,7 +19,7 @@ jobs: needs: lint strategy: matrix: - ckan-version: ["2.10", 2.9, 2.9-py2, 2.8] + ckan-version: ["2.11", "2.10", 2.9, 2.9-py2, 2.8] fail-fast: false name: CKAN ${{ matrix.ckan-version }} diff --git a/ckanext/googleanalytics/tests/test_plugin.py b/ckanext/googleanalytics/tests/test_plugin.py index 15682bf..0e38b2f 100644 --- a/ckanext/googleanalytics/tests/test_plugin.py +++ b/ckanext/googleanalytics/tests/test_plugin.py @@ -1,7 +1,7 @@ import pytest -@pytest.mark.usefixtures("clean_db") +@pytest.mark.usefixtures("with_plugins", "clean_db") def test_script(app): resp = app.get("/") assert "GoogleAnalyticsObject" in resp From 5eff018a314529a428b81413614497d2e0ede168 Mon Sep 17 00:00:00 2001 From: Sergey Motornyuk Date: Fri, 28 Jun 2024 19:09:59 +0300 Subject: [PATCH 2/5] chore: fix py2 tests --- ckanext/googleanalytics/tests/test_view.py | 4 ++-- setup.cfg | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ckanext/googleanalytics/tests/test_view.py b/ckanext/googleanalytics/tests/test_view.py index 48787fb..03162df 100644 --- a/ckanext/googleanalytics/tests/test_view.py +++ b/ckanext/googleanalytics/tests/test_view.py @@ -1,5 +1,5 @@ import pytest - +import six import ckan.plugins.toolkit as tk from ckanext.googleanalytics import config @@ -23,4 +23,4 @@ def test_tracking_(self, mode, tracking_id, app, ckan_config, monkeypatch): monkeypatch.setitem(ckan_config, config.CONFIG_TRACKING_MODE, mode) snippet = _render_header(mode, tracking_id) resp = app.get("/about") - assert snippet in resp.body + assert six.ensure_str(snippet) in resp diff --git a/setup.cfg b/setup.cfg index a0f964d..537092b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -16,6 +16,8 @@ classifiers = Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 + Programming Language :: Python :: 3.11 + Programming Language :: Python :: 3.12 keywords = CKAN From 80b14a18d6be6b0b9bd22989be3e34f49cfc769b Mon Sep 17 00:00:00 2001 From: Sergey Motornyuk Date: Fri, 28 Jun 2024 19:10:49 +0300 Subject: [PATCH 3/5] chore: switch to ckan docker image --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d76db57..c8efb9f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,7 +25,7 @@ jobs: name: CKAN ${{ matrix.ckan-version }} runs-on: ubuntu-latest container: - image: openknowledge/ckan-dev:${{ matrix.ckan-version }} + image: ckan/ckan-dev:${{ matrix.ckan-version }} services: solr: image: ckan/ckan-solr:${{ matrix.ckan-version }} From da1288da0574ee3d694b10f18e848804b91f0433 Mon Sep 17 00:00:00 2001 From: Sergey Motornyuk Date: Fri, 28 Jun 2024 19:13:48 +0300 Subject: [PATCH 4/5] chore: switch to ckan-solr-9 docker image --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c8efb9f..a9a3f7a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,7 +19,7 @@ jobs: needs: lint strategy: matrix: - ckan-version: ["2.11", "2.10", 2.9, 2.9-py2, 2.8] + ckan-version: ["2.11", "2.10", 2.9] fail-fast: false name: CKAN ${{ matrix.ckan-version }} @@ -28,7 +28,7 @@ jobs: image: ckan/ckan-dev:${{ matrix.ckan-version }} services: solr: - image: ckan/ckan-solr:${{ matrix.ckan-version }} + image: ckan/ckan-solr:${{ matrix.ckan-version }}-solr9 postgres: image: ckan/ckan-postgres-dev:${{ matrix.ckan-version }} env: From 0dedda1fc276ca027bd90d60411948afb6d6e408 Mon Sep 17 00:00:00 2001 From: Sergey Motornyuk Date: Fri, 28 Jun 2024 19:17:58 +0300 Subject: [PATCH 5/5] chore: fix workflow configuration for 2.11 --- .github/workflows/test.yml | 10 ++-------- setup.cfg | 5 ++--- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a9a3f7a..9ec73d6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -54,22 +54,16 @@ jobs: # 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 - name: Setup extension (CKAN 2.10) - if: ${{ matrix.ckan-version == '2.10' }} + if: ${{ matrix.ckan-version >= '2.10' }} run: | pip install -r dev-requirements.txt ckan -c test.ini db init ckan -c test.ini db upgrade -p googleanalytics - name: Setup extension (CKAN == 2.9) - if: ${{ matrix.ckan-version == '2.9' || matrix.ckan-version == '2.9-py2' }} + if: ${{ matrix.ckan-version == '2.9' }} run: | pip install -r dev-requirements-2.9.txt ckan -c test.ini db init ckan -c test.ini db upgrade -p googleanalytics - - name: Setup extension (CKAN < 2.9) - if: ${{ matrix.ckan-version == '2.8' }} - run: | - pip install -r dev-requirements-2.9.txt - paster --plugin=ckan db init -c test.ini - paster --plugin=ckanext-googleanalytics initdb -c test.ini - name: Run tests run: pytest --ckan-ini=test.ini --cov=ckanext.googleanalytics --disable-warnings ckanext/googleanalytics/tests diff --git a/setup.cfg b/setup.cfg index 537092b..89c22a0 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = ckanext-googleanalytics -version = 2.3.0 +version = 2.4.0 description = Add GA tracking and reporting to CKAN instance long_description = file: README.md long_description_content_type = text/markdown @@ -11,7 +11,6 @@ license = AGPL classifiers = Development Status :: 4 - Beta License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+) - Programming Language :: Python :: 2.7 Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 @@ -22,7 +21,7 @@ keywords = CKAN [options] -# python_requires = >= 3.7 +python_requires = >= 3.7 install_requires = ckantoolkit google-api-python-client