diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml index 1a91e93..fd1bbce 100644 --- a/.github/workflows/changelog.yml +++ b/.github/workflows/changelog.yml @@ -17,15 +17,12 @@ jobs: # Fetch all history fetch-depth: '0' - - name: Install the latest version of uv - uses: astral-sh/setup-uv@v5 + - name: Setup uv + uses: plone/meta/.github/actions/setup_uv@2.x with: python-version: ${{ env.python-version }} - - name: Check for presence of a Change Log fragment (only pull requests) if: github.event_name == 'pull_request' - env: - BASE_BRANCH: ${{ github.base_ref }} run: | - git fetch --no-tags origin ${BASE_BRANCH} - uvx towncrier check --compare-with origin/${{ env.BASE_BRANCH }} --config pyproject.toml --dir . + git fetch --no-tags origin ${{ github.base_ref }} + uvx towncrier check --compare-with origin/${{ github.base_ref }} --config pyproject.toml --dir . diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index f52907d..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,150 +0,0 @@ -name: pas.plugins.authomatic CI - -on: - push: - -env: - PYTHON_VERSION: "3.12" - PLONE_VERSION: "6.1.1" - -jobs: - - lint: - runs-on: ubuntu-latest - name: "Lint codebase" - steps: - - - name: Checkout - uses: actions/checkout@v4 - - - name: Install the latest version of uv - uses: astral-sh/setup-uv@v5 - with: - python-version: ${{ env.PYTHON_VERSION }} - enable-cache: true - - - name: Check formatting - if: ${{ success() || failure() }} - id: ruff-format - run: uvx ruff@latest format --diff - - - name: Check lint - if: ${{ success() || failure() }} - id: ruff-lint - run: uvx ruff@latest check --diff - - - name: Check XML / ZCML - if: ${{ success() || failure() }} - id: zpretty - run: uvx zpretty@latest --check src - - - name: Check Package Metadata - if: ${{ success() || failure() }} - id: pyroma - run: uvx pyroma@latest -d . - - - name: Check Python Versions - if: ${{ success() || failure() }} - id: py-versions - run: uvx check-python-versions@latest . - - - name: Report - if: ${{ success() || failure() }} - run: | - echo '# Code Analysis' >> $GITHUB_STEP_SUMMARY - echo '| Test | Status |' >> $GITHUB_STEP_SUMMARY - echo '| --- | --- |' >> $GITHUB_STEP_SUMMARY - echo '| Format | ${{ steps.ruff-format.conclusion == 'failure' && '❌' || ' ✅' }} |' >> $GITHUB_STEP_SUMMARY - echo '| Lint | ${{ steps.ruff-lint.conclusion == 'failure' && '❌' || ' ✅' }} |' >> $GITHUB_STEP_SUMMARY - echo '| XML / ZCML | ${{ steps.zpretty.conclusion == 'failure' && '❌' || ' ✅' }} |' >> $GITHUB_STEP_SUMMARY - echo '| Package Metadata | ${{ steps.pyroma.conclusion == 'failure' && '❌' || ' ✅' }} |' >> $GITHUB_STEP_SUMMARY - echo '| Python Versions | ${{ steps.py-versions.conclusion == 'failure' && '❌' || ' ✅' }} |' >> $GITHUB_STEP_SUMMARY - - test: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - python-version: ['3.10', '3.11', '3.12', '3.13'] - plone-version: ['6.1-latest', '6.0-latest'] - env: - PYTHON_VERSION: ${{ matrix.python-version }} - PLONE_VERSION: ${{ matrix.plone-version }} - steps: - - - name: Checkout - uses: actions/checkout@v4 - - - name: Install the latest version of uv - uses: astral-sh/setup-uv@v5 - with: - python-version: ${{ env.PYTHON_VERSION }} - enable-cache: false - - - name: Restore uv cache - uses: actions/cache@v4 - with: - path: ${{ env.UV_CACHE_DIR }} - key: uv-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ env.PLONE_VERSION }}-${{ hashFiles('pyproject.toml') }} - restore-keys: | - uv-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ env.PLONE_VERSION }}-${{ hashFiles('pyproject.toml') }} - uv-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ env.PLONE_VERSION }} - - - name: Install Plone and package - run: make install - - - name: Run tests - run: make test - - coverage: - runs-on: ubuntu-latest - name: "Test Coverage" - needs: - - test - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Install the latest version of uv - uses: astral-sh/setup-uv@v5 - with: - python-version: ${{ env.PYTHON_VERSION }} - enable-cache: false - - - name: Restore uv cache - uses: actions/cache@v4 - with: - path: /tmp/.uv-cache - key: uv-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ env.PLONE_VERSION }}-${{ hashFiles('pyproject.toml') }} - restore-keys: | - uv-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ env.PLONE_VERSION }}-${{ hashFiles('pyproject.toml') }} - uv-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ env.PLONE_VERSION }} - - - name: Install Plone and package - run: make install - - - name: Run tests - run: make test-coverage - - - name: Report Coverage - run: | - echo "# Coverage Report" >> $GITHUB_STEP_SUMMARY - echo "$(uv run coverage report --format markdown)" >> $GITHUB_STEP_SUMMARY - - report: - runs-on: ubuntu-latest - needs: - - lint - - test - - coverage - steps: - - - name: Report - shell: bash - run: | - echo '# Report' >> $GITHUB_STEP_SUMMARY - echo '| Job | Status |' >> $GITHUB_STEP_SUMMARY - echo '| --- | --- |' >> $GITHUB_STEP_SUMMARY - echo '| Lint | ✅ |' >> $GITHUB_STEP_SUMMARY - echo '| Test | ✅ |' >> $GITHUB_STEP_SUMMARY - echo '| Coverage | ✅ |' >> $GITHUB_STEP_SUMMARY diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml new file mode 100644 index 0000000..8cc08e9 --- /dev/null +++ b/.github/workflows/config.yml @@ -0,0 +1,70 @@ +name: 'Compute Config variables' + +on: + workflow_call: + inputs: + python-version: + required: false + type: string + default: "3.12" + plone-version: + required: false + type: string + default: "6.1.1" + outputs: + backend: + description: "Flag reporting if we should run the backend jobs" + value: ${{ jobs.config.outputs.backend }} + docs: + description: "Flag reporting if we should run the docs jobs" + value: ${{ jobs.config.outputs.docs }} + base-tag: + description: "Base tag to be used when creating container images" + value: ${{ jobs.config.outputs.base-tag }} + python-version: + description: "Python version to be used" + value: ${{ inputs.python-version }} + plone-version: + description: "Plone version to be used" + value: ${{ inputs.plone-version }} + +jobs: + config: + runs-on: ubuntu-latest + outputs: + backend: ${{ steps.filter.outputs.backend }} + docs: ${{ steps.filter.outputs.docs }} + base-tag: ${{ steps.vars.outputs.BASE_TAG }} + plone-version: ${{ steps.vars.outputs.plone-version }} + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Compute several vars needed for the CI + id: vars + run: | + echo "base-tag=sha-$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT + echo "plone-version=${{ inputs.plone-version }}" >> $GITHUB_OUTPUT + + - uses: dorny/paths-filter@v3.0.2 + id: filter + with: + filters: | + backend: + - '**' + - '.github/workflows/config.yml' + - '.github/workflows/main.yml' + docs: + - '.readthedocs.yaml' + - 'docs/**' + - '.github/workflows/docs.yaml' + + - name: Test vars + run: | + echo "base-tag: ${{ steps.vars.outputs.base-tag }}" + echo 'plone-version: ${{ steps.vars.outputs.plone-version }}' + echo 'event-name: ${{ github.event_name }}' + echo "ref-name: ${{ github.ref_name }}" + echo 'Paths - backend: ${{ steps.filter.outputs.backend }}' + echo 'Paths - docs: ${{ steps.filter.outputs.docs }}' diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..3961092 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,61 @@ +name: CI pas.plugins.authomatic + +on: + push: + +jobs: + + config: + name: "Compute configuration values" + uses: ./.github/workflows/config.yml + lint: + name: "Lint codebase" + uses: plone/meta/.github/workflows/backend-lint.yml@2.x + needs: + - config + with: + python-version: ${{ needs.config.outputs.python-version }} + plone-version: ${{ needs.config.outputs.plone-version }} + test: + name: "Test codebase" + uses: plone/meta/.github/workflows/backend-pytest.yml@2.x + needs: + - config + strategy: + matrix: + python-version: ["3.13", "3.12", "3.11", "3.10"] + plone-version: ["6.1-latest", "6.0-latest"] + with: + python-version: ${{ matrix.python-version }} + plone-version: ${{ matrix.plone-version }} + + coverage: + name: "Backend: Coverage" + uses: plone/meta/.github/workflows/backend-pytest-coverage.yml@2.x + needs: + - config + - test + with: + python-version: ${{ needs.config.outputs.python-version }} + plone-version: ${{ needs.config.outputs.plone-version }} + + report: + name: "Final report" + if: ${{ always() }} + runs-on: ubuntu-latest + needs: + - config + - lint + - test + - coverage + steps: + - name: Report + shell: bash + run: | + echo '# Workflow Report' >> $GITHUB_STEP_SUMMARY + echo '| Job ID | Conclusion |' >> $GITHUB_STEP_SUMMARY + echo '| --- | --- |' >> $GITHUB_STEP_SUMMARY + echo '| Config | ${{ needs.config.result }} |' >> $GITHUB_STEP_SUMMARY + echo '| Lint | ${{ needs.coverage.result }} |' >> $GITHUB_STEP_SUMMARY + echo '| Test | ${{ needs.coverage.result }} |' >> $GITHUB_STEP_SUMMARY + echo '| Coverage | ${{ needs.coverage.result }} |' >> $GITHUB_STEP_SUMMARY diff --git a/Makefile b/Makefile index 60a53af..e11c90f 100644 --- a/Makefile +++ b/Makefile @@ -31,12 +31,6 @@ else PLONE_VERSION := 6.1.1 endif -ifdef KEYCLOAK_VERSION -KEYCLOAK_VERSION := $(KEYCLOAK_VERSION) -else -KEYCLOAK_VERSION := 22.0.0 -endif - VENV_FOLDER=$(BACKEND_FOLDER)/.venv BIN_FOLDER=$(VENV_FOLDER)/bin TESTS_FOLDER=$(BACKEND_FOLDER)/tests @@ -44,7 +38,6 @@ TESTS_FOLDER=$(BACKEND_FOLDER)/tests # Environment variables to be exported export PYTHONWARNINGS := ignore export DOCKER_BUILDKIT := 1 -export KEYCLOAK_VERSION := $(KEYCLOAK_VERSION) all: build diff --git a/README.md b/README.md index 8dbfc89..8a12e1a 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,10 @@ -
logo
+
+logo

