Skip to content

Commit 48fb638

Browse files
committed
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.
1 parent 1ebd605 commit 48fb638

File tree

4 files changed

+106
-28
lines changed

4 files changed

+106
-28
lines changed

.github/workflows/main.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,82 @@ jobs:
201201
run: |
202202
tox -e black-check,isort-check,pyupgrade,checks,import-timings,lint,pylint,mypy
203203
204+
build_test_release_artifact:
205+
name: Build and Test Release Artifact
206+
runs-on: ubuntu-latest
207+
208+
strategy:
209+
matrix:
210+
python_version: [3.8]
211+
212+
steps:
213+
- uses: actions/checkout@master
214+
with:
215+
fetch-depth: 1
216+
217+
- name: Use Python ${{ matrix.python_version }}
218+
uses: actions/setup-python@v5
219+
with:
220+
python-version: ${{ matrix.python_version }}
221+
222+
- name: Cache Python Dependencies
223+
uses: actions/cache@v4
224+
with:
225+
path: ~/.cache/pip
226+
key: ${{ runner.os }}-pip-${{ hashFiles('requirements-lint.txt') }}
227+
restore-keys: |
228+
${{ runner.os }}-pip-
229+
230+
- name: Install Python Dependencies
231+
run: |
232+
pip install -r requirements-ci.txt
233+
pip install -e ".[build]"
234+
235+
- name: Build Release Artifact
236+
run: |
237+
python -m build -vv
238+
239+
- name: Set Environment
240+
run: |
241+
export PYTHONPATH=.
242+
export VERSION=$(python -c "import libcloud ; print(libcloud.__version__)")
243+
echo "VERSION=${VERSION}" >> "$GITHUB_ENV"
244+
245+
- name: Verify Tarball Release Artifact
246+
run: |
247+
# Verify tarball file exists
248+
export TARBALL_FILENAME="apache_libcloud-${VERSION}.tar.gz"
249+
250+
ls -la "dist/${TARBALL_FILENAME}"
251+
252+
cd dist/
253+
254+
# Unpack tarball and verify + run the tests
255+
tar -xzvf "${TARBALL_FILENAME}"
256+
257+
cd "apache_libcloud-${VERSION}/"
258+
tox -epy3.8
259+
260+
- name: Verify Wheel Release Artifact
261+
run: |
262+
# Verify wheel file exists
263+
export WHEEL_FILENAME="apache_libcloud-${VERSION}-py2.py3-none-any.whl"
264+
265+
ls -la "dist/${WHEEL_FILENAME}"
266+
267+
cd dist/
268+
269+
# Unpack wheel and verify + run tests
270+
unzip "${WHEEL_FILENAME}" -d "wheel"
271+
cd wheel
272+
273+
# Since wheel doesn't include those files, we need to manually copy them over from
274+
# repo root so we can run the tests
275+
cp ../../tox.ini .
276+
cp ../../requirements-tests.txt .
277+
cp ../../libcloud/test/secrets.py-dist libcloud/test/secrets.py
278+
tox -epy3.8
279+
204280
build_test_docker_image:
205281
name: Build and Verify Docker Image
206282
runs-on: ubuntu-latest

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ coverage.xml
1515
.idea
1616
dist/*apache-libcloud*
1717
dist/*apache_libcloud*
18+
dist/wheel
1819
docs/apidocs/*
1920
_build/
2021
apache_libcloud.egg-info/

MANIFEST.in

Lines changed: 0 additions & 25 deletions
This file was deleted.

pyproject.toml

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,37 @@ test = [
8585
]
8686

8787
[tool.setuptools.packages.find]
88-
where = ["./"]
89-
include = ["libcloud", "libcloud.test*" ]
88+
include = ["libcloud"]
89+
namespaces = false
9090

9191
[tool.setuptools.package-data]
92-
"*" = ["*.json", "*.xml", "*.pub", "*.key", "*.pem", "*.crt", "*.csv", "*.txt", "*.html"]
92+
"*" = [
93+
"LICENSE",
94+
"NOTICE",
95+
"example*.py",
96+
"CHANGES.rst",
97+
"README.rst",
98+
"tox.ini",
99+
"pyproject.toml",
100+
"requirements-tests.txt",
101+
"requirements-lint.txt",
102+
"libcloud/test/secrets.py-dist",
103+
"demos/*"
104+
]
105+
"libcloud.data" = [
106+
"pricing.json"
107+
]
108+
"libcloud.test" = [
109+
"*.json",
110+
"*.xml",
111+
"*.pub",
112+
"*.key",
113+
"*.pem",
114+
"*.crt",
115+
"*.csv",
116+
"*.txt",
117+
"*.html"
118+
]
93119
"libcloud.test.compute.fixtures.misc" = ["*"]
94120
"libcloud.test.dns.fixtures.worldwidedns" = ["*"]
95121

0 commit comments

Comments
 (0)