Skip to content

Commit

Permalink
Merge branch 'develop' into feature/validation-support
Browse files Browse the repository at this point in the history
  • Loading branch information
duttonw committed Oct 25, 2024
2 parents 6070740 + 04f1d09 commit eab54e4
Show file tree
Hide file tree
Showing 21 changed files with 628 additions and 26 deletions.
163 changes: 163 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
---
name: Publish to pypi
on:
push:
#On versioned releases
tags:
- v*.*.*
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
force:
type: choice
description: Retry Publish Version
options:
- No
- Yes
environment:
description: 'Deployment environment'
required: true
default: 'pypi'
type: choice
options:
- pypi
- testpypi
dryRun:
description: 'Dry Run deployment (set to false to deploy)'
required: true
type: boolean
default: true



jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install requirements
run: pip install flake8 pycodestyle
- name: Check syntax
run: flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics --extend-exclude ckan

test:
needs: lint
strategy:
matrix:
ckan-version: ["2.11", "2.10", 2.9]
fail-fast: false

name: CKAN ${{ matrix.ckan-version }}
runs-on: ubuntu-latest
container:
image: ckan/ckan-dev:${{ matrix.ckan-version }}
services:
solr:
image: ckan/ckan-solr:${{ matrix.ckan-version }}-solr9
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

steps:
- uses: actions/checkout@v4
- if: ${{ matrix.ckan-version == 2.9 }}
run: pip install "setuptools>=44.1.0,<71"
- name: Install requirements
run: |
pip install -r requirements.txt
pip install -r dev-requirements.txt
pip install -e .
pip install -U requests[security]
# 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.9)
run: |
ckan -c test.ini db init
- name: Run tests
run: pytest --ckan-ini=test.ini --cov=ckanext.xloader --disable-warnings ckanext/xloader/tests

publish:
needs: test
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
name: Publish Package
runs-on: ubuntu-latest
environment:
name: ${{ github.event.inputs.environment }}
url: ${{ steps.version.outputs.url }}
concurrency:
group: ${{ github.event.inputs.environment }}-deployment
cancel-in-progress: false

steps:
- name: Get Git Tag and set url from environment
id: version
run: |
#!/bin/bash
ENVIRONMENT=$1
TAG_VALUE=${GITHUB_REF/refs\/tags\//}
echo "version=${TAG_VALUE}" >> $GITHUB_ENV
# Extract the repository name (minus the owner/org)
reponame=$(basename $GITHUB_REPOSITORY)
echo "reponame=${reponame}" >> $GITHUB_OUTPUT
if [ "$ENVIRONMENT" == "pypi" ]; then
url="https://pypi.com/p/$reponame"
elif [ "$1" == "testpypi" ]; then
url="https://test.pypi.com/p/$reponame"
else
url=""
fi
echo "url=${url}" >> $GITHUB_OUTPUT
- name: Checkout repository
uses: actions/checkout@v4
- name: Build package ${{ steps.version.outputs.reponame }} @ ${{ steps.version.outputs.version }}
run: |
pip install build
pip install twine
python -m build
- name: Publish package distributions to PyPI
if: ${{ startsWith(github.ref, 'refs/tags') && (github.event.inputs.environment == 'pypi' || github.event.inputs.environment == 'publish' ) && github.event.inputs.dryRun != 'true'}}
uses: pypa/gh-action-pypi-publish@release/v1
# with:
# skip-existing: true
# verbose: true
# print-hash: true
- name: Test Publish package distributions to PyPI
if: ${{ startsWith(github.ref, 'refs/tags') && github.event.inputs.environment == 'testpypi' && github.event.inputs.dryRun == 'true' }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
# skip-existing: true
# verbose: true
# print-hash: true
- name: Summary output
if: ${{ startsWith(github.ref, 'refs/tags') && github.event.inputs.dryRun != 'true' }}
run:
echo "Published ${{ steps.version.outputs.repo_name }} @ ${{ steps.version.outputs.version }} to ${{ steps.version.outputs.url }}" >> $GITHUB_STEP_SUMMARY

- name: (TEST RUN) Test Publish package distributions to PyPI
if: ${{ github.event.inputs.dryRun == 'true' }}
run:
echo "Dry run deployment, did not publish" >> $GITHUB_STEP_SUMMARY
14 changes: 8 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install requirements
Expand All @@ -23,16 +23,16 @@ jobs:
needs: lint
strategy:
matrix:
ckan-version: ["2.10", 2.9]
ckan-version: ["2.11", "2.10", 2.9]
fail-fast: false

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 }}
image: ckan/ckan-solr:${{ matrix.ckan-version }}-solr9
postgres:
image: ckan/ckan-postgres-dev:${{ matrix.ckan-version }}
env:
Expand All @@ -52,7 +52,9 @@ jobs:
CKAN_REDIS_URL: redis://redis:6379/1

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- if: ${{ matrix.ckan-version == 2.9 }}
run: pip install "setuptools>=44.1.0,<71"
- name: Install requirements
run: |
pip install -r requirements.txt
Expand Down
72 changes: 72 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,75 @@
1.1.0 2024-10-16
================