OAuth2 / OpenId Authentication in Plone

+
+
[![PyPI](https://img.shields.io/pypi/v/pas.plugins.authomatic)](https://pypi.org/project/pas.plugins.authomatic/) @@ -13,8 +16,7 @@ [![PyPI - Plone Versions](https://img.shields.io/pypi/frameworkversions/plone/pas.plugins.authomatic)](https://pypi.org/project/pas.plugins.authomatic/) -[![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) -[![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) +[![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) ![Code Style](https://img.shields.io/badge/Code%20Style-Black-000000) [![GitHub contributors](https://img.shields.io/github/contributors/collective/pas.plugins.authomatic)](https://github.com/collective/pas.plugins.authomatic) @@ -269,35 +271,10 @@ Towncrier will automatically add a reference to the issue when rendering the CHA Releasing `pas.plugins.authomatic` is done using a combination of [zest.releaser](https://zestreleaser.readthedocs.io/) and [hatch](https://hatch.pypa.io/latest/). -The release process consists of three steps: **Pre-release**, **Release**, and **Post-release**. - -#### Pre-release -Run the following command to populate the `CHANGES.md` file with the entries available in the `news/` directory: - -```bash -.venv/bin/prerelease -``` - -#### Release - -1. Create a new Git tag: - ```bash - git tag -a {VERSION} -m "Release {VERSION}" - ``` -2. Build the project: - ```bash - hatch build - ``` -3. Publish the package to PyPI: - ```bash - hatch publish - ``` - -#### Post-release -Run the following command to bump the package version, create a new commit, and push all changes to GitHub: +To release the package run: ```bash -.venv/bin/postrelease +make release ``` ## License diff --git a/news/+release.documentation b/news/+release.documentation new file mode 100644 index 0000000..6aba1f2 --- /dev/null +++ b/news/+release.documentation @@ -0,0 +1 @@ +Update README file with release instructions. @ericof diff --git a/news/102.internal b/news/102.internal new file mode 100644 index 0000000..6e861c9 --- /dev/null +++ b/news/102.internal @@ -0,0 +1 @@ +GHA: Use plone/meta shared workflows. @ericof