Skip to content

Commit 989f432

Browse files
committed
Many fixes
1 parent 3c33357 commit 989f432

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+720
-2033
lines changed

.github/workflows/backend.yml

Lines changed: 39 additions & 157 deletions
Original file line numberDiff line numberDiff line change
@@ -18,178 +18,60 @@ on:
1818
plone-version:
1919
required: true
2020
type: string
21-
22-
defaults:
23-
run:
24-
working-directory: backend
21+
working-directory:
22+
required: false
23+
type: string
24+
default: backend
2525

2626
jobs:
2727

2828
lint:
29-
runs-on: ubuntu-latest
30-
steps:
31-
32-
- name: Checkout
33-
uses: actions/checkout@v4
34-
35-
- name: Install the latest version of uv
36-
uses: astral-sh/setup-uv@v5
37-
with:
38-
python-version: ${{ inputs.python-version }}
39-
enable-cache: true
40-
41-
- name: Check formatting
42-
if: ${{ success() || failure() }}
43-
id: ruff-format
44-
run: uvx ruff@latest format --diff
45-
46-
- name: Check lint
47-
if: ${{ success() || failure() }}
48-
id: ruff-lint
49-
run: uvx ruff@latest check --diff
50-
51-
- name: Check XML / ZCML
52-
if: ${{ success() || failure() }}
53-
id: zpretty
54-
run: uvx zpretty@latest --check src
55-
56-
- name: Check Package Metadata
57-
if: ${{ success() || failure() }}
58-
id: pyroma
59-
run: uvx pyroma@latest -d .
60-
61-
- name: Check Python Versions
62-
if: ${{ success() || failure() }}
63-
id: py-versions
64-
run: uvx check-python-versions@latest .
65-
66-
- name: Report
67-
if: ${{ success() || failure() }}
68-
run: |
69-
echo '# Code Analysis' >> $GITHUB_STEP_SUMMARY
70-
echo '| Test | Status |' >> $GITHUB_STEP_SUMMARY
71-
echo '| --- | --- |' >> $GITHUB_STEP_SUMMARY
72-
echo '| Format | ${{ steps.ruff-format.conclusion == 'failure' && '❌' || ' ✅' }} |' >> $GITHUB_STEP_SUMMARY
73-
echo '| Lint | ${{ steps.ruff-lint.conclusion == 'failure' && '❌' || ' ✅' }} |' >> $GITHUB_STEP_SUMMARY
74-
echo '| XML / ZCML | ${{ steps.zpretty.conclusion == 'failure' && '❌' || ' ✅' }} |' >> $GITHUB_STEP_SUMMARY
75-
echo '| Package Metadata | ${{ steps.pyroma.conclusion == 'failure' && '❌' || ' ✅' }} |' >> $GITHUB_STEP_SUMMARY
76-
echo '| Python Versions | ${{ steps.py-versions.conclusion == 'failure' && '❌' || ' ✅' }} |' >> $GITHUB_STEP_SUMMARY
29+
name: "Backend: Lint"
30+
uses: plone/meta/.github/workflows/backend-lint.yml@2.x
31+
with:
32+
python-version: ${{ inputs.python-version }}
33+
plone-version: ${{ inputs.plone-version }}
34+
working-directory: ${{ inputs.working-directory }}
7735

7836
test:
79-
runs-on: ubuntu-latest
80-
env:
81-
PYTHON_VERSION: ${{ inputs.python-version }}
82-
PLONE_VERSION: ${{ inputs.plone-version }}
83-
steps:
84-
85-
- name: Checkout
86-
uses: actions/checkout@v4
87-
88-
- name: Install the latest version of uv
89-
uses: astral-sh/setup-uv@v5
90-
with:
91-
python-version: ${{ inputs.python-version }}
92-
enable-cache: false
93-
94-
- name: Restore uv cache
95-
uses: actions/cache@v4
96-
with:
97-
path: ${{ env.UV_CACHE_DIR }}
98-
key: uv-${{ runner.os }}-${{ inputs.python-version }}-${{ inputs.plone-version }}-${{ hashFiles('pyproject.toml') }}
99-
restore-keys: |
100-
uv-${{ runner.os }}-${{ inputs.python-version }}-${{ inputs.plone-version }}-${{ hashFiles('pyproject.toml') }}
101-
uv-${{ runner.os }}-${{ inputs.python-version }}-${{ inputs.plone-version }}
102-
103-
- name: Install Plone and package
104-
run: make install
105-
106-
- name: Run tests
107-
run: make test
37+
name: "Backend: Test"
38+
uses: plone/meta/.github/workflows/backend-pytest.yml@2.x
39+
strategy:
40+
matrix:
41+
python-version: ["3.13", "3.12", "3.11", "3.10"]
42+
plone-version: ["6.1-latest", "6.0-latest"]
43+
with:
44+
python-version: ${{ matrix.python-version }}
45+
plone-version: ${{ matrix.plone-version }}
46+
working-directory: ${{ inputs.working-directory }}
10847

