diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 1832e76d..040567a4 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -60,13 +60,13 @@ jobs: - name: Configure environment run: | echo "::group::pip install" - python -m pip install 'tox>=4' tox-gh + python -m pip install 'tox>=4.6' echo "::endgroup::" mkdir -p results - name: Setup Tox environments run: tox run -m unit-tests --notest - name: Test with tox - run: tox run-parallel --parallel all --parallel-no-spinner --skip-pkg-install --result-json results/tox-${{ matrix.platform }}.json -m unit-tests -- --no-header --quiet -rN + run: tox run-parallel --parallel all --parallel-no-spinner --skip-pkg-install --result-json results/tox-${{ matrix.platform }}.json -m unit-tests --no-list-dependencies -- --no-header --quiet -rN - name: Upload code coverage uses: codecov/codecov-action@v3 with: @@ -81,12 +81,7 @@ jobs: integration-tests-linux: strategy: matrix: - python: [ - {system-version: "3.8", tox-version: "py38"}, - {system-version: "3.10", tox-version: "py310"}, - {system-version: "3.11", tox-version: "py311"}, - {system-version: "3.12-dev", tox-version: "py312"}, - ] + python-version: [ "3.8", "3.10", "3.11", "3.12-dev" ] # does not work with canonical/setup-lxd github action (see https://github.com/canonical/craft-providers/issues/271) runs-on: ubuntu-latest steps: @@ -97,11 +92,11 @@ jobs: - name: Setup Python uses: actions/setup-python@v4 with: - python-version: ${{ matrix.python.system-version }} + python-version: ${{ matrix.python-version }} - name: Configure environment run: | echo "::group::pip install" - python -m pip install 'tox>=4' + python -m pip install 'tox>=4.6' echo "::endgroup::" echo "::group::Configure LXD" sudo groupadd --force --system lxd @@ -120,16 +115,11 @@ jobs: export CRAFT_PROVIDERS_TESTS_ENABLE_LXD_INSTALL=1 export CRAFT_PROVIDERS_TESTS_ENABLE_LXD_UNINSTALL=1 sg lxd -c "lxc version" - sg lxd -c "tox run -e integration-${{ matrix.python.tox-version }}" + sg lxd -c "tox run --no-list-dependencies -m integration-tests" integration-tests-macos: strategy: matrix: - python: [ - {system-version: "3.8", tox-version: "py38"}, - {system-version: "3.10", tox-version: "py310"}, - {system-version: "3.11", tox-version: "py311"}, - {system-version: "3.12-dev", tox-version: "py312"}, - ] + python-version: [ "3.8", "3.10", "3.11", "3.12-dev" ] runs-on: macos-latest steps: - name: Checkout code @@ -139,11 +129,11 @@ jobs: - name: Setup Python uses: actions/setup-python@v4 with: - python-version: ${{ matrix.python.system-version }} + python-version: ${{ matrix.python-version }} - name: Configure environment run: | echo "::group::pip install" - python -m pip install 'tox>=4' + python -m pip install 'tox>=4.6' echo "::endgroup::" echo "::group::Install Multipass" brew update @@ -159,4 +149,4 @@ jobs: run: | export CRAFT_PROVIDERS_TESTS_ENABLE_MULTIPASS_INSTALL=1 export CRAFT_PROVIDERS_TESTS_ENABLE_MULTIPASS_UNINSTALL=1 - tox run -e integration-${{ matrix.python.tox-version }} + tox run --no-list-dependencies -m integration-tests diff --git a/tox.ini b/tox.ini index 3d16961b..fbb5d861 100644 --- a/tox.ini +++ b/tox.ini @@ -1,8 +1,8 @@ [tox] env_list = # Environments to run when called with no parameters. - lint-{black,ruff,pyright,shellcheck,codespell,docs} + lint-{black,ruff,pyright,shellcheck,codespell} test-{py38,py310,py311} -minversion = 4.5 +minversion = 4.6 # Tox will use these requirements to bootstrap a venv if necessary. # tox-igore-env-name-mismatch allows us to have one virtualenv for all linting. # By setting requirements here, we make this INI file compatible with older @@ -12,6 +12,7 @@ minversion = 4.5 requires = # renovate: datasource=pypi tox-ignore-env-name-mismatch>=0.2.0.post2 + tox-gh # Allow tox to access the user's $TMPDIR environment variable if set. # This workaround is required to avoid circular dependencies for TMPDIR, # since tox will otherwise attempt to use the environment's TMPDIR variable. @@ -38,14 +39,14 @@ base = testenv, test description = Run unit tests with pytest labels = py38, py310, py311: tests, unit-tests -commands = pytest {tty:--color=yes} --cov --cov-report=xml:results/coverage-{env_name}.xml --junit-xml=results/test-results-{env_name}.xml tests/unit {posargs} +commands = pytest {tty:--color=yes} --cov --cov-report=xml:results/coverage-{env_name}.xml --junit-xml=results/test-results-{env_name}.xml tests/unit {posargs} --setup-plan [testenv:integration-{py38,py39,py310,py311,py312}] base = testenv, test description = Run integration tests with pytest labels = py38, py310, py311: tests, integration-tests -commands = pytest {tty:--color=yes} --junit-xml=results/test-results-{env_name}.xml tests/integration {posargs} +commands = pytest {tty:--color=yes} --junit-xml=results/test-results-{env_name}.xml tests/integration {posargs} --setup-plan [lint] # Standard linting configuration package = editable @@ -121,3 +122,10 @@ commands = # base = docs # commands = sphinx-lint --ignore docs/_build --max-line-length 80 -e all {posargs} docs/ # labels = lint + +[gh] +python = + 3.8 = py38 + 3.10 = py310 + 3.11 = py311, type + 3.12-dev = py312