142 lines
3.5 KiB
YAML
142 lines
3.5 KiB
YAML
---
|
|
name: Blue Build Modules CI/CD
|
|
|
|
on:
|
|
push:
|
|
branches: [main, develop]
|
|
pull_request:
|
|
branches: [main]
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
DEBIAN_FRONTEND: noninteractive
|
|
PYTHON_VERSION: "3.11"
|
|
|
|
jobs:
|
|
build-and-package:
|
|
name: Build and Package Python Modules
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: python:3.11-bullseye
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Python environment
|
|
run: |
|
|
python3 --version
|
|
pip3 --version
|
|
|
|
- name: Install build dependencies
|
|
run: |
|
|
apt-get update
|
|
apt-get install -y \
|
|
build-essential \
|
|
devscripts \
|
|
debhelper \
|
|
python3-dev \
|
|
python3-setuptools \
|
|
python3-pip \
|
|
python3-wheel \
|
|
git \
|
|
ca-certificates
|
|
|
|
- name: Install Python dependencies
|
|
run: |
|
|
pip3 install --upgrade pip setuptools wheel
|
|
if [ -f requirements.txt ]; then
|
|
pip3 install -r requirements.txt
|
|
fi
|
|
|
|
- name: Create debian directory
|
|
run: |
|
|
mkdir -p debian
|
|
cat > debian/control << EOF
|
|
Source: blue-build-modules
|
|
Section: python
|
|
Priority: optional
|
|
Maintainer: Blue Build Team <team@blue-build.org>
|
|
Build-Depends: debhelper (>= 13), python3-dev, python3-setuptools, python3-pip, python3-wheel, git, ca-certificates
|
|
Standards-Version: 4.6.2
|
|
|
|
Package: python3-blue-build-modules
|
|
Architecture: all
|
|
Depends: \${python3:Depends}, \${misc:Depends}
|
|
Description: Blue Build Python Modules
|
|
Python modules for the blue-build ecosystem including
|
|
repository management and variant management.
|
|
EOF
|
|
|
|
cat > debian/rules << EOF
|
|
#!/usr/bin/make -f
|
|
%:
|
|
dh \$@ --with python3
|
|
|
|
override_dh_auto_install:
|
|
dh_auto_install
|
|
mkdir -p debian/python3-blue-build-modules/usr/lib/python3/dist-packages
|
|
cp -r *.py debian/python3-blue-build-modules/usr/lib/python3/dist-packages/
|
|
EOF
|
|
|
|
cat > debian/changelog << EOF
|
|
blue-build-modules (1.0.0-1) unstable; urgency=medium
|
|
|
|
* Initial release
|
|
* Blue Build Python modules implementation
|
|
|
|
-- Blue Build Team <team@blue-build.org> $(date -R)
|
|
EOF
|
|
|
|
cat > debian/compat << EOF
|
|
13
|
|
EOF
|
|
|
|
chmod +x debian/rules
|
|
|
|
- name: Build Debian package
|
|
run: |
|
|
dpkg-buildpackage -us -uc -b
|
|
ls -la ../*.deb
|
|
|
|
- name: Upload artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: blue-build-modules-deb
|
|
path: ../*.deb
|
|
retention-days: 30
|
|
|
|
test:
|
|
name: Test Python Modules
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: python:3.11-bullseye
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Python environment
|
|
run: |
|
|
python3 --version
|
|
pip3 --version
|
|
|
|
- name: Install Python dependencies
|
|
run: |
|
|
pip3 install --upgrade pip setuptools wheel
|
|
if [ -f requirements.txt ]; then
|
|
pip3 install -r requirements.txt
|
|
fi
|
|
|
|
- name: Run Python tests
|
|
run: |
|
|
if [ -f setup.py ]; then
|
|
python3 setup.py test
|
|
else
|
|
echo "No setup.py found, skipping tests"
|
|
fi
|
|
|
|
- name: Test module imports
|
|
run: |
|
|
python3 -c "import debian_repository_manager; print('debian_repository_manager imported successfully')" || echo "Module not ready yet"
|
|
python3 -c "import debian_variants_manager; print('debian_variants_manager imported successfully')" || echo "Module not ready yet"
|