From bd7af1132d9f1a2d9bd3ebc42e5477821115e001 Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Wed, 2 Oct 2024 14:42:09 -0400 Subject: [PATCH 1/8] setup.cfg: don't pin specific versions of modules used for testing/format Signed-off-by: Simon Deziel --- setup.cfg | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/setup.cfg b/setup.cfg index 4d225589..153434eb 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 = From 3731bdc1ec3fb7ca133e2412822efba749fa31fe Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Wed, 2 Oct 2024 15:10:57 -0400 Subject: [PATCH 2/8] setup.cfg: allow running with modern tox versions Signed-off-by: Simon Deziel --- setup.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.cfg b/setup.cfg index 153434eb..3926be4a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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 From 50752d83db20f93d49c492ae578fdeeb80d9c029 Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Wed, 2 Oct 2024 15:32:10 -0400 Subject: [PATCH 3/8] setup.cfg: exclude venv dir for flake8 Signed-off-by: Simon Deziel --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 3926be4a..b9b054b2 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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 From 0b553e4a285a73c977447ab41b2251a7f7cb2131 Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Wed, 2 Oct 2024 16:05:34 -0400 Subject: [PATCH 4/8] setup.cfg: install pytest in the integration env Signed-off-by: Simon Deziel --- setup.cfg | 2 ++ 1 file changed, 2 insertions(+) diff --git a/setup.cfg b/setup.cfg index b9b054b2..2e00ae6c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -81,6 +81,8 @@ commands = [testenv:integration] passenv = LXD_* +deps = + .[testing] commands = pytest integration {posargs} From 63a8320559c927ddfdb81e12d6105e15e1f976fa Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Wed, 2 Oct 2024 15:14:06 -0400 Subject: [PATCH 5/8] github: run lint test on Ubuntu 24.04 Signed-off-by: Simon Deziel --- .github/workflows/tests.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c64d1776..ab4bdea4 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,14 +23,18 @@ 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 tests: From 5646ce33d8301edeca4185332e398e366fe71700 Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Wed, 2 Oct 2024 15:00:17 -0400 Subject: [PATCH 6/8] github: add unit-tests job Signed-off-by: Simon Deziel --- .github/workflows/tests.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ab4bdea4..f016d321 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -37,6 +37,24 @@ jobs: . ./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: From 085e626a6149e378b5ab7f20ad4de728a2bf5c51 Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Wed, 2 Oct 2024 15:40:45 -0400 Subject: [PATCH 7/8] github: fix integration tests in CI Signed-off-by: Simon Deziel --- .github/workflows/tests.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f016d321..02ab7e19 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -87,15 +87,19 @@ 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: From b1127266c4054d1e616fc08b1947e600af916e89 Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Wed, 2 Oct 2024 15:42:34 -0400 Subject: [PATCH 8/8] github: remove publish job It seems we've lost access to the GITHUB_SECRET and it's easy enough to do the release notes manually. Signed-off-by: Simon Deziel --- .github/workflows/tests.yml | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 02ab7e19..5f8fffd6 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -101,20 +101,3 @@ jobs: 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