Skip to content

Commit f86b300

Browse files
committed
GHA: Use plone/meta shared workflows (Fixes #102)
1 parent d53a272 commit f86b300

8 files changed

Lines changed: 140 additions & 193 deletions

File tree

.github/workflows/changelog.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,12 @@ jobs:
1717
# Fetch all history
1818
fetch-depth: '0'
1919

20-
- name: Install the latest version of uv
21-
uses: astral-sh/setup-uv@v5
20+
- name: Setup uv
21+
uses: plone/meta/.github/actions/setup_uv@2.x
2222
with:
2323
python-version: ${{ env.python-version }}
24-
2524
- name: Check for presence of a Change Log fragment (only pull requests)
2625
if: github.event_name == 'pull_request'
27-
env:
28-
BASE_BRANCH: ${{ github.base_ref }}
2926
run: |
30-
git fetch --no-tags origin ${BASE_BRANCH}
31-
uvx towncrier check --compare-with origin/${{ env.BASE_BRANCH }} --config pyproject.toml --dir .
27+
git fetch --no-tags origin ${{ github.base_ref }}
28+
uvx towncrier check --compare-with origin/${{ github.base_ref }} --config pyproject.toml --dir .

.github/workflows/ci.yml

Lines changed: 0 additions & 150 deletions
This file was deleted.

.github/workflows/config.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: 'Compute Config variables'
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
python-version:
7+
required: false
8+
type: string
9+
default: "3.12"
10+
plone-version:
11+
required: false
12+
type: string
13+
default: "6.1.1"
14+
outputs:
15+
backend:
16+
description: "Flag reporting if we should run the backend jobs"
17+
value: ${{ jobs.config.outputs.backend }}
18+
docs:
19+
description: "Flag reporting if we should run the docs jobs"
20+
value: ${{ jobs.config.outputs.docs }}
21+
base-tag:
22+
description: "Base tag to be used when creating container images"
23+
value: ${{ jobs.config.outputs.base-tag }}
24+
python-version:
25+
description: "Python version to be used"
26+
value: ${{ inputs.python-version }}
27+
plone-version:
28+
description: "Plone version to be used"
29+
value: ${{ inputs.plone-version }}
30+
31+
jobs:
32+
config:
33+
runs-on: ubuntu-latest
34+
outputs:
35+
backend: ${{ steps.filter.outputs.backend }}
36+
docs: ${{ steps.filter.outputs.docs }}
37+
base-tag: ${{ steps.vars.outputs.BASE_TAG }}
38+
plone-version: ${{ steps.vars.outputs.plone-version }}
39+
40+
steps:
41+
- name: Checkout
42+
uses: actions/checkout@v4
43+
44+
- name: Compute several vars needed for the CI
45+
id: vars
46+
run: |
47+
echo "base-tag=sha-$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
48+
echo "plone-version=${{ inputs.plone-version }}" >> $GITHUB_OUTPUT
49+
50+
- uses: dorny/paths-filter@v3.0.2
51+
id: filter
52+
with:
53+
filters: |
54+
backend:
55+
- '**'
56+
- '.github/workflows/config.yml'
57+
- '.github/workflows/main.yml'
58+
docs:
59+
- '.readthedocs.yaml'
60+
- 'docs/**'
61+
- '.github/workflows/docs.yaml'
62+
63+
- name: Test vars
64+
run: |
65+
echo "base-tag: ${{ steps.vars.outputs.base-tag }}"
66+
echo 'plone-version: ${{ steps.vars.outputs.plone-version }}'
67+
echo 'event-name: ${{ github.event_name }}'
68+
echo "ref-name: ${{ github.ref_name }}"
69+
echo 'Paths - backend: ${{ steps.filter.outputs.backend }}'
70+
echo 'Paths - docs: ${{ steps.filter.outputs.docs }}'

.github/workflows/main.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: CI pas.plugins.authomatic
2+
3+
on:
4+
push:
5+
6+
jobs:
7+
8+
config:
9+
name: "Compute configuration values"
10+
uses: ./.github/workflows/config.yml
11+
lint:
12+
name: "Lint codebase"
13+
uses: plone/meta/.github/workflows/backend-lint.yml@2.x
14+
needs:
15+
- config
16+
with:
17+
python-version: ${{ needs.config.outputs.python-version }}
18+
plone-version: ${{ needs.config.outputs.plone-version }}
19+
test:
20+
name: "Test codebase"
21+
uses: plone/meta/.github/workflows/backend-pytest.yml@2.x
22+
needs:
23+
- config
24+
strategy:
25+
matrix:
26+
python-version: ["3.13", "3.12", "3.11", "3.10"]
27+
plone-version: ["6.1-latest", "6.0-latest"]
28+
with:
29+
python-version: ${{ matrix.python-version }}
30+
plone-version: ${{ matrix.plone-version }}
31+
32+
coverage:
33+
name: "Backend: Coverage"
34+
uses: plone/meta/.github/workflows/backend-pytest-coverage.yml@2.x
35+
needs:
36+
- config
37+
- test
38+
with:
39+
python-version: ${{ needs.config.outputs.python-version }}
40+
plone-version: ${{ needs.config.outputs.plone-version }}
41+
42+
report:
43+
name: "Final report"
44+
if: ${{ always() }}
45+
runs-on: ubuntu-latest
46+
needs:
47+
- config
48+
- lint
49+
- test
50+
- coverage
51+
steps:
52+
- name: Report
53+
shell: bash
54+
run: |
55+
echo '# Workflow Report' >> $GITHUB_STEP_SUMMARY
56+
echo '| Job ID | Conclusion |' >> $GITHUB_STEP_SUMMARY
57+
echo '| --- | --- |' >> $GITHUB_STEP_SUMMARY
58+
echo '| Config | ${{ needs.config.result }} |' >> $GITHUB_STEP_SUMMARY
59+
echo '| Lint | ${{ needs.coverage.result }} |' >> $GITHUB_STEP_SUMMARY
60+
echo '| Test | ${{ needs.coverage.result }} |' >> $GITHUB_STEP_SUMMARY
61+
echo '| Coverage | ${{ needs.coverage.result }} |' >> $GITHUB_STEP_SUMMARY

Makefile

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,13 @@ else
3131
PLONE_VERSION := 6.1.1
3232
endif
3333

34-
ifdef KEYCLOAK_VERSION
35-
KEYCLOAK_VERSION := $(KEYCLOAK_VERSION)
36-
else
37-
KEYCLOAK_VERSION := 22.0.0
38-
endif
39-
4034
VENV_FOLDER=$(BACKEND_FOLDER)/.venv
4135
BIN_FOLDER=$(VENV_FOLDER)/bin
4236
TESTS_FOLDER=$(BACKEND_FOLDER)/tests
4337

4438
# Environment variables to be exported
4539
export PYTHONWARNINGS := ignore
4640
export DOCKER_BUILDKIT := 1
47-
export KEYCLOAK_VERSION := $(KEYCLOAK_VERSION)
4841

4942
all: build
5043

README.md

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313

1414
[![PyPI - Plone Versions](https://img.shields.io/pypi/frameworkversions/plone/pas.plugins.authomatic)](https://pypi.org/project/pas.plugins.authomatic/)
1515

16-
[![Code analysis checks](https://github.com/collective/pas.plugins.authomatic/actions/workflows/code-analysis.yml/badge.svg)](https://github.com/collective/pas.plugins.authomatic/actions/workflows/code-analysis.yml)
17-
[![Tests](https://github.com/collective/pas.plugins.authomatic/actions/workflows/tests.yaml/badge.svg)](https://github.com/collective/pas.plugins.authomatic/actions/workflows/tests.yaml)
16+
[![CI](https://github.com/collective/pas.plugins.authomatic/actions/workflows/main.yml/badge.svg)](https://github.com/collective/pas.plugins.authomatic/actions/workflows/main.yml)
1817
![Code Style](https://img.shields.io/badge/Code%20Style-Black-000000)
1918

2019
[![GitHub contributors](https://img.shields.io/github/contributors/collective/pas.plugins.authomatic)](https://github.com/collective/pas.plugins.authomatic)
@@ -269,35 +268,10 @@ Towncrier will automatically add a reference to the issue when rendering the CHA
269268

270269
Releasing `pas.plugins.authomatic` is done using a combination of [zest.releaser](https://zestreleaser.readthedocs.io/) and [hatch](https://hatch.pypa.io/latest/).
271270

272-
The release process consists of three steps: **Pre-release**, **Release**, and **Post-release**.
273-
274-
#### Pre-release
275-
Run the following command to populate the `CHANGES.md` file with the entries available in the `news/` directory:
276-
277-
```bash
278-
.venv/bin/prerelease
279-
```
280-
281-
#### Release
282-
283-
1. Create a new Git tag:
284-
```bash
285-
git tag -a {VERSION} -m "Release {VERSION}"
286-
```
287-
2. Build the project:
288-
```bash
289-
hatch build
290-
```
291-
3. Publish the package to PyPI:
292-
```bash
293-
hatch publish
294-
```
295-
296-
#### Post-release
297-
Run the following command to bump the package version, create a new commit, and push all changes to GitHub:
271+
To release the package run:
298272

299273
```bash
300-
.venv/bin/postrelease
274+
make release
301275
```
302276

303277
## License

news/+release.documentation

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Update README file with release instructions. @ericof

news/102.internal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
GHA: Use plone/meta shared workflows. @ericof

0 commit comments

Comments
 (0)