Skip to content

Commit

Permalink
"Create addon: collective.volto.sitesettings"
Browse files Browse the repository at this point in the history
  • Loading branch information
cekk committed Apr 10, 2024
0 parents commit 348688d
Show file tree
Hide file tree
Showing 59 changed files with 2,068 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[report]
include =
src/collective.volto/*
omit =
*/test*
*/upgrades/*
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[*]
indent_style = space
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8

[{*.py,*.cfg}]
indent_size = 4

[{*.html,*.dtml,*.pt,*.zpt,*.xml,*.zcml,*.js}]
indent_size = 2

[Makefile]
indent_style = tab
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CHANGES.rst merge=union
16 changes: 16 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
* collective.volto.sitesettings version:
* Plone Version:
* Python version:
* Operating System: Linux

### Description

Describe what you were trying to get done.
Tell us what happened, what went wrong, and what you expected to happen.

### What I Did

```
Paste the command(s) you ran and the output.
If there was a crash, please include the traceback here.
```
65 changes: 65 additions & 0 deletions .github/workflows/plone-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Plone package

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
plone-version:
- 'Plone52'
- 'Plone60'
python-version: [3.7, 3.8, 3.9]

steps:
- uses: actions/setup-python@v4
with:
python-version: '3.9'
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.cache/pip
~/buildout-cache
~/extends
key: ${{ runner.os }}-tox-${{ matrix.python-version }}-${{ matrix.plone-version }}-${{ hashFiles('**/setup.py') }}-${{ hashFiles('**/requirements.txt') }}-${{ hashFiles('**/*.cfg') }}-${{ hashFiles('**/constraints.txt') }}-${{ hashFiles('**/tox.ini') }}
#restore-keys: |
# ${{ runner.os }}-tox-
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: setup buildout cache
run: |
mkdir -p ~/buildout-cache/{eggs,downloads}
mkdir ~/.buildout
echo "[buildout]" > $HOME/.buildout/default.cfg
echo "download-cache = $HOME/buildout-cache/downloads" >> $HOME/.buildout/default.cfg
echo "eggs-directory = $HOME/buildout-cache/eggs" >> $HOME/.buildout/default.cfg
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
- name: Black-Check
run: |
tox -r -e black-check
- name: Test with tox
run: |
tox -r
env:
PLONE-VERSION: ${{ matrix.plone-version }}
PYTHON-VERSION: ${{ matrix.python-version }}
- name: "Upload coverage to Codecov"
uses: "codecov/codecov-action@v3"
with:
fail_ci_if_error: true
if: matrix.python-version == '3.7'
39 changes: 39 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
.coverage
.coverage.*
*.egg-info
*.log
*.mo
*.py?
*.swp
.*project
# dirs
/.settings/
bin/
buildout-cache/
develop-eggs/
eggs/
htmlcov/
include/
lib/
local/
node_modules/
parts/
dist/*
test.plone_addon/
var/
# files
.installed.cfg
.mr.developer.cfg
coverage.xml
lib64
local.cfg
log.html
output.xml
pip-selfcheck.json
pyvenv.cfg
report.html
.vscode/
.tox/
reports/
venv/
# excludes
71 changes: 71 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# This file is a template, and might need editing before it works on your project.
# Official language image. Look for the different tagged releases at:
# https://hub.docker.com/r/library/plone/tags/
image: python:3.7-buster

# Change pip's cache directory to be inside the project directory since we can
# only cache local items.
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"

# Pip's cache doesn't store the python packages
# https://pip.pypa.io/en/stable/reference/pip_install/#caching
#
# If you want to also cache the installed packages, you have to install
# them in a virtualenv and cache it as well.
cache:
paths:
- .cache/pip
- venv/
- downloads/
- eggs/

# Set execution order: first run jobs on 'test' stage on parallel
# then run jobs on 'report' stage
stages:
- test
- report

before_script:
- echo "deb http://ftp.de.debian.org/debian/ stretch main contrib non-free" >> /etc/apt/sources.list
- apt-get update
- apt-get install -y firefoxdriver
- apt-get install -y xvfb
- python -V # Print out python version for debugging
- pip install virtualenv
- export LC_CTYPE=en_US.UTF-8
- export LC_ALL=en_US.UTF-8
- export LANG=en_US.UTF-8
- python3 -m venv venv
- source venv/bin/activate
- pip install -r requirements.txt
- buildout bootstrap
- bin/buildout -n -c buildout.cfg

code-analysis:
stage: test
# still not available, see: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/5004
# success_with_warnings: True
script:
- tox -e black-check
- tox -e py37-lint

test:
stage: test
script:
- export DISPLAY=:99.0
# - sh -e /etc/init.d/xvfb start
- tox -r

coverage:
stage: report
script:
- bin/createcoverage
- bin/coverage html
- bin/coverage report
when: on_success

coverage: '/TOTAL\s+\d+\s+\d+\s+(\d+\%)/'
artifacts:
paths:
- htmlcov
61 changes: 61 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
dist: bionic
language: python
cache:
pip: true
directories:
- eggs
- $HOME/buildout-cache
- $HOME/.buildout
python:
- "2.7"
matrix:
include:
- python: "2.7"
env: PLONE_VERSION=43
- python: "2.7"
env: PLONE_VERSION=51
- python: "2.7"
env: PLONE_VERSION=52
- python: "3.7"
env: PLONE_VERSION=52
fast_finish: true

before_install:
- mkdir -p $HOME/buildout-cache/{downloads,eggs,extends}
- mkdir -p $HOME/.buildout
- echo "[buildout]" > $HOME/.buildout/default.cfg
- echo "download-cache = $HOME/buildout-cache/downloads" >> $HOME/.buildout/default.cfg
- echo "eggs-directory = $HOME/buildout-cache/eggs" >> $HOME/.buildout/default.cfg
- echo "extends-cache = $HOME/buildout-cache/extends" >> $HOME/.buildout/default.cfg
- echo "abi-tag-eggs = true" >> $HOME/.buildout/default.cfg
- git config --global user.email "travis@travis-ci.org"
- git config --global user.name "Travis CI"
- sudo apt-get install -y firefox-geckodriver
- virtualenv -p `which python` .
- bin/pip install -r requirements.txt -c constraints_plone$PLONE_VERSION.txt
- cp test_plone$PLONE_VERSION.cfg buildout.cfg

install:
- travis_retry pip install -U tox coveralls coverage -c constraints.txt

before_script:
- 'export DISPLAY=:99.0'
- export VERBOSE=true
- Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
- sleep 3

script:
- PYTEST_ADDOPTS="-s -vv" tox

after_success:
- python -m coverage.pickle2json
- coverage combine
- coveralls

notifications:
email:
recipients:
# - travis-reports@plone.com
- {author}
on_success: change
on_failure: change
9 changes: 9 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Changelog
=========


1.0a1 (unreleased)
------------------

- Initial release.
[cekk]
4 changes: 4 additions & 0 deletions CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Contributors
============

- RedTurtle Technology, sviluppo@redturtle.it
76 changes: 76 additions & 0 deletions DEVELOP.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
Using the development buildout
==============================

plonecli
--------

The convenient way, use plonecli build ;)::

$ plonecli build

or with --clear if you want to clean your existing venv::

$ plonecli build --clear

Start your instance::

$ plonecli serve


Without plonecli
----------------

Create a virtualenv in the package::

$ python3 -m venv venv

or with --clear if you want to clean your existing venv::

$ python3 -m venv venv --clear

Install requirements with pip::

$ ./venv/bin/pip install -r requirements.txt

bootstrap your buildout::

$ ./bin/buildout bootstrap

Run buildout::

$ ./bin/buildout

Start Plone in foreground::

$ ./bin/instance fg


Running tests
-------------

$ tox

list all tox environments::

$ tox -l
py27-Plone43
py27-Plone51
py27-Plone52
py37-Plone52
build_instance
code-analysis
lint-py27
lint-py37
coverage-report

run a specific tox env::

$ tox -e py37-Plone52


CI Github-Actions / codecov
---------------------------

The first time you push the repo to github, you might get an error from codecov.
Either you activate the package here: `https://app.codecov.io/gh/collective/+ <https://app.codecov.io/gh/collective/+>`_
Or you just wait a bit, codecov will activate your package automatically.
Loading

0 comments on commit 348688d

Please sign in to comment.