Fixes:
* feat: Add pypi cicd publish via github action via environment controls by @duttonw in https://github.com/ckan/ckanext-xloader/pull/228


**Full Changelog**: https://github.com/ckan/ckanext-xloader/compare/1.1.0...1.1.1


1.1.0 2024-10-15
================


Fixes:

* add README note about running on separate server, #191 by @ThrawnCA in https://github.com/ckan/ckanext-xloader/pull/192
* Use IDomainObjectModification Implementation by @JVickery-TBS in https://github.com/ckan/ckanext-xloader/pull/198
* Hide excessive numbers of resource_data log entries, #187 by @ThrawnCA in https://github.com/ckan/ckanext-xloader/pull/188
* #182 Type guessing fixes by @ThrawnCA in https://github.com/ckan/ckanext-xloader/pull/186
* Document the ckan.download_proxy setting, #176 by @ThrawnCA in https://github.com/ckan/ckanext-xloader/pull/204
* Conditional DataStore Tab in Resource Edit by @JVickery-TBS in https://github.com/ckan/ckanext-xloader/pull/190
* Make locking behaviour more robust by @ThrawnCA in https://github.com/ckan/ckanext-xloader/pull/205
* Delete Datastore Table Button by @JVickery-TBS in https://github.com/ckan/ckanext-xloader/pull/197
* Quality of life improvements by @duttonw in https://github.com/ckan/ckanext-xloader/pull/195
* Clean Datastore Tables Job by @JVickery-TBS in https://github.com/ckan/ckanext-xloader/pull/196
* strip extra space for column name by @mutantsan in https://github.com/ckan/ckanext-xloader/pull/210
* Skip empty lines instead of erroring by @ThrawnCA in https://github.com/ckan/ckanext-xloader/pull/208
* add more options for maintainers to expedite XLoader runs, GitHub #202 by @ThrawnCA in https://github.com/ckan/ckanext-xloader/pull/212
* Add Mixed Integers Type Guessing to NUMERIC Tests by @JVickery-TBS in https://github.com/ckan/ckanext-xloader/pull/217
* PY2 & PY3 String/Binary Fixes by @JVickery-TBS in https://github.com/ckan/ckanext-xloader/pull/203
* In plugin.py, there is an fix of resource format key error by @Nisha1293 in https://github.com/ckan/ckanext-xloader/pull/209
* CKAN 2.11 support by @amercader in https://github.com/ckan/ckanext-xloader/pull/220

New Contributors:

* @JVickery-TBS made their first contribution in https://github.com/ckan/ckanext-xloader/pull/198
* @duttonw made their first contribution in https://github.com/ckan/ckanext-xloader/pull/195
* @mutantsan made their first contribution in https://github.com/ckan/ckanext-xloader/pull/210
* @Nisha1293 made their first contribution in https://github.com/ckan/ckanext-xloader/pull/209

**Full Changelog**: https://github.com/ckan/ckanext-xloader/compare/1.0.1...1.1.0


1.0.1 2024-04-04
================

Fixes:

* Include config_declaration.yaml into MANIFEST by @pdelboca in https://github.com/ckan/ckanext-xloader/pull/183


**Full Changelog**: https://github.com/ckan/ckanext-xloader/compare/1.0.0...1.0.1

1.0.1 2024-04-04
================

Fixes:

* Fixed date parsing while fetching entries for task_status by @muhammed-ajmal in https://github.com/ckan/ckanext-xloader/pull/179
* Drop support for old CKAN versions and add CSRF support by @pdelboca in https://github.com/ckan/ckanext-xloader/pull/180
* Refactor test_jobs.py by @pdelboca in https://github.com/ckan/ckanext-xloader/pull/181

New Contributors:

* @muhammed-ajmal made their first contribution in https://github.com/ckan/ckanext-xloader/pull/179

**Full Changelog**: https://github.com/ckan/ckanext-xloader/compare/0.12.2...1.0.0




0.9.0 2021-10-01
================

Expand Down
17 changes: 16 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,9 @@ CKAN version Compatibility
=============== =============
2.7 no longer supported (last supported version: 0.12.2)
2.8 no longer supported (last supported version: 0.12.2)
2.9 yes (Python3) (last supported version for Python 2.7: 0.12.2))
2.9 yes (Python3) (last supported version for Python 2.7: 0.12.2)), Must: ``pip install "setuptools>=44.1.0,<71"``
2.10 yes
2.11 yes
=============== =============

------------
Expand Down Expand Up @@ -202,6 +203,20 @@ expect European (day-first) dates, you could add to ``postgresql.conf``:

datestyle=ISO,DMY

External Database credentials for datastore

``ckanext.xloader.jobs_db.uri = postgresql://ckan_default:pass@localhost/ckan_default``

API Key requires for xloader interaction CKAN 2.10 onwards, to generate ``TOKEN=ckan -c /etc/ckan/default/production.ini user token add $ACCOUNT xloader | tail -1 | tr -d '[:space:]')``

``ckanext.xloader.api_token = <your-CKAN-generated-API-Token>``

Badge notification on what xloader is doing

``ckanext.xloader.show_badges = True|False (default True)``

``ckanext.xloader.debug_badges = True|False (default False)``

------------------------
Developer installation
------------------------
Expand Down
25 changes: 25 additions & 0 deletions ckanext/xloader/config_declaration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,15 @@ groups:
type: bool
required: false
legacy_key: ckanext.xloader.just_load_with_messytables
- key: ckanext.xloader.strict_type_guessing
default: True
example: False
description: |
Use with ckanext.xloader.use_type_guessing to set strict true or false
for type guessing. If set to False, the types will always fallback to string type.
Strict means that a type will not be guessed if parsing fails for a single cell in the column.
type: bool
- key: ckanext.xloader.max_type_guessing_length
default: 0
example: 100000
Expand Down Expand Up @@ -146,5 +155,21 @@ groups:
that is not in ckanext.xloader.formats after a Resource is updated.
type: bool
required: false
- key: ckanext.xloader.show_badges
default: True
example: False
description: |
Controls whether or not the status badges display in the front end.
type: bool
required: false
- key: ckanext.xloader.debug_badges
default: False
example: True
description: |
Controls whether or not the status badges display all of the statuses. By default,
the badges will display "pending", "running", and "error". With debug_badges enabled,
they will also display "complete", "active", "inactive", and "unknown".
type: bool
required: false


Loading

0 comments on commit eab54e4

Please sign in to comment.