Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testmerge #21

Closed
wants to merge 11 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
/backend_addon/ @ericof
/frontend_addon/ @sneridagh
/project/ @ericof
/sub/cache/ @ericof
/sub/frontend_project/ @sneridagh
/sub/project_settings/ @sneridagh
40 changes: 40 additions & 0 deletions .github/workflows/all_templates.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: cookieplone-templates CI
on:
push:
workflow_dispatch:

jobs:

generation:

runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
python-version:
- "3.10"
- "3.11"
- "3.12"

steps:
# git checkout
- name: Checkout codebase
uses: actions/checkout@v4

# python setup
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'

# python install
- name: Install dependencies
run: |
pip install -r requirements.txt

# Test
- name: Run tests
run: |
python -m pytest tests
44 changes: 44 additions & 0 deletions .github/workflows/project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Plone Project CI
on:
push:
paths:
- "project/**"
- ".github/workflows/project.yml"
workflow_dispatch:

jobs:

generation:

runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
python-version:
- "3.10"
- "3.11"
- "3.12"

steps:
# git checkout
- name: Checkout codebase
uses: actions/checkout@v4

# python setup
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'

# python install
- name: Install dependencies
run: |
pip install -r requirements.txt

# Test
- name: Run tests
run: |
cd project
python -m pytest tests
47 changes: 47 additions & 0 deletions .github/workflows/sub_cache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Plone Cache Settings CI
on:
push:
paths:
- "sub/cache_settings/**"
- ".github/workflows/sub_cache_settings.yml"
workflow_dispatch:

env:
PYTHON_VERSION: "3.10"

jobs:

generation:

runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
python-version:
- "3.10"
- "3.11"
- "3.12"

steps:
# git checkout
- name: Checkout codebase
uses: actions/checkout@v4

# python setup
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'

# python install
- name: Install dependencies
run: |
pip install -r requirements.txt

# Test
- name: Run tests
run: |
cd sub/cache_settings
python -m pytest tests
47 changes: 47 additions & 0 deletions .github/workflows/sub_project_settings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Plone Project Settings CI
on:
push:
paths:
- "sub/project_settings/**"
- ".github/workflows/sub_project_settings.yml"
workflow_dispatch:

env:
PYTHON_VERSION: "3.10"

jobs:

generation:

runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
python-version:
- "3.10"
- "3.11"
- "3.12"

steps:
# git checkout
- name: Checkout codebase
uses: actions/checkout@v4

# python setup
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'

# python install
- name: Install dependencies
run: |
pip install -r requirements.txt

# Test
- name: Run tests
run: |
cd sub/project_settings
python -m pytest tests
9 changes: 8 additions & 1 deletion .scripts/report_keys_usage.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,14 @@

report_filename = f"{date.today()}-{last_commit.hexsha[:7]}-usage.json"

folders = ["backend_addon", "frontend_addon"]
folders = [
"backend_addon",
"frontend_addon",
"project",
"sub/cache",
"sub/frontend_project",
"sub/project_settings",
]
ignore = [
"__prompts__",
]
Expand Down
26 changes: 18 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ GREEN=`tput setaf 2`
RESET=`tput sgr0`
YELLOW=`tput setaf 3`

TOP_LEVEL_TEMPLATES = backend_addon frontend_addon project
SUB_TEMPLATES = cache frontend_project project_settings

.PHONY: all
all: bin/cookieplone

Expand All @@ -31,18 +34,25 @@ bin/cookieplone: ## Create virtualenv and install dependencies
.PHONY: format
format: bin/cookieplone ## Format code
@echo "$(GREEN)==> Formatting codebase $(RESET)"
bin/black hooks .scripts
bin/isort hooks .scripts
$(MAKE) -C "./backend_addon/" format
$(MAKE) -C "./frontend_addon/" format
$(MAKE) -C "./sub/frontend_project/" format
bin/black hooks .scripts tests
bin/isort hooks .scripts tests
$(foreach project,$(TOP_LEVEL_TEMPLATES),$(MAKE) -C "./$(project)/" format ;)
$(foreach project,$(SUB_TEMPLATES),$(MAKE) -C "./sub/$(project)/" format ;)

.PHONY: test
test: bin/cookieplone ## Test all cookiecutters
@echo "$(GREEN)==> Test all cookiecutters$(RESET)"
$(MAKE) -C "./backend_addon/" test
$(MAKE) -C "./frontend_addon/" test
$(MAKE) -C "./sub/frontend_project/" test
bin/python3 -m pytest tests
$(foreach project,$(TOP_LEVEL_TEMPLATES),$(MAKE) -C "./$(project)/" test ;)
$(foreach project,$(SUB_TEMPLATES),$(MAKE) -C "./sub/$(project)/" test ;)