10948
coverage:
110-
runs-on: ubuntu-latest
49+
name: "Backend: Coverage"
50+
uses: plone/meta/.github/workflows/backend-pytest-coverage.yml@2.x
11151
needs:
11252
- test
113-
steps:
114-
- name: Checkout
115-
uses: actions/checkout@v4
116-
117-
- name: Install the latest version of uv
118-
uses: astral-sh/setup-uv@v5
119-
with:
120-
python-version: ${{ inputs.python-version }}
121-
enable-cache: false
122-
123-
- name: Restore uv cache
124-
uses: actions/cache@v4
125-
with:
126-
path: /tmp/.uv-cache
127-
key: uv-${{ runner.os }}-${{ inputs.python-version }}-${{ inputs.plone-version }}-${{ hashFiles('pyproject.toml') }}
128-
restore-keys: |
129-
uv-${{ runner.os }}-${{ inputs.python-version }}-${{ inputs.plone-version }}-${{ hashFiles('pyproject.toml') }}
130-
uv-${{ runner.os }}-${{ inputs.python-version }}-${{ inputs.plone-version }}
131-
132-
- name: Install Plone and package
133-
run: make install
134-
135-
- name: Run tests
136-
run: make test-coverage
137-
138-
- name: Report Coverage
139-
run: |
140-
echo "# Coverage Report" >> $GITHUB_STEP_SUMMARY
141-
echo "$(uv run coverage report --format markdown)" >> $GITHUB_STEP_SUMMARY
53+
with:
54+
python-version: ${{ inputs.python-version }}
55+
plone-version: ${{ inputs.plone-version }}
56+
working-directory: ${{ inputs.working-directory }}
14257

