Skip to content
Merged
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
16 changes: 16 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: 2
updates:

- package-ecosystem: "github-actions"
directory: "/"
schedule:
# Check for updates to GitHub Actions every week
interval: "weekly"
cooldown:
default-days: 7
# Dependabot never writes news fragments, so exempt its pull requests from
# the changelog check. Both labels must exist in the repository, otherwise
# they are silently ignored.
labels:
- "dependencies"
- "skip changelog"
143 changes: 37 additions & 106 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
@@ -1,45 +1,22 @@
name: Changelog check
name: "Changelog"
on:
pull_request:
types: [assigned, opened, synchronize, reopened, labeled, unlabeled]
branches:
- main

env:
NODE_VERSION: 24.x
ADDON_NAME: kitconcept-intranet
BASE_BRANCH: main
python-version: 3.14
base-branch: main

jobs:
config:
runs-on: ubuntu-latest
outputs:
backend: ${{ steps.filter.outputs.backend }}
frontend: ${{ steps.filter.outputs.frontend }}
repository: ${{ steps.filter.outputs.repository }}
steps:
- name: Checkout
uses: actions/checkout@v7

- uses: dorny/paths-filter@v4
id: filter
with:
filters: |
backend:
- 'backend/**'
repository:
- '.github/**'
- '.vscode/**'
- 'devops/**'
- 'docs/**'
- 'docker-compose.yml'
- 'README.md'
frontend:
- 'frontend/**'
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip changelog') }}
uses: ./.github/workflows/config.yml

backend:
if: ${{ needs.config.outputs.backend == 'true' }}
checks:
runs-on: ubuntu-latest
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip changelog') }}
needs:
- config
steps:
Expand All @@ -48,88 +25,42 @@ jobs:
# Fetch all history
fetch-depth: '0'

- name: Install pipx
run: pip install towncrier

- name: Check for presence of a Change Log fragment (only pull requests)
if: github.event_name == 'pull_request'
run: |
# Fetch the pull request' base branch so towncrier will be able to
# compare the current branch with the base branch.
# Source: https://github.com/actions/checkout/#fetch-all-branches.
git fetch --no-tags origin ${BASE_BRANCH}
towncrier check --compare-with origin/${{ env.BASE_BRANCH }} --config backend/pyproject.toml --dir backend/

frontend:
if: ${{ needs.config.outputs.frontend == 'true' }}
runs-on: ubuntu-latest
needs:
- config
defaults:
run:
working-directory: ./frontend
steps:
- uses: actions/checkout@v7
- name: Setup uv
uses: plone/meta/.github/actions/setup_uv@2.x
with:
# Fetch all history
fetch-depth: '0'
python-version: ${{ env.python-version }}
working-directory: '.'

- name: Install pipx
run: pip install towncrier

- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v6
with:
node-version: ${{ env.NODE_VERSION }}

- name: Enable corepack
run: npm i -g corepack@latest && corepack enable

- name: Get pnpm store directory
shell: bash
- name: "Fetch base branch"
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV

- uses: actions/cache@v6
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
git fetch --no-tags origin ${{ env.base-branch }}

- name: Install dependencies
run: make install

- name: Check for presence of a Change Log fragment (only pull requests)
if: github.event_name == 'pull_request'
- name: "Backend: Check"
id: backend-changelog
if: ${{ always() && needs.config.outputs.changelog-backend == 'true' }}
run: |
# Fetch the pull request' base branch so towncrier will be able to
# compare the current branch with the base branch.
# Source: https://github.com/actions/checkout/#fetch-all-branches.
git fetch --no-tags origin ${BASE_BRANCH}
cd ..
towncrier check --compare-with origin/${{ env.BASE_BRANCH }} --config frontend/packages/${{ env.ADDON_NAME }}/towncrier.toml --dir frontend/packages/${{ env.ADDON_NAME }}
git fetch --no-tags origin ${{ env.base-branch }}
uvx towncrier check --compare-with origin/${{ env.base-branch }} --config backend/pyproject.toml --dir backend/

