From 0b1830af41802f9389d07faa2494a3579decbc3a Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Sat, 29 Jun 2024 16:55:44 +0200 Subject: [PATCH] Add new CI job which build the release artifact (tarball, wheel) and verifies it works (unpacks the tarball, runs tests). Also remove MANIFEST.in in favor or include rules declared in pyproject.toml. --- .github/workflows/main.yml | 54 ++++++++++++++++++++++++++++++++++++++ MANIFEST.in | 25 ------------------ pyproject.toml | 32 +++++++++++++++++++--- 3 files changed, 83 insertions(+), 28 deletions(-) delete mode 100644 MANIFEST.in diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0a46cf3157..9458755723 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -201,6 +201,60 @@ jobs: run: | tox -e black-check,isort-check,pyupgrade,checks,import-timings,lint,pylint,mypy + build_test_release_artifact: + name: Build and Test Release Artifact + runs-on: ubuntu-latest + + strategy: + matrix: + python_version: [3.8] + + steps: + - uses: actions/checkout@master + with: + fetch-depth: 1 + + - name: Use Python ${{ matrix.python_version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python_version }} + + - name: Cache Python Dependencies + uses: actions/cache@v4 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('requirements-lint.txt') }} + restore-keys: | + ${{ runner.os }}-pip- + + - name: Install Python Dependencies + run: | + pip install -r requirements-ci.txt + pip install -e ".[build]" + + - name: Build Release Artifact + run: | + python -m build -vv + + - name: Verify Release Artifact + run: | + export PYTHONPATH=. + export VERSION=$(python -c "import libcloud ; print(libcloud.__version__)") + unset PYTHONPATH + + # Verify tarball + wheel file exists + export TARBALL_FILENAME="apache_libcloud-${VERSION}.tar.gz" + + ls -la "dist/${TARBALL_FILENAME}" + ls -la "dist/apache_libcloud-${VERSION}-py2.py3-none-any.whl" + + # Unpack tarball and run the tests + cd dist/ + tar -xzvf "${TARBALL_FILENAME}" + + cd "apache_libcloud-${VERSION}/" + tox -epy3.8 + build_test_docker_image: name: Build and Verify Docker Image runs-on: ubuntu-latest diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 67421d7f94..0000000000 --- a/MANIFEST.in +++ /dev/null @@ -1,25 +0,0 @@ -global-exclude *.py[cod] -global-exclude .pytest_cache -include LICENSE -include NOTICE -include example_*.py -include CHANGES.rst -include README.rst -include tox.ini -include pyproject.toml -include requirements-tests.txt -include requirements-lint.txt -include libcloud/data/pricing.json -include libcloud/test/secrets.py-dist -include demos/* -include scripts/check_file_names.sh -recursive-exclude libcloud/test secrets.py -prune libcloud/test/secrets.py -prune requirements-rtd.txt -prune dist -prune build -prune contrib/ -prune docs/ -prune demos/ -prune integration/ -prune pylint_plugins/ diff --git a/pyproject.toml b/pyproject.toml index d89e53b564..8a4b0b6631 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -85,11 +85,37 @@ test = [ ] [tool.setuptools.packages.find] -where = ["./"] -include = ["libcloud", "libcloud.test*" ] +include = ["libcloud"] +namespaces = false [tool.setuptools.package-data] -"*" = ["*.json", "*.xml", "*.pub", "*.key", "*.pem", "*.crt", "*.csv", "*.txt", "*.html"] +"*" = [ + "LICENSE", + "NOTICE", + "example*.py", + "CHANGES.rst", + "README.rst", + "tox.ini", + "pyproject.toml", + "requirements-tests.txt", + "requirements-lint.txt", + "libcloud/test/secrets.py-dist", + "demos/*" +] +"libcloud.data" = [ + "pricing.json" +] +"libcloud.test" = [ + "*.json", + "*.xml", + "*.pub", + "*.key", + "*.pem", + "*.crt", + "*.csv", + "*.txt", + "*.html" +] "libcloud.test.compute.fixtures.misc" = ["*"] "libcloud.test.dns.fixtures.worldwidedns" = ["*"]