14358
release:
144-
runs-on: ubuntu-latest
59+
name: "Backend: Build and publish Container Image"
60+
uses: plone/meta/.github/workflows/container-image-build-push.yml@2.x
14561
needs:
14662
- lint
14763
- coverage
14864
permissions:
14965
contents: read
15066
packages: write
151-
152-
steps:
153-
154-
- name: Checkout
155-
uses: actions/checkout@v4
156-
157-
- name: Docker meta
158-
id: meta
159-
uses: docker/metadata-action@v5
160-
with:
161-
images: |
162-
${{ inputs.image-name-prefix }}-${{ inputs.image-name-suffix }}
163-
labels: |
164-
org.label-schema.docker.cmd=docker run -d -p 8080:8080 ${{ inputs.image-name-prefix }}-${{ inputs.image-name-suffix }}:${{ inputs.base-tag }}
165-
flavor:
166-
latest=false
167-
tags: |
168-
type=ref,event=branch
169-
type=sha
170-
type=raw,value=latest,enable={{is_default_branch}}
171-
172-
- name: Set up QEMU
173-
uses: docker/setup-qemu-action@v3
174-
175-
- name: Set up Docker Buildx
176-
uses: docker/setup-buildx-action@v3
177-
178-
- name: Login to Container Registry
179-
uses: docker/login-action@v3
180-
with:
181-
registry: ghcr.io
182-
username: ${{ github.actor }}
183-
password: ${{ secrets.GITHUB_TOKEN }}
184-
185-
- name: Build and push
186-
uses: docker/build-push-action@v6
187-
with:
188-
platforms: linux/amd64
189-
context: backend/
190-
file: backend/Dockerfile
191-
push: ${{ github.event_name != 'pull_request' }}
192-
tags: ${{ steps.meta.outputs.tags }}
193-
labels: ${{ steps.meta.outputs.labels }}
194-
build-args: |
195-
PLONE_VERSION=${{ inputs.plone-version }}
67+
with:
68+
base-tag: ${{ inputs.base-tag }}
69+
image-name-prefix: ${{ inputs.image-name-prefix }}
70+
image-name-suffix: ${{ inputs.image-name-suffix }}
71+
working-directory: ${{ inputs.working-directory }}
72+
build-args: |
73+
PLONE_VERSION=${{ inputs.plone-version }}
74+
push: ${{ github.event_name != 'pull_request' }}
75+
secrets:
76+
username: ${{ github.actor }}
77+
password: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/changelog.yml

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
name: "Changelog"
2+
on:
3+
pull_request:
4+
types: [assigned, opened, synchronize, reopened, labeled, unlabeled]
5+
branches:
6+
- main
7+
8+
env:
9+
NODE_VERSION: 22.x
10+
ADDON_NAME: volto-blog
11+
BASE_BRANCH: main
12+
13+
jobs:
14+
config:
15+
runs-on: ubuntu-latest
16+
outputs:
17+
backend: ${{ steps.filter.outputs.backend }}
18+
frontend: ${{ steps.filter.outputs.frontend }}
19+
repository: ${{ steps.filter.outputs.repository }}
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
24+
- uses: dorny/paths-filter@v3.0.2
25+
id: filter
26+
with:
27+
filters: |
28+
backend:
29+
- 'backend/**'
30+
repository:
31+
- '.github/**'
32+
- '.vscode/**'
33+
- 'devops/**'
34+
- 'docs/**'
35+
- 'docker-compose.yml'
36+
- 'README.md'
37+
frontend:
38+
- 'frontend/**'
39+
40+
backend:
41+
if: ${{ needs.config.outputs.backend == 'true' }}
42+
runs-on: ubuntu-latest
43+
needs:
44+
- config
45+
steps:
46+
- uses: actions/checkout@v4
47+
with:
48+
# Fetch all history
49+
fetch-depth: '0'
50+
51+
- name: Install pipx
52+
run: pip install towncrier
53+
54+
- name: Check for presence of a Change Log fragment (only pull requests)
55+
if: github.event_name == 'pull_request'
56+
run: |
57+
# Fetch the pull request' base branch so towncrier will be able to
58+
# compare the current branch with the base branch.
59+
# Source: https://github.com/actions/checkout/#fetch-all-branches.
60+
git fetch --no-tags origin ${BASE_BRANCH}
61+
towncrier check --compare-with origin/${{ env.BASE_BRANCH }} --config backend/pyproject.toml --dir backend/
62+
63+
frontend:
64+
if: ${{ needs.config.outputs.frontend == 'true' }}
65+
runs-on: ubuntu-latest
66+
needs:
67+
- config
68+
defaults:
69+
run:
70+
working-directory: ./frontend
71+
steps:
72+
- uses: actions/checkout@v4
73+
with:
74+
# Fetch all history
75+
fetch-depth: '0'
76+
77+
- name: Install pipx
78+
run: pip install towncrier
79+
80+
- name: Use Node.js ${{ env.NODE_VERSION }}
81+
uses: actions/setup-node@v4
82+
with:
83+
node-version: ${{ env.NODE_VERSION }}
84+
85+
- name: Enable corepack
86+
run: npm i -g corepack@latest && corepack enable
87+
88+
- name: Get pnpm store directory
89+
shell: bash
90+
run: |
91+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
92+
93+
- uses: actions/cache@v4
94+
name: Setup pnpm cache
95+
with:
96+
path: ${{ env.STORE_PATH }}
97+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
98+
restore-keys: |
99+
${{ runner.os }}-pnpm-store-
100+
101+
- name: Install dependencies
102+
run: make install
103+
104+
- name: Check for presence of a Change Log fragment (only pull requests)
105+
if: github.event_name == 'pull_request'
106+
run: |
107+
# Fetch the pull request' base branch so towncrier will be able to
108+
# compare the current branch with the base branch.
109+
# Source: https://github.com/actions/checkout/#fetch-all-branches.
110+
git fetch --no-tags origin ${BASE_BRANCH}
111+
cd ..
112+
towncrier check --compare-with origin/${{ env.BASE_BRANCH }} --config frontend/packages/${{ env.ADDON_NAME }}/towncrier.toml --dir frontend/packages/${{ env.ADDON_NAME }}
113+
114+
repository:
115+
if: ${{ needs.config.outputs.repository == 'true' }}
116+
runs-on: ubuntu-latest
117+
needs:
118+
- config
119+
steps:
120+
- uses: actions/checkout@v4
121+
with:
122+
# Fetch all history
123+
fetch-depth: '0'
124+
125+
- name: Install pipx
126+
run: pip install towncrier
127+
128+
- name: Check for presence of a Change Log fragment (only pull requests)
129+
if: github.event_name == 'pull_request'
130+
run: |
131+
# Fetch the pull request' base branch so towncrier will be able to
132+
# compare the current branch with the base branch.
133+
# Source: https://github.com/actions/checkout/#fetch-all-branches.
134+
git fetch --no-tags origin ${BASE_BRANCH}
135+
towncrier check --compare-with origin/${{ env.BASE_BRANCH }} --config towncrier.toml --dir .

0 commit comments

Comments
 (0)