repository:
if: ${{ needs.config.outputs.repository == 'true' }}
runs-on: ubuntu-latest
needs:
- config
steps:
- uses: actions/checkout@v7
with:
# Fetch all history
fetch-depth: '0'
- name: "Frontend: Check"
id: frontend-changelog
if: ${{ always() && needs.config.outputs.changelog-frontend == 'true' }}
run: |
git fetch --no-tags origin ${{ env.base-branch }}
uvx towncrier check --compare-with origin/${{ env.base-branch }} --config ${{ needs.config.outputs.path-frontend }}/towncrier.toml --dir ${{ needs.config.outputs.path-frontend }}

- name: Install pipx
run: pip install towncrier
- name: "Repository: Check"
id: repository-changelog
if: ${{ always() && needs.config.outputs.changelog-repository == 'true' }}
run: |
git fetch --no-tags origin ${{ env.base-branch }}
uvx towncrier check --compare-with origin/${{ env.base-branch }} --config ${{ needs.config.outputs.path-root }}/towncrier.toml --dir ${{ needs.config.outputs.path-root }}

- name: Check for presence of a Change Log fragment (only pull requests)
if: github.event_name == 'pull_request'
- name: "Report check"
run: |
# Fetch the pull request' base branch so towncrier will be able to
# compare the current branch with the base branch.
# Source: https://github.com/actions/checkout/#fetch-all-branches.
git fetch --no-tags origin ${BASE_BRANCH}
towncrier check --compare-with origin/${{ env.BASE_BRANCH }} --config towncrier.toml --dir .
echo '# Workflow Report' >> $GITHUB_STEP_SUMMARY
echo '| Job ID | Conclusion |' >> $GITHUB_STEP_SUMMARY
echo '| --- | --- |' >> $GITHUB_STEP_SUMMARY
echo '| backend | ${{ steps.backend-changelog.conclusion }} |' >> $GITHUB_STEP_SUMMARY
echo '| frontend | ${{ steps.frontend-changelog.conclusion }} |' >> $GITHUB_STEP_SUMMARY
echo '| repository | ${{ steps.repository-changelog.conclusion }} |' >> $GITHUB_STEP_SUMMARY
70 changes: 63 additions & 7 deletions .github/workflows/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ on:
value: ${{ jobs.config.outputs.base-tag }}
image-name-prefix:
description: "Image name prefix for container images"
value: ${{ inputs.image-name-prefix }}
value: ${{ jobs.config.outputs.image-name-prefix }}
node-version:
description: "Node version to be used"
value: ${{ inputs.node-version }}
Expand Down Expand Up @@ -79,6 +79,24 @@ on:
stack-prefix:
description: "Deploy: Short name to be used to create Traefik labels"
value: ${{ inputs.stack-prefix }}
changelog-backend:
description: "Flag reporting if we should run changelog jobs for the backend"
value: ${{ jobs.config.outputs.changelog-backend }}
changelog-frontend:
description: "Flag reporting if we should run changelog jobs for the frontend"
value: ${{ jobs.config.outputs.changelog-frontend }}
changelog-repository:
description: "Flag reporting if we should run changelog jobs for the repository"
value: ${{ jobs.config.outputs.changelog-repository }}
path-backend:
description: "Path to the backend package, relative to the repository root"
value: ${{ jobs.config.outputs.path-backend }}
path-frontend:
description: "Path to the frontend package, relative to the repository root"
value: ${{ jobs.config.outputs.path-frontend }}
path-root:
description: "Path to the repository root"
value: ${{ jobs.config.outputs.path-root }}

