Skip to content

Commit bf92dcf

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 bf92dcf

File tree

4 files changed

+107
-28
lines changed

4 files changed

+107
-28
lines changed

.github/workflows/main.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,83 @@ 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+
pip list installed
238+
python -m build -vv
239+
240+
- name: Set Environment
241+
run: |
242+
export PYTHONPATH=.
243+
export VERSION=$(python -c "import libcloud ; print(libcloud.__version__)")
244+
echo "VERSION=${VERSION}" >> "$GITHUB_ENV"
245+
246+
- name: Verify Tarball Release Artifact
247+
run: |
248+
# Verify tarball file exists
249+
export TARBALL_FILENAME="apache_libcloud-${VERSION}.tar.gz"
250+
251+
ls -la "dist/${TARBALL_FILENAME}"
252+
253+
cd dist/
254+
255+
# Unpack tarball and verify + run the tests
256+
tar -xzvf "${TARBALL_FILENAME}"
257+
258+
cd "apache_libcloud-${VERSION}/"
259+
tox -epy3.8
260+
261+
- name: Verify Wheel Release Artifact
262+
run: |
263+
# Verify wheel file exists
264+
export WHEEL_FILENAME="apache_libcloud-${VERSION}-py2.py3-none-any.whl"
265+
266+
ls -la "dist/${WHEEL_FILENAME}"
267+
268+
cd dist/
269+
270+
# Unpack wheel and verify + run tests
271+
unzip "${WHEEL_FILENAME}" -d "wheel"
272+
cd wheel
273+
274+
# Since wheel doesn't include those files, we need to manually copy them over from
275+
# repo root so we can run the tests
276+
cp ../../tox.ini .
277+
cp ../../requirements-tests.txt .
278+
cp ../../libcloud/test/secrets.py-dist libcloud/test/secrets.py
279+
tox -epy3.8
280+
204281
build_test_docker_image:
205282
name: Build and Verify Docker Image
206283
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)