From da8ff08c9aa2a0ba30d61d953b4a8195f2a782b9 Mon Sep 17 00:00:00 2001 From: Gil Forcada Codinachs Date: Fri, 14 Feb 2025 14:47:13 +0100 Subject: [PATCH] test --- .github/dependabot.yml | 11 ++++ .github/workflows/meta.yml | 12 ++-- .github/workflows/tests.yml | 57 +++++++++++++++++ .meta.toml | 2 +- tox.ini | 122 +++++++++++++++++++++--------------- 5 files changed, 145 insertions(+), 59 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/tests.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..e5e4522 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +# Generated from: +# https://github.com/plone/meta/tree/main/src/plone/meta/default +# See the inline comments on how to expand/tweak this configuration file +version: 2 +updates: + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + # Check for updates to GitHub Actions every week + interval: "weekly" diff --git a/.github/workflows/meta.yml b/.github/workflows/meta.yml index 667d046..911be0b 100644 --- a/.github/workflows/meta.yml +++ b/.github/workflows/meta.yml @@ -25,17 +25,17 @@ on: jobs: qa: - uses: plone/meta/.github/workflows/qa.yml@main + uses: plone/meta/.github/workflows/qa.yml@2.x test: - uses: plone/meta/.github/workflows/test.yml@main + uses: plone/meta/.github/workflows/test.yml@2.x coverage: - uses: plone/meta/.github/workflows/coverage.yml@main + uses: plone/meta/.github/workflows/coverage.yml@2.x dependencies: - uses: plone/meta/.github/workflows/dependencies.yml@main + uses: plone/meta/.github/workflows/dependencies.yml@2.x release_ready: - uses: plone/meta/.github/workflows/release_ready.yml@main + uses: plone/meta/.github/workflows/release_ready.yml@2.x circular: - uses: plone/meta/.github/workflows/circular.yml@main + uses: plone/meta/.github/workflows/circular.yml@2.x ## # To modify the list of default jobs being created add in .meta.toml: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..f81ec1b --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,57 @@ +# Generated from: +# https://github.com/plone/meta/tree/main/src/plone/meta/default +# See the inline comments on how to expand/tweak this configuration file +name: tests + +on: + push: + pull_request: + schedule: + - cron: '0 12 * * 0' # run once a week on Sunday + # Allow to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + build: + permissions: + contents: read + pull-requests: write + strategy: + # We want to see all failures: + fail-fast: false + matrix: + os: + - ["ubuntu", "ubuntu-latest"] + config: + # [Python version, visual name, tox env] + - ["3.13", "6.1 on py3.13", "py313-plone61"] + - ["3.10", "6.1 on py3.10", "py310-plone61"] + - ["3.13", "6.0 on py3.13", "py313-plone60"] + - ["3.9", "6.0 on py3.9", "py39-plone60"] + + runs-on: ${{ matrix.os[1] }} + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name + name: ${{ matrix.config[1] }} + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.config[0] }} + allow-prereleases: true + - name: Pip cache + uses: actions/cache@v4 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ matrix.config[0] }}-${{ hashFiles('setup.*', 'tox.ini') }} + restore-keys: | + ${{ runner.os }}-pip-${{ matrix.config[0] }}- + ${{ runner.os }}-pip- + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install tox + - name: Test + run: tox -e ${{ matrix.config[2] }} diff --git a/.meta.toml b/.meta.toml index 7342eb5..c58e80c 100644 --- a/.meta.toml +++ b/.meta.toml @@ -3,4 +3,4 @@ # See the inline comments on how to expand/tweak this configuration file [meta] template = "default" -commit-id = "006091bd" +commit-id = "2.0.1.dev0" diff --git a/tox.ini b/tox.ini index b4f28d7..2c929c8 100644 --- a/tox.ini +++ b/tox.ini @@ -7,6 +7,15 @@ min_version = 4.4.0 envlist = lint test + py313-plone61 + py312-plone61 + py311-plone61 + py310-plone61 + py313-plone60 + py312-plone60 + py311-plone60 + py310-plone60 + py39-plone60 dependencies @@ -21,25 +30,6 @@ envlist = # """ ## -[testenv] -skip_install = true -allowlist_externals = - echo - false -# Make sure typos like `tox -e formaat` are caught instead of silently doing nothing. -# See https://github.com/tox-dev/tox/issues/2858. -commands = - echo "Unrecognized environment name {envname}" - false - -## -# Add extra configuration options in .meta.toml: -# [tox] -# testenv_options = """ -# basepython = /usr/bin/python3.8 -# """ -## - [testenv:init] description = Prepare environment skip_install = true @@ -87,8 +77,19 @@ deps = commands = sh -c 'pipdeptree --exclude setuptools,wheel,pipdeptree,zope.interface,zope.component --graph-output svg > dependencies.svg' -[testenv:test] -description = run the distribution tests + +[test_runner] +deps = zope.testrunner +test = + zope-testrunner --all --test-path={toxinidir} -s plone.batching {posargs} +coverage = + coverage run --branch --source plone.batching {envbindir}/zope-testrunner --quiet --all --test-path={toxinidir} -s plone.batching {posargs} + coverage report -m --format markdown + coverage xml + coverage html + +[base] +description = shared configuration for tests and coverage use_develop = true skip_install = false constrain_package_deps = true @@ -104,26 +105,28 @@ set_env = # # Set constrain_package_deps .meta.toml: # [tox] -# constrain_package_deps = "false" +# constrain_package_deps = false ## deps = - zope.testrunner - -c https://dist.plone.org/release/6.0-dev/constraints.txt + {[test_runner]deps} + plone61: -c https://dist.plone.org/release/6.1-dev/constraints.txt + plone60: -c https://dist.plone.org/release/6.0-dev/constraints.txt ## # Specify additional deps in .meta.toml: # [tox] -# test_deps_additional = "-esources/plonegovbr.portal_base[test]" +# test_deps_additional = """ +# -esources/plonegovbr.portal_base[test] +# """ # # Specify a custom constraints file in .meta.toml: # [tox] # constraints_file = "https://my-server.com/constraints.txt" ## -commands = - zope-testrunner --all --test-path={toxinidir} -s plone.batching {posargs} extras = test + ## # Add extra configuration options in .meta.toml: # [tox] @@ -131,35 +134,50 @@ extras = # tests # widgets # """ +# +# Add extra configuration options in .meta.toml: +# [tox] +# testenv_options = """ +# basepython = /usr/bin/python3.8 +# """ ## +[testenv:test] +description = run the distribution tests +use_develop = {[base]use_develop} +skip_install = {[base]skip_install} +constrain_package_deps = {[base]constrain_package_deps} +set_env = {[base]set_env} +deps = + {[test_runner]deps} + -c https://dist.plone.org/release/6.1-dev/constraints.txt +commands = {[test_runner]test} +extras = {[base]extras} + + +[testenv] +description = run the distribution tests (generative environments) +use_develop = {[base]use_develop} +skip_install = {[base]skip_install} +constrain_package_deps = {[base]constrain_package_deps} +set_env = {[base]set_env} +deps = {[test_runner]deps} +commands = {[test_runner]test} +extras = {[base]extras} + + [testenv:coverage] description = get a test coverage report -use_develop = true -skip_install = false -constrain_package_deps = true -set_env = - ROBOT_BROWSER=headlesschrome - -## -# Specify extra test environment variables in .meta.toml: -# [tox] -# test_environment_variables = """ -# PIP_EXTRA_INDEX_URL=https://my-pypi.my-server.com/ -# """ -## +use_develop = {[base]use_develop} +skip_install = {[base]skip_install} +constrain_package_deps = {[base]constrain_package_deps} +set_env = {[base]set_env} deps = + {[test_runner]deps} coverage - zope.testrunner - -c https://dist.plone.org/release/6.0-dev/constraints.txt - -commands = - coverage run --branch --source plone.batching {envbindir}/zope-testrunner --quiet --all --test-path={toxinidir} -s plone.batching {posargs} - coverage report -m --format markdown - coverage xml - coverage html -extras = - test + -c https://dist.plone.org/release/6.1-dev/constraints.txt +commands = {[test_runner]coverage} +extras = {[base]extras} [testenv:release-check] @@ -169,7 +187,7 @@ deps = twine build towncrier - -c https://dist.plone.org/release/6.0-dev/constraints.txt + -c https://dist.plone.org/release/6.1-dev/constraints.txt commands = # fake version to not have to install the package @@ -200,7 +218,7 @@ allowlist_externals = deps = pipdeptree pipforester - -c https://dist.plone.org/release/6.0-dev/constraints.txt + -c https://dist.plone.org/release/6.1-dev/constraints.txt commands = # Generate the full dependency tree