jobs:
config:
Expand All @@ -90,27 +108,48 @@ jobs:
docs: ${{ steps.filter.outputs.docs }}
frontend: ${{ steps.filter.outputs.frontend }}
deploy: ${{ steps.filter.outputs.deploy }}
base-tag: ${{ steps.vars.outputs.BASE_TAG }}
base-tag: ${{ steps.vars.outputs.base-tag }}
kc-version: ${{ steps.vars.outputs.kc-version }}
volto-version: ${{ steps.vars.outputs.volto-version }}
environment: ${{ steps.vars.outputs.environment }}
stack-name: ${{ steps.vars.outputs.stack-name }}
image-name-prefix: ${{ steps.vars.outputs.image-name-prefix }}
changelog-backend: ${{ steps.filter.outputs.changelog-backend }}
changelog-frontend: ${{ steps.filter.outputs.changelog-frontend }}
changelog-repository: ${{ steps.filter.outputs.changelog-repository }}
path-backend: ${{ steps.vars.outputs.path-backend }}
path-frontend: ${{ steps.vars.outputs.path-frontend }}
path-root: ${{ steps.vars.outputs.path-root }}

steps:
- name: Checkout
uses: actions/checkout@v7

- name: Setup uv
uses: plone/meta/.github/actions/setup_uv@2.x
with:
python-version: ${{ inputs.python-version }}
working-directory: '.'

- name: Compute several vars needed for the CI
id: vars
run: |
echo "BASE_TAG=sha-$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
echo "kc-version=$(cat backend/version.txt)" >> $GITHUB_OUTPUT
python3 -c 'import json; data = json.load(open("./frontend/mrs.developer.json")); print("volto-version=" + (data["core"].get("tag") or "latest"))' >> $GITHUB_OUTPUT
REPOSITORY_SETTINGS="$(uvx repoplone settings dump)"
# `repoplone` reports absolute paths, but the checks need them
# relative to the repository root.
ROOT="$(jq -r '.root_path' <<< "$REPOSITORY_SETTINGS")"
echo "base-tag=sha-$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
echo "image-name-prefix=$(jq -r '.container_images_prefix' <<< "$REPOSITORY_SETTINGS")" >> "$GITHUB_OUTPUT"
echo "kc-version=$(jq -r '.backend.base_package_version' <<< "$REPOSITORY_SETTINGS")" >> "$GITHUB_OUTPUT"
echo "volto-version=$(jq -r '.frontend.volto_version' <<< "$REPOSITORY_SETTINGS")" >> "$GITHUB_OUTPUT"
echo "path-backend=$(jq -r '.backend.path' <<< "$REPOSITORY_SETTINGS" | sed "s|^${ROOT}/||")" >> "$GITHUB_OUTPUT"
echo "path-frontend=$(jq -r '.frontend.path' <<< "$REPOSITORY_SETTINGS" | sed "s|^${ROOT}/||")" >> "$GITHUB_OUTPUT"
echo "path-root=." >> "$GITHUB_OUTPUT"
environment=${{ inputs.hostname }}
echo "environment=${environment}" >> $GITHUB_OUTPUT
echo "stack-name=${environment//./-}" >> $GITHUB_OUTPUT

- uses: dorny/paths-filter@v4
- uses: dorny/paths-filter@v4.0.3
id: filter
with:
filters: |
Expand Down Expand Up @@ -141,12 +180,26 @@ jobs:
- '.github/workflows/frontend*'
- '.github/workflows/main*'
- 'devops/**'
changelog-backend:
- 'backend/**'
changelog-frontend:
- 'frontend/**'
changelog-repository:
- '.github/**'
- '.vscode/**'
- 'devops/**'
- 'docs/**'
- 'docker-compose.yml'
- 'README.md'

