-
Notifications
You must be signed in to change notification settings - Fork 39
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 #93 from NaturalHistoryMuseum/dev
- Loading branch information
Showing
20 changed files
with
282 additions
and
112 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
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,30 @@ | ||
name: Bump version | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
bump-version: | ||
if: "!startsWith(github.event.head_commit.message, 'bump:')" | ||
runs-on: ubuntu-latest | ||
name: "Bump version and create changelog" | ||
steps: | ||
- name: Check out | ||
uses: actions/checkout@v3 | ||
with: | ||
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | ||
fetch-depth: 0 | ||
- name: Create bump and changelog | ||
uses: commitizen-tools/commitizen-action@master | ||
with: | ||
github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | ||
changelog_increment_filename: CURRENT.md | ||
- name: Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
body_path: "CURRENT.md" | ||
tag_name: v${{ env.REVISION }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} |
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,21 @@ | ||
name: Tests | ||
|
||
on: | ||
push: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout source code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Build images | ||
run: docker-compose build | ||
|
||
- name: Run tests | ||
env: | ||
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} | ||
run: docker-compose run -e COVERALLS_REPO_TOKEN ckan bash /opt/scripts/run-tests.sh -c ckanext.ldap |
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 @@ | ||
*.egg-info | ||
*.pyc | ||
.noseids | ||
|
||
|
||
.pytest_cache | ||
.coverage | ||
build/ | ||
dist/ | ||
.idea | ||
**/node_modules/ |
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,24 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.3.0 | ||
hooks: | ||
- id: check-merge-conflict | ||
- id: detect-private-key | ||
- id: end-of-file-fixer | ||
- id: name-tests-test | ||
- id: trailing-whitespace | ||
- repo: https://github.com/commitizen-tools/commitizen | ||
rev: v2.35.0 | ||
hooks: | ||
- id: commitizen | ||
- repo: https://github.com/psf/black | ||
rev: 22.10.0 | ||
hooks: | ||
- id: black | ||
- repo: https://github.com/PyCQA/docformatter | ||
rev: v1.5.0 | ||
hooks: | ||
- id: docformatter | ||
# these can't be pulled directly from the config atm, not sure why | ||
args: ["-i", "--wrap-summaries=88", "--wrap-descriptions=88", | ||
"--pre-summary-newline", "--make-summary-multi-line"] |
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,9 @@ | ||
version: 2 | ||
|
||
python: | ||
install: | ||
- method: pip | ||
path: .[docs] | ||
|
||
mkdocs: | ||
configuration: mkdocs.yml |
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 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 |
---|---|---|
@@ -1,27 +1,21 @@ | ||
FROM openknowledge/ckan-dev:2.9 | ||
FROM naturalhistorymuseum/ckantest:0.2 | ||
|
||
RUN apk add openldap-dev | ||
# required by python-ldap | ||
RUN apt-get -q -y install libldap2-dev libsasl2-dev \ | ||
&& apt-get -q clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# ckan is installed in /srv/app/src/ckan in the ckan-dev image we're basing this image on | ||
WORKDIR /srv/app/src/ckanext-ldap | ||
WORKDIR /base/src/ckanext-ldap | ||
|
||
# copy over the ckanext-ldap source | ||
# copy over the source | ||
COPY . . | ||
|
||
# might as well update pip while we're here! | ||
RUN pip3 install --upgrade pip | ||
|
||
# fixes this https://github.com/ckan/ckan/issues/5570 | ||
RUN pip3 install pytest-ckan | ||
|
||
# install the dependencies | ||
RUN python3 setup.py develop && \ | ||
pip3 install -r requirements.txt && \ | ||
pip3 install -r dev_requirements.txt | ||
# install the base + test dependencies | ||
RUN pip install -e .[test] | ||
|
||
# this entrypoint ensures our service dependencies (postgresql, solr and redis) are running before | ||
# running the cmd | ||
ENTRYPOINT ["/bin/bash", "docker/entrypoint.sh"] | ||
ENTRYPOINT ["/bin/bash", "/opt/waits/basic.sh"] | ||
|
||
# run the tests with coverage output | ||
CMD ["pytest", "--cov=ckanext.ldap", "--ckan-ini=test.ini", "tests"] | ||
CMD ["bash", "/opt/scripts/run-tests.sh", "ckanext.ldap"] |
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,45 @@ | ||
# !/usr/bin/env python | ||
# encoding: utf-8 | ||
|
||
""" | ||
Generate the code reference pages and navigation. | ||
Adapted from https://mkdocstrings.github.io/recipes. | ||
""" | ||
|
||
from pathlib import Path | ||
|
||
import mkdocs_gen_files | ||
|
||
nav = mkdocs_gen_files.Nav() | ||
|
||
root = 'ckanext' | ||
|
||
py_files = sorted(Path(root).rglob('*.py')) | ||
|
||
for path in py_files: | ||
module_path = path.relative_to(root).with_suffix('') | ||
doc_path = path.relative_to(root).with_suffix('.md') | ||
full_doc_path = Path('API', doc_path) | ||
|
||
parts = tuple(module_path.parts) | ||
|
||
if parts[-1] == '__init__': | ||
if len(parts) == 1: | ||
continue | ||
parts = parts[:-1] | ||
doc_path = doc_path.with_name('index.md') | ||
full_doc_path = full_doc_path.with_name('index.md') | ||
elif parts[-1] == '__main__': | ||
continue | ||
|
||
nav[parts] = doc_path.as_posix() | ||
|
||
with mkdocs_gen_files.open(full_doc_path, "w") as fd: | ||
ident = '.'.join(parts) | ||
fd.write(f'::: ckanext.{ident}') | ||
|
||
mkdocs_gen_files.set_edit_path(full_doc_path, path) | ||
|
||
with mkdocs_gen_files.open('API/index.md', 'w') as nav_file: | ||
nav_file.writelines(nav.build_literate_nav()) |
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 @@ | ||
# ckanext-ldap documentation |
Empty file.
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,36 @@ | ||
site_name: ckanext-ldap | ||
|
||
theme: | ||
name: material | ||
palette: | ||
- scheme: default | ||
toggle: | ||
icon: material/lightbulb | ||
primary: green | ||
accent: green | ||
- scheme: slate | ||
toggle: | ||
icon: material/lightbulb-outline | ||
primary: green | ||
accent: green | ||
|
||
watch: | ||
- ckanext | ||
|
||
plugins: | ||
- search | ||
- mkdocstrings: | ||
default_handler: python | ||
handlers: | ||
python: | ||
options: | ||
docstring_style: sphinx | ||
- gen-files: | ||
scripts: | ||
- docs/_scripts/gen_api_pages.py | ||
- section-index | ||
|
||
markdown_extensions: | ||
- admonition | ||
- pymdownx.details | ||
- pymdownx.superfences |
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,83 @@ | ||
[project] | ||
name = "ckanext-ldap" | ||
version = "3.1.2" | ||
description = "A CKAN extension that provides LDAP authentication." | ||
readme = "README.md" | ||
requires-python = ">=3.6" | ||
license = {text = "GPL-3.0-or-later"} | ||
authors = [ | ||
{ name = "Natural History Museum", email = "data@nhm.ac.uk" } | ||
] | ||
keywords = ["CKAN", "data", "ldap"] | ||
classifiers = [ | ||
"Development Status :: 5 - Production/Stable", | ||
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)", | ||
"Programming Language :: Python", | ||
"Programming Language :: Python :: 3 :: Only", | ||
"Programming Language :: Python :: 3.6", | ||
"Programming Language :: Python :: 3.7", | ||
"Programming Language :: Python :: 3.8" | ||
] | ||
dependencies = [ | ||
"ckantools==0.2.0", | ||
"python-ldap==3.4.0" | ||
] | ||
|
||
[project.optional-dependencies] | ||
test = [ | ||
"mock", | ||
"pytest>=4.6.5", | ||
"pytest-cov>=2.7.1", | ||
"coveralls" | ||
] | ||
docs = [ | ||
"mkdocs", | ||
"mkdocstrings[python]", | ||
"mkdocs-material", | ||
"mkdocs-gen-files", | ||
"mkdocs-section-index" | ||
] | ||
|
||
[project.urls] | ||
repository = "https://github.com/NaturalHistoryMuseum/ckanext-ldap" | ||
changelog = "https://github.com/NaturalHistoryMuseum/ckanext-ldap/blob/main/CHANGELOG.md" | ||
|
||
[project.entry-points."ckan.plugins"] | ||
ldap = "ckanext.ldap.plugin:LdapPlugin" | ||
|
||
|
||
[build-system] | ||
requires = ["setuptools", "wheel"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
|
||
[tool] | ||
[tool.setuptools] | ||
zip-safe = false | ||
|
||
[tool.setuptools.packages.find] | ||
exclude = ["tests"] | ||
|
||
[tool.commitizen] | ||
name = "cz_conventional_commits" | ||
version = "3.1.2" | ||
tag_format = "v$version" | ||
update_changelog_on_bump = true | ||
changelog_incremental = false | ||
version_files = [ | ||
"pyproject.toml:version" | ||
] | ||
|
||
[tool.black] | ||
line-length = 88 | ||
skip_string_normalization = true | ||
|
||
[tool.pylint] | ||
max-line-length = 88 | ||
disable = ["C0114", "R0903"] | ||
|
||
[tool.docformatter] | ||
wrap-summaries = 88 | ||
wrap-descriptions = 88 | ||
pre-summary-newline = true | ||
make-summary-multi-line = true |
Oops, something went wrong.