.PHONY: test-pdb
test-pdb: bin/cookieplone ## Test all cookiecutters (and stop on error)
@echo "$(GREEN)==> Test all cookiecutters (and stop on error)$(RESET)"
bin/python3 -m pytest tests -x --pdb
$(foreach project,$(TOP_LEVEL_TEMPLATES),$(MAKE) -C "./$(project)/" test-pdb ;)
$(foreach project,$(SUB_TEMPLATES),$(MAKE) -C "./sub/$(project)/" test-pdb ;)


.PHONY: report-context
report-context: bin/cookieplone ## Generate a report of all context options
Expand Down
34 changes: 22 additions & 12 deletions backend_addon/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ YELLOW=`tput setaf 3`
.PHONY: all
all: build

TEMPLATE = $(shell basename $(CURRENT_DIR))
ADDON_FOLDER_NAME = collective.addon
BASE_FOLDER = ../
BIN_FOLDER = ${BASE_FOLDER}/bin


# Add the following 'help' target to your Makefile
# And add help text after each target name starting with '\#\#'
Expand All @@ -21,24 +26,29 @@ help: ## This help message

.PHONY: clean
clean: ## Clean
rm -rf collective.addon
rm -rf volto-addon

../bin/cookieplone: ## cookieplone installation
$(MAKE) -C ".." bin/cookieplone
$(BIN_FOLDER)/cookieplone: ## cookieplone installation
$(MAKE) -C $(BASE_FOLDER) bin/cookieplone

.PHONY: format
format: ../bin/cookieplone ## Format code
format: $(BIN_FOLDER)/cookieplone ## Format code
@echo "$(GREEN)==> Formatting codebase $(RESET)"
../bin/black hooks tests
../bin/isort hooks tests
$(BIN_FOLDER)/black hooks tests
$(BIN_FOLDER)/isort hooks tests

.PHONY: generate
generate: ../bin/cookieplone ## Create a sample package
generate: $(BIN_FOLDER)/cookieplone ## Create a sample package
@echo "$(GREEN)==> Creating new test package$(RESET)"
rm -rf collective.addon
../bin/cookieplone . --no-input
rm -rf $(ADDON_FOLDER_NAME)
COOKIEPLONE_REPOSITORY=$(BASE_FOLDER) $(BIN_FOLDER)/cookieplone $(TEMPLATE) --no_input

.PHONY: test
test: ../bin/cookieplone ## Create a sample package and tests it
@echo "$(GREEN)==> Creating new test package$(RESET)"
../bin/python -m pytest tests
test: $(BIN_FOLDER)/cookieplone ## Create a sample package and tests it
@echo "$(GREEN)==> Test template$(RESET)"
$(BIN_FOLDER)/python -m pytest tests

.PHONY: test-pdb
test-pdb: $(BIN_FOLDER)/cookieplone ## Stop on the first failed test
@echo "$(GREEN)==> Test template, stop on first error$(RESET)"
$(BIN_FOLDER)/python -m pytest tests -x --pdb
7 changes: 6 additions & 1 deletion backend_addon/cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,15 @@
"__package_namespace": "{{ cookiecutter.python_package_name | package_namespace }}",
"__folder_name": "{{ cookiecutter.python_package_name }}",
"__python_package_name_upper": "{{ cookiecutter.python_package_name | pascal_case }}",
"__profile_language": "en",
"__version_package": "1.0.0a0",
"__profile_version": "1000",
"__gha_enable": true,
"__generator_date_short": "{% now 'utc', '%Y-%m-%d' %}",
"__generator_date_long": "{% now 'utc', '%Y-%m-%d %H:%M:%S' %}",
"__generator_signature": "This was generated by [cookiecutter-plone](https://github.com/plone/cookieplone-templates/backend_addon) on {{ cookiecutter.__generator_date_long }}",
"__backend_addon_git_initialize": "1",
"__backend_addon_format": "1",
"__prompts__": {
"title": "Addon Title",
"description": "A short description of your addon",
Expand All @@ -37,5 +40,7 @@
"cookieplone.filters.pascal_case",
"cookieplone.filters.package_name",
"cookieplone.filters.package_namespace"
]
],
"__cookieplone_repository_path": "",
"__cookieplone_template": ""
}
Loading