-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
84ecb26
commit 368b10b
Showing
26 changed files
with
500 additions
and
104 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
# run CI only if files in these whitelisted paths are changed | ||
paths: | ||
- '.github/workflows/**' | ||
- 'rdmo_plugins/**' | ||
- .pre-commit-config.yaml | ||
- pyproject.toml | ||
|
||
# Ref: https://docs.github.com/en/actions/using-jobs/using-concurrency | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
PYTHONDONTWRITEBYTECODE: 1 | ||
FORCE_COLOR: 1 # colored output by pytest etc. | ||
CLICOLOR_FORCE: 1 # colored output by ruff | ||
|
||
jobs: | ||
|
||
lint: | ||
name: Lint | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.12" | ||
cache: pip | ||
- run: python -m pip install --upgrade pip setuptools wheel | ||
- run: python -m pip install -e .[dev] | ||
- name: Set up pre-commit cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.cache/pre-commit | ||
key: lint-${{ hashFiles('.pre-commit-config.yaml') }} | ||
- name: Run linters via pre-commit (ruff, eslint) | ||
run: pre-commit run --all-files --color=always | ||
|
||
test: | ||
runs-on: ubuntu-22.04 | ||
strategy: | ||
matrix: | ||
python-version: ['3.8', '3.12'] | ||
db-backend: [mysql, postgres] | ||
name: "Test (Python: ${{ matrix.python-version }}, DB: ${{ matrix.db-backend }})" | ||
# TODO needs: lint | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
cache: pip | ||
- name: Install Dependencies | ||
run: | | ||
sudo apt update | ||
sudo apt install --yes pandoc texlive-xetex | ||
python -m pip install --upgrade pip setuptools wheel | ||
pandoc --version | ||
- name: Install rdmo[mysql] and start mysql | ||
run: | | ||
python -m pip install --editable .[ci] | ||
python -m pip install rdmo[mysql] | ||
sudo systemctl start mysql.service | ||
if: matrix.db-backend == 'mysql' | ||
- name: Install rdmo[postgres] and start postgresql | ||
run: | | ||
python -m pip install --editable .[ci] | ||
python -m pip install rdmo[postgres] | ||
sudo systemctl start postgresql.service | ||
pg_isready | ||
sudo -u postgres psql --command="CREATE USER postgres_user PASSWORD 'postgres_password' CREATEDB" | ||
if: matrix.db-backend == 'postgres' | ||
- name: Prepare Env | ||
run: | | ||
cp -r testing/media testing/media_root | ||
mkdir testing/log | ||
- name: Run Tests | ||
run: | | ||
pytest -p randomly -p no:cacheprovider --cov --reuse-db --numprocesses=auto --dist=loadscope | ||
# coveralls --service=github | ||
# env: | ||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
# GITHUB_DB_BACKEND: ${{ matrix.db-backend }} | ||
# COVERALLS_FLAG_NAME: '${{ matrix.db-backend }}: ${{ matrix.python-version }}' | ||
# COVERALLS_PARALLEL: true | ||
|
||
dev-setup: | ||
# Ref: structlog (MIT licensed) <https://github.com/hynek/structlog/blob/main/.github/workflows/ci.yml> | ||
name: "Test dev setup on ${{ matrix.os }}" | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, windows-latest, macos-latest] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.12" | ||
cache: pip | ||
- run: python -Im pip install -e .[dev] | ||
- run: python -Ic 'import rdmo_plugins; print(rdmo_plugins.__version__)' | ||
|
||
required-checks-pass: | ||
if: always() | ||
needs: | ||
- lint | ||
- test | ||
- dev-setup | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: re-actors/alls-green@release/v1 | ||
with: | ||
jobs: ${{ toJSON(needs) }} |
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 |
---|---|---|
|
@@ -11,3 +11,6 @@ dist | |
*.egg-info | ||
|
||
/env | ||
|
||
.pytest_cache | ||
.ruff_cache |
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,22 @@ | ||
# See https://pre-commit.com for more information | ||
# See https://pre-commit.com/hooks.html for more hooks | ||
|
||
repos: | ||
- repo: meta | ||
hooks: | ||
- id: check-hooks-apply | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.5.0 | ||
hooks: | ||
- id: check-ast | ||
- id: check-xml | ||
- id: check-yaml | ||
- id: end-of-file-fixer | ||
exclude: \.html$|\.txt$ | ||
- id: trailing-whitespace | ||
- id: debug-statements | ||
- repo: https://github.com/charliermarsh/ruff-pre-commit | ||
rev: v0.1.0 | ||
hooks: | ||
- id: ruff | ||
args: [--fix, --exit-non-zero-on-fix] |
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 |
---|---|---|
@@ -0,0 +1,143 @@ | ||
[build-system] | ||
build-backend = "setuptools.build_meta" | ||
requires = ["setuptools", "wheel"] | ||
|
||
[project] | ||
name = "rdmo-plugins" | ||
description = "Import and export plugins for RDMO." | ||
readme = "README.md" | ||
keywords = [ | ||
"data management plan", | ||
"dmp", | ||
"rdmo", | ||
"research data", | ||
"research data management", | ||
] | ||
license = {text = "Apache-2.0"} | ||
authors = [ | ||
{name = "RDMO Arbeitsgemeinschaft", email = "[email protected]"}, | ||
] | ||
requires-python = ">=3.8" | ||
classifiers = [ | ||
"Development Status :: 5 - Production/Stable", | ||
"Environment :: Web Environment", | ||
"Framework :: Django :: 4.2", | ||
"Intended Audience :: Science/Research", | ||
"License :: OSI Approved :: Apache Software License", | ||
"Operating System :: OS Independent", | ||
"Programming Language :: Python", | ||
"Programming Language :: Python :: 3 :: Only", | ||
"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", | ||
] | ||
dynamic = [ | ||
"version", | ||
] | ||
dependencies = [ | ||
"rdmo" | ||
] | ||
|
||
[project.optional-dependencies] | ||
ci = [ | ||
"coveralls~=3.3", | ||
"rdmo-plugins[dev]", | ||
] | ||
dev = [ | ||
"pre-commit~=3.5", | ||
"rdmo[allauth]", | ||
"rdmo-plugins[pytest]", | ||
] | ||
pytest = [ | ||
"pytest~=7.4", | ||
"pytest-cov~=4.1", | ||
"pytest-django~=4.5", | ||
"pytest-mock~=3.11", | ||
"pytest-randomly~=3.15", | ||
"pytest-xdist~=3.3", | ||
] | ||
|
||
[project.urls] | ||
documentation = "https://rdmo.readthedocs.io" | ||
homepage = "https://rdmorganiser.github.io" | ||
issues = "https://github.com/rdmorganiser/rdmo-plugins/issues" | ||
repository = "https://github.com/rdmorganiser/rdmo-plugins.git" | ||
slack = "https://rdmo.slack.com" | ||
|
||
[tool.setuptools.packages.find] | ||
include = ["rdmo_plugins*"] | ||
|
||
[tool.setuptools.package-data] | ||
"*" = ["*"] | ||
|
||
[tool.setuptools.dynamic] | ||
version = {attr = "rdmo_plugins.__version__"} | ||
|
||
[tool.ruff] | ||
target-version = "py38" | ||
line-length = 120 | ||
select = [ | ||
"B", # flake8-bugbear | ||
"C4", # flake8-comprehensions | ||
"E", # pycodestyle | ||
"F", # pyflakes | ||
"I", # isort | ||
"PGH", # pygrep-hooks | ||
"RUF", # ruff | ||
"UP", # pyupgrade | ||
"W", # pycodestyle | ||
"YTT", # flake8-2020 | ||
] | ||
ignore = [ | ||
"B006", # mutable-argument-default | ||
"B007", # unused-loop-control-variable | ||
"B018", # useless-expression | ||
"RUF012", # mutable-class-default | ||
] | ||
|
||
[tool.ruff.isort] | ||
known-first-party = ["rdmo"] | ||
section-order = [ | ||
"future", | ||
"standard-library", | ||
"pytest", | ||
"django", | ||
"third-party", | ||
"first-party", | ||
"local-folder" | ||
] | ||
|
||
[tool.ruff.isort.sections] | ||
pytest = ["pytest"] | ||
django = ["django"] | ||
|
||
[tool.pytest.ini_options] | ||
DJANGO_SETTINGS_MODULE = "config.settings" | ||
testpaths = ["tests"] | ||
pythonpath = [".", "tests"] | ||
addopts = "-p no:randomly" | ||
filterwarnings = [ | ||
# fail on RemovedInDjango50Warning exception | ||
"error::django.utils.deprecation.RemovedInDjango50Warning", | ||
|
||
# ignore warnings raised from within coreapi 2.3.3 | ||
"ignore:'cgi' is deprecated and slated for removal in Python 3.13:DeprecationWarning", | ||
"ignore:pkg_resources is deprecated as an API:DeprecationWarning", | ||
|
||
# ignore warnings raised from within django itself | ||
# django/core/files/storage/__init__.py | ||
"ignore:django.core.files.storage.get_storage_class is deprecated:django.utils.deprecation.RemovedInDjango51Warning", | ||
] | ||
|
||
[tool.coverage.run] | ||
source = ["rdmo"] | ||
branch = true | ||
parallel = true | ||
|
||
[tool.coverage.report] | ||
exclude_lines = [ | ||
"raise Exception", | ||
"except ImportError:" | ||
] |
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,8 +1 @@ | ||
__title__ = 'rdmo-plugins' | ||
__version__ = '1.0.0' | ||
__author__ = 'Jochen Klar' | ||
__email__ = '[email protected]' | ||
__license__ = 'Apache-2.0' | ||
__copyright__ = 'Copyright 2020 RDMO-Arbeitsgemeinschaft' | ||
|
||
VERSION = __version__ | ||
VERSION = __version__ = "1.0.0" |
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
Oops, something went wrong.