From 334577b472abf7684836c432b51f13e3f1c83a5e 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). --- .github/workflows/main.yml | 54 ++++++++++++++++++++++++++++++++++++++ pyproject.toml | 3 ++- 2 files changed, 56 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0a46cf3157..e6bd207ab3 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 -vvv + + - 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/pyproject.toml b/pyproject.toml index d89e53b564..2dbacfbfd7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -86,7 +86,8 @@ test = [ [tool.setuptools.packages.find] where = ["./"] -include = ["libcloud", "libcloud.test*" ] +include = ["libcloud"] +namespaces = true [tool.setuptools.package-data] "*" = ["*.json", "*.xml", "*.pub", "*.key", "*.pem", "*.crt", "*.csv", "*.txt", "*.html"]