- name: Test vars
run: |
echo "BASE_TAG: ${{ steps.vars.outputs.BASE_TAG }}"
echo "BASE_TAG: ${{ steps.vars.outputs.base-tag }}"
echo 'kc-version: ${{ steps.vars.outputs.kc-version }}'
echo 'volto-version: ${{ steps.vars.outputs.volto-version }}'
echo 'path-backend: ${{ steps.vars.outputs.path-backend }}'
echo 'path-frontend: ${{ steps.vars.outputs.path-frontend }}'
echo 'path-root: ${{ steps.vars.outputs.path-root }}'
echo 'environment: ${{ steps.vars.outputs.environment }}'
echo 'stack-name: ${{ steps.vars.outputs.stack-name }}'
echo 'event-name: ${{ github.event_name }}'
Expand All @@ -156,3 +209,6 @@ jobs:
echo 'Paths - devops: ${{ steps.filter.outputs.devops }}'
echo 'Paths - docs: ${{ steps.filter.outputs.docs }}'
echo 'Paths - frontend: ${{ steps.filter.outputs.frontend }}'
echo 'Paths - changelog-backend: ${{ steps.filter.outputs.changelog-backend }}'
echo 'Paths - changelog-frontend: ${{ steps.filter.outputs.changelog-frontend }}'
echo 'Paths - changelog-repository: ${{ steps.filter.outputs.changelog-repository }}'
2 changes: 0 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
"eslint.workingDirectories": ["./frontend"],
"python.defaultInterpreterPath": "${workspaceFolder}/backend/.venv/bin/python",
"python-envs.workspaceSearchPaths": [
".venv",
"*/.venv",
"backend/.venv"
],
"ruff.organizeImports": true,
Expand Down
8 changes: 0 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,6 @@ all: install
help: ## This help message
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

###########################################
# Volto Plate
###########################################
.PHONY: update-volto-plate
update-volto-plate: ## Update Volto Plate
@echo "Update Volto Plate"
@uv run scripts/update-volto-plate.py

###########################################
# Frontend
###########################################
Expand Down
4 changes: 0 additions & 4 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
ARG KC_VERSION
FROM ghcr.io/kitconcept/core-builder:${KC_VERSION:-latest} AS builder

# Copy only the files needed for installing dependencies first to leverage Docker cache
# In this case, kitconcept-plate
COPY ./container /container

# Install dependencies
RUN --mount=type=cache,target=/root/.cache \
--mount=type=bind,source=uv.lock,target=uv.lock \
Expand Down
4 changes: 0 additions & 4 deletions backend/Dockerfile.acceptance
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
ARG KC_VERSION=latest
FROM ghcr.io/kitconcept/core-builder:${KC_VERSION} AS builder

# Copy only the files needed for installing dependencies first to leverage Docker cache
# In this case, kitconcept-plate
COPY ./container /container

# Install dependencies
RUN --mount=type=cache,target=/root/.cache \
--mount=type=bind,source=uv.lock,target=uv.lock \
Expand Down
Binary file removed backend/container/kitconcept-plate.tar.gz
Binary file not shown.
File renamed without changes.
1 change: 1 addition & 0 deletions backend/news/593.internal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Depend on the released `kitconcept.plate` 1.0.0a23 from PyPI instead of the source distribution vendored in `container/`. @ericof
7 changes: 3 additions & 4 deletions backend/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ dependencies = [
"collective-solr==10.1.1",
"kitconcept.solr",
"kitconcept.contactblock==1.0.0a6",
"kitconcept-plate",
"kitconcept.plate==1.0.0a23",
]

[dependency-groups]
Expand Down Expand Up @@ -66,7 +66,6 @@ container = [
]

[tool.uv.sources]
kitconcept-plate = { path = "container/kitconcept-plate.tar.gz" }
kitconcept-solr = { git = "https://github.com/kitconcept/kitconcept.solr.git", subdirectory = "backend", rev = "a8953cefb2d250bb83213bef0099ffceda87dc78" }

[tool.hatch.metadata]
Expand Down Expand Up @@ -157,8 +156,8 @@ name = "Documentation"
showcontent = true

[[tool.towncrier.type]]
directory = "test"
name = "Test"
directory = "tests"
name = "Tests"
showcontent = true

[tool.ruff]
Expand Down
Loading
Loading