Skip to content

Commit 4b8949b

Browse files
authored
FEAT: Smoke Testing pip installation on Blank Docker Images (#132)
### ADO Work Item Reference <!-- Insert your ADO Work Item ID below (e.g. AB#37452) --> > [AB#37531](https://sqlclientdrivers.visualstudio.com/c6d89619-62de-46a0-8b46-70b92a84d85e/_workitems/edit/37531) ------------------------------------------------------------------- ### Summary <!-- Insert your Copilot Generated Summary below --> Testing driver on minimal docker images with just python installed. This pull request introduces smoke testing the package from PyPI. ### Pipeline Enhancements: * Added a new pipeline configuration file, `pypi-package-smoketest.yml`, to perform smoke tests on PyPI packages across three Linux distributions: UBI9 (RHEL), Ubuntu, and Debian. This ensures compatibility and reliability of the package across different environments. <!-- ### PR Title Guide > For feature requests FEAT: (short-description) > For non-feature requests like test case updates, config updates , dependency updates etc CHORE: (short-description) > For Fix requests FIX: (short-description) > For doc update requests DOC: (short-description) > For Formatting, indentation, or styling update STYLE: (short-description) > For Refactor, without any feature changes REFACTOR: (short-description) > For release related changes, without any feature changes RELEASE: #<RELEASE_VERSION> (short-description) -->
1 parent 03f8ee9 commit 4b8949b

File tree

1 file changed

+79
-0
lines changed

1 file changed

+79
-0
lines changed
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: pypi-package-smoketest.yml
2+
3+
trigger:
4+
branches:
5+
include:
6+
- main
7+
8+
jobs:
9+
- job: TestOnDockerImages
10+
pool:
11+
vmImage: 'ubuntu-latest'
12+
13+
strategy:
14+
matrix:
15+
ubi9:
16+
image: registry.access.redhat.com/ubi9/ubi:latest
17+
pkg_manager: dnf
18+
python_version: '3.12'
19+
ubuntu:
20+
image: ubuntu:22.04
21+
pkg_manager: apt
22+
python_version: '3'
23+
debian:
24+
image: debian:12
25+
pkg_manager: apt
26+
python_version: '3'
27+
28+
steps:
29+
- script: |
30+
echo "Testing on Docker image: $(image)"
31+
echo "Package manager: $(pkg_manager)"
32+
echo "Python version: $(python_version)"
33+
echo "Database connection string: ${DB_CONNECTION_STRING}"
34+
echo "Running tests..."
35+
docker run --rm \
36+
-e DB_CONNECTION_STRING="$(AZURE_CONNECTION_STRING)" \
37+
-v "$(pwd):/workspace" \
38+
-w /workspace \
39+
$(image) \
40+
bash -c "
41+
set -e
42+
43+
echo 'Installing Python and pip...'
44+
45+
if [ '$(pkg_manager)' = 'apt' ]; then
46+
apt-get update
47+
DEBIAN_FRONTEND=noninteractive apt-get install -y \
48+
libltdl7 \
49+
python$(python_version) \
50+
python$(python_version)-venv \
51+
python$(python_version)-dev \
52+
python$(python_version)-full \
53+
curl \
54+
ca-certificates
55+
56+
ln -sf /usr/bin/python$(python_version) /usr/local/bin/python
57+
else
58+
dnf update -y && \
59+
dnf install -y dnf-plugins-core \
60+
python$(python_version) \
61+
python$(python_version)-pip \
62+
python$(python_version)-devel && \
63+
ln -sf /usr/bin/python$(python_version) /usr/local/bin/python && \
64+
ln -sf /usr/bin/pip$(python_version) /usr/local/bin/pip
65+
fi
66+
67+
python -m venv /tmp/venv
68+
. /tmp/venv/bin/activate
69+
70+
python -m pip install --upgrade pip
71+
python -m pip install mssql-python
72+
73+
cp /workspace/main.py /tmp/
74+
cd /tmp
75+
python main.py
76+
"
77+
env:
78+
DB_CONNECTION_STRING: $(AZURE_CONNECTION_STRING)
79+
displayName: "Test on $(image)"

0 commit comments

Comments
 (0)