Files
ProxLB/.github/workflows/20-pipeline-build-deb-package.yml
2025-12-10 12:42:28 +01:00

101 lines
3.5 KiB
YAML

name: "Build package: .deb"
on: [push]
jobs:
lint-code-proxlb:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8"]
steps:
- uses: actions/checkout@v3
- name: Setup dependencies for code linting
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install additional dependencies for code linting
run: |
sudo apt-get update
sudo apt-get -y install python3-pycodestyle pycodestyle
- name: Run code linting on ProxLB Python code
run: |
pycodestyle proxlb/* && \
echo "OK: Code linting successfully performed on ProxLB code."
build-package-debian:
needs: lint-code-proxlb
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
- name: Set up Docker with Debian image
run: |
docker pull debian:latest
- name: Build DEB package in Docker container
run: |
docker run --rm -v $(pwd):/workspace -w /workspace debian:latest bash -c "
# Install dependencies
apt-get update && \
apt-get install -y python3 python3-setuptools debhelper dh-python python3-pip python3-stdeb python3-proxmoxer python3-requests python3-urllib3 devscripts python3-all && \
# Get base version from source code
BASE_VERSION=\$(grep __version__ proxlb/utils/version.py | awk '{print \$3}' | tr -d '\"')
echo \"Base version: \$BASE_VERSION\"
# Build full version with timestamp
FULL_VERSION=\"\${BASE_VERSION}+$(date +%Y%m%d%H%M)\"
echo \"Full version: \$FULL_VERSION\"
# Update debian/changelog with new version
dch --force-bad-version -v \"\$FULL_VERSION\" \
\"Automated GitHub Actions build on $(date -u +'%Y-%m-%d %H:%M UTC').\" && \
# Build package using stdeb / setuptools
# python3 setup.py --command-packages=stdeb.command bdist_deb && \
# Build native package
dpkg-buildpackage -us -uc && \
mkdir package && \
mv ../*.deb package/ && \
echo 'OK: Debian package successfully created.'
"
- name: Upload Debian package python3-proxlb as artifact
uses: actions/upload-artifact@v4
with:
name: debian-package
path: package/*.deb
integration-test-debian:
needs: build-package-debian
runs-on: ubuntu-latest
strategy:
matrix:
debian_version: [bookworm, trixie]
name: Integration Test on Debian ${{ matrix.debian_version }}
steps:
- name: Download Debian package artifact
uses: actions/download-artifact@v4
with:
name: debian-package
path: package/
- name: Set up Docker with Debian image
run: docker pull debian:${{ matrix.debian_version }}
- name: Install and test Debian package in Docker container
run: |
docker run --rm \
-v "$(pwd)/package:/package" \
-w /package \
debian:${{ matrix.debian_version }} \
bash -c "
set -e
apt-get update
apt-get install -y python3 systemd
apt-get install -y ./proxlb*.deb
python3 -c 'import proxlb; print(\"OK: Debian package successfully installed on ${{ matrix.debian_version }}.\")'
"