diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c64d1776..5f8fffd6 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,7 +13,7 @@ concurrency: jobs: lint: name: Lint - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Repository checkout uses: actions/checkout@v4 @@ -23,16 +23,38 @@ jobs: - name: Install dependencies run: | - pip install --upgrade pip tox + python3 -m venv venv + . ./venv/bin/activate + ./venv/bin/pip install --require-virtualenv --upgrade pip tox - name: Lint Python files run: | + . ./venv/bin/activate tox -e lint - name: Typecheck Python files run: | + . ./venv/bin/activate tox -e check + unit-tests: + name: Unit tests + runs-on: ubuntu-24.04 + steps: + - name: Repository checkout + uses: actions/checkout@v4 + + - name: Install dependencies + run: | + python3 -m venv venv + . ./venv/bin/activate + ./venv/bin/pip install --require-virtualenv --upgrade pip tox + + - name: Run unit tests + run: | + . ./venv/bin/activate + tox -e unit + tests: name: Tests strategy: @@ -65,30 +87,17 @@ jobs: - name: Install dependencies run: | set -x - pip install --upgrade pip tox codecov + python3 -m venv venv + . ./venv/bin/activate + ./venv/bin/pip install --require-virtualenv --upgrade pip tox codecov - name: Coverage run: | + . ./venv/bin/activate tox -e coverage codecov - name: Integration run: | + . ./venv/bin/activate integration/run-integration-tests - - publish: - name: Publish - runs-on: ubuntu-22.04 - if: startsWith(github.event.ref, 'refs/tags') - - permissions: - contents: write - steps: - - uses: actions/checkout@v4 - - - name: Create Release - uses: ncipollo/release-action@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - name: Release ${{ github.ref }} - generateReleaseNotes: true diff --git a/setup.cfg b/setup.cfg index 4d225589..2e00ae6c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -28,7 +28,7 @@ install_requires = testing = ddt >= 0.7.0 mock-services >= 0.3 - pytest-cov == 5.0.0 + pytest-cov >= 5.0.0 pytest >= 6.1.2 # mock-services is old and unmaintained. Doesn't work with newer versions # of requests-mock. Thus, we have to pin it down. @@ -37,9 +37,9 @@ testing = # but mock-services depends on it for `pkg_resources` setuptools format = - black == 24.8.0 - flake8 >= 2.5.0 - isort == 5.13.2 + black + flake8 + isort check = mypy doc = @@ -48,7 +48,7 @@ doc = [flake8] show-source = True ignore = E203, E266, E501, W503, W504 -exclude = .git, .tox, dist, doc, *egg, build +exclude = .git, .tox, dist, doc, *egg, build, venv [mypy] ignore_missing_imports = True @@ -67,10 +67,10 @@ upload-dir = doc/build/html [tox:tox] minversion = 1.6 -envlist = lint,check,coverage +envlist = lint,check,coverage,format,integration,intregration-in-lxd,migration,unit skipsdist = True -[testenv] +[testenv:unit] usedevelop = True setenv = PYLXD_WARNINGS=none @@ -81,6 +81,8 @@ commands = [testenv:integration] passenv = LXD_* +deps = + .[testing] commands = pytest integration {posargs}