Skip to content

Commit 7b5d950

Browse files
committed
Add Plone 6 compatibility, drop Plone 4 compatibility
Also add uninstall profile Also add tests
1 parent 392888c commit 7b5d950

38 files changed

+724
-485
lines changed

.coveragerc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[report]
2+
include =
3+
src/collective/*
4+
omit =
5+
*/test*
6+
*/upgrades/*

.github/workflows/main.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3+
4+
name: Push tests
5+
# run-name: ${{ github.actor }} push tests
6+
7+
on:
8+
push:
9+
pull_request:
10+
11+
jobs:
12+
test:
13+
runs-on: ubuntu-22.04
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
include:
18+
# - python: 2.7.18
19+
# plone: 4.3
20+
# - python: 3.7.14
21+
# plone: 5.2
22+
# - python: 3.10.11
23+
# plone: "6.0"
24+
- python: 3.13.1
25+
plone: "6.1"
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@v4
29+
- name: Set up pyenv and Python
30+
uses: "gabrielfalcao/pyenv-action@v18"
31+
with:
32+
default: "${{ matrix.python }}"
33+
- name: Setup Env
34+
run: |
35+
pip install --upgrade pip
36+
pip install -r requirements-${{ matrix.plone }}.txt
37+
- name: Cache eggs
38+
uses: actions/cache@v4
39+
env:
40+
cache-name: cache-eggs
41+
with:
42+
path: ~/buildout-cache/eggs
43+
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ matrix.python }}-${{ matrix.plone }}
44+
- name: buildout
45+
run: |
46+
sed -ie "s#test.cfg#test-${{matrix.plone}}.cfg#" gha.cfg
47+
buildout -c gha.cfg annotate
48+
buildout -c gha.cfg
49+
- name: test
50+
run: |
51+
bin/test -t !robot
52+
coverage:
53+
runs-on: ubuntu-22.04
54+
strategy:
55+
fail-fast: false
56+
matrix:
57+
include:
58+
- python: 3.10.11
59+
plone: "6.0"
60+
steps:
61+
- name: Checkout
62+
uses: actions/checkout@v4
63+
- name: Set up pyenv and Python
64+
uses: "gabrielfalcao/pyenv-action@v18"
65+
with:
66+
default: "${{ matrix.python }}"
67+
- name: Setup Env
68+
run: |
69+
pip install --upgrade pip
70+
pip install -r requirements-${{matrix.plone}}.txt
71+
pip install -U coveralls coverage
72+
- name: Cache eggs
73+
uses: actions/cache@v4
74+
env:
75+
cache-name: cache-eggs
76+
with:
77+
path: ~/buildout-cache/eggs
78+
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ matrix.python }}-${{ matrix.plone }}
79+
- name: buildout
80+
run: |
81+
sed -ie "s#test.cfg#test-${{matrix.plone}}.cfg#" gha.cfg
82+
buildout -c gha.cfg
83+
- name: code-analysis
84+
run: |
85+
bin/code-analysis
86+
- name: test coverage
87+
run: |
88+
coverage run bin/test -t !robot
89+
- name: Publish to Coveralls
90+
env:
91+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
92+
run: |
93+
coveralls --service=github

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
*.egg-info
22
*.mo
33
*.pyc
4+
pyvenv.cfg
45
.installed.cfg
56
.mr.developer.cfg
7+
.plone.versioncheck.tracked.json
68
.project
79
.pydevproject
810
.settings/
911
bin/
12+
lib/
1013
develop-eggs/
1114
parts/
1215
src/*

.isort.cfg

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[settings]
2+
force_alphabetical_sort = True
3+
force_single_line = True
4+
lines_after_imports = 2
5+
line_length = 120

Makefile

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
#!/usr/bin/make
2+
# pyenv is a requirement, with 3.10, 3.13 python versions, and virtualenv installed in each version
3+
# plone parameter must be passed to create environment 'make setup plone=6.0' or after a make cleanall
4+
# The original Makefile can be found on https://github.com/IMIO/scripts-buildout
5+
6+
SHELL=/bin/bash
7+
plones=4.3 5.2 6.0 6.1
8+
b_o=
9+
old_plone=$(shell [ -e .plone-version ] && cat .plone-version)
10+
11+
ifeq (, $(shell which pyenv))
12+
$(error "pyenv command not found! Aborting")
13+
endif
14+
15+
ifndef plone
16+
ifeq (,$(filter setup,$(MAKECMDGOALS)))
17+
plone=$(old_plone)
18+
endif
19+
endif
20+
21+
ifneq ($(wildcard bin/instance),)
22+
b_o=-N
23+
endif
24+
25+
ifndef python
26+
ifeq ($(plone),6.0)
27+
python=3.10
28+
endif
29+
ifeq ($(plone),6.1)
30+
python=3.13
31+
endif
32+
endif
33+
34+
all: buildout
35+
36+
.PHONY: help
37+
help:
38+
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n\nTargets:\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-10s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST)
39+
40+
.python-version: ## Setups pyenv version
41+
@pyenv local `pyenv versions |grep " $(python)" |tail -1 |xargs`
42+
@echo "Local pyenv version is `cat .python-version`"
43+
@ if [[ `pyenv which virtualenv` != `pyenv prefix`* ]] ; then echo "You need to install virtualenv in `cat .python-version` pyenv python (pip install virtualenv)"; exit 1; fi
44+
45+
bin/buildout: .python-version ## Setups environment
46+
virtualenv .
47+
./bin/pip install --upgrade pip
48+
./bin/pip install -r requirements-$(plone).txt
49+
@echo "$(plone)" > .plone-version
50+
51+
.PHONY: setup
52+
setup: oneof-plone backup cleanall bin/buildout restore ## Setups environment
53+
54+
.PHONY: buildout
55+
buildout: oneof-plone bin/buildout ## Runs setup and buildout
56+
rm -f .installed.cfg .mr.developer.cfg
57+
bin/buildout -t 5 -c test-$(plone).cfg ${b_o}
58+
59+
.PHONY: test
60+
test: oneof-plone bin/buildout ## run bin/test without robot
61+
# can be run by example with: make test opt='-t "settings"'
62+
bin/test -t \!robot ${opt}
63+
64+
.PHONY: cleanall
65+
cleanall: ## Cleans all installed buildout files
66+
rm -fr bin include lib local share develop-eggs downloads eggs parts .installed.cfg .mr.developer.cfg .python-version pyvenv.cfg
67+
68+
.PHONY: backup
69+
backup: ## Backups db files
70+
@if [ '$(old_plone)' != '' ] && [ -f var/filestorage/Data.fs ]; then mv var/filestorage/Data.fs var/filestorage/Data.fs.$(old_plone); mv var/blobstorage var/blobstorage.$(old_plone); fi
71+
72+
.PHONY: restore
73+
restore: ## Restores db files
74+
@if [ '$(plone)' != '' ] && [ -f var/filestorage/Data.fs.$(plone) ]; then mv var/filestorage/Data.fs.$(plone) var/filestorage/Data.fs; mv var/blobstorage.$(plone) var/blobstorage; fi
75+
76+
.PHONY: which-python
77+
which-python: oneof-plone ## Displays versions information
78+
@echo "current plone = $(old_plone)"
79+
@echo "current python = `cat .python-version`"
80+
@echo "plone var = $(plone)"
81+
@echo "python var = $(python)"
82+
83+
.PHONY: vcr
84+
vcr: ## Shows requirements in checkversion-r.html
85+
@bin/versioncheck -rbo checkversion-r-$(plone).html test-$(plone).cfg
86+
87+
.PHONY: vcn
88+
vcn: ## Shows newer packages in checkversion-n.html
89+
@bin/versioncheck -npbo checkversion-n-$(plone).html test-$(plone).cfg
90+
91+
.PHONY: guard-%
92+
guard-%:
93+
@ if [ "${${*}}" = "" ]; then echo "You must give a value for variable '$*' : like $*=xxx"; exit 1; fi
94+
95+
.PHONY: oneof-%
96+
oneof-%:
97+
@ if ! echo "${${*}s}" | tr " " '\n' |grep -Fqx "${${*}}"; then echo "Invalid '$*' parameter ('${${*}}') : must be one of '${${*}s}'"; exit 1; fi

README.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ Example files structure:
3131
Tests
3232
=====
3333

34-
This add-on is tested using Travis CI. The current status of the add-on is :
35-
36-
.. image:: https://secure.travis-ci.org/collective/collective.dms.batchimport.png
37-
:target: http://travis-ci.org/collective/collective.dms.batchimport
38-
34+
This add-on is tested using Github action. The current status of the add-on is :
3935

36+
.. image:: https://github.com/collective/collective.dms.batchimport/actions/workflows/main.yml/badge.svg
37+
:target: https://github.com/collective/collective.dms.batchimport/actions/workflows/main.yml
38+
.. image:: https://coveralls.io/repos/github/collective/collective.dms.batchimport/badge.svg
39+
:target: https://coveralls.io/github/collective/collective.dms.batchimport

base.cfg

Lines changed: 96 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,103 @@
11
[buildout]
22
package-name = collective.dms.batchimport
33
package-extras = [test]
4+
45
extends =
5-
https://raw.github.com/collective/buildout.plonetest/master/test-4.3.x.cfg
6-
sources.cfg
6+
https://raw.githubusercontent.com/collective/buildout.plonetest/master/qa.cfg
77
checkouts.cfg
8-
versions.cfg
8+
99
extensions =
1010
mr.developer
11-
buildout.dumppickedversions
12-
show-picked-versions = true
11+
plone.versioncheck
12+
13+
parts +=
14+
instance
15+
omelette
16+
ploneversioncheck
17+
createcoverage
18+
robot
19+
# coverage
20+
# test-coverage
21+
# plone-helper-scripts
22+
23+
develop = .
24+
25+
eggs +=
26+
Plone
27+
Pillow
28+
# Products.PDBDebugMode
29+
# collective.profiler
30+
# ipdb
31+
pdbp
32+
# plone.reload
33+
34+
package-extras +=
35+
pdbp
36+
37+
always-checkout = force
38+
39+
[instance]
40+
environment-vars +=
41+
PYTHONBREAKPOINT pdbp.set_trace
42+
eggs +=
43+
${buildout:eggs}
44+
zcml +=
45+
46+
[test]
47+
environment = testenv
48+
initialization +=
49+
os.environ['PYTHONBREAKPOINT'] = 'pdbp.set_trace'
50+
51+
[testenv]
52+
zope_i18n_compile_mo_files = true
53+
54+
[omelette]
55+
recipe = collective.recipe.omelette
56+
eggs = ${test:eggs}
57+
58+
[ploneversioncheck]
59+
recipe = zc.recipe.egg
60+
eggs = plone.versioncheck
61+
62+
[code-analysis]
63+
recipe = plone.recipe.codeanalysis
64+
pre-commit-hook = True
65+
return-status-codes = True
66+
directory = ${buildout:directory}/src/collective/dms/batchimport
67+
flake8-ignore = E123,E124,E501,E126,E127,E128,W391,C901,W503,W504
68+
flake8-extensions =
69+
flake8-isort
70+
71+
[robot]
72+
recipe = zc.recipe.egg
73+
eggs =
74+
Pillow
75+
${test:eggs}
76+
plone.app.robotframework[reload, debug]
77+
78+
[coverage]
79+
recipe = zc.recipe.egg
80+
eggs = coverage
81+
82+
[test-coverage]
83+
recipe = collective.recipe.template
84+
input = inline:
85+
#!/bin/bash
86+
export TZ=UTC
87+
${buildout:directory}/bin/coverage run bin/test $*
88+
${buildout:directory}/bin/coverage html
89+
${buildout:directory}/bin/coverage report -m --fail-under=90
90+
# Fail (exit status 1) if coverage returns exit status 2 (this happens
91+
# when test coverage is below 100%.
92+
output = ${buildout:directory}/bin/test-coverage
93+
mode = 755
94+
95+
[plone-helper-scripts]
96+
recipe = zc.recipe.egg
97+
eggs =
98+
Products.CMFPlone
99+
${instance:eggs}
100+
interpreter = zopepy
101+
scripts =
102+
zopepy
103+
plone-compile-resources

0 commit comments

Comments
 (0)