Skip to content

Commit

Permalink
feedback from PR
Browse files Browse the repository at this point in the history
Signed-off-by: Callahan Kovacs <callahan.kovacs@canonical.com>
  • Loading branch information
mr-cal committed Jun 15, 2023
1 parent e236924 commit 33e2f10
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 24 deletions.
30 changes: 10 additions & 20 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
16 changes: 12 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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.
Expand All @@ -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
Expand Down Expand Up @@ -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

0 comments on commit 33e2f10

Please sign in to comment.