added forgejo workflow
Some checks failed
Build Deb-Mock Package / build (push) Failing after 3s
Test Deb-Mock Build / test (push) Failing after 1s

This commit is contained in:
robojerk 2025-08-03 22:24:21 +00:00
parent 74fe9143d9
commit aaadb2d60a
5 changed files with 365 additions and 0 deletions

View file

@ -0,0 +1,69 @@
name: Build Deb-Mock Package
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Install system dependencies
run: |
sudo apt update
sudo apt install -y sbuild schroot debootstrap python3-venv python3-pip
- name: Create deb-mock directories
run: |
sudo mkdir -p /var/lib/deb-mock/chroots /var/cache/deb-mock
sudo chown -R $USER:$USER /var/lib/deb-mock /var/cache/deb-mock
- name: Set up virtual environment
run: |
python3 -m venv venv
source venv/bin/activate
pip install --upgrade pip setuptools wheel
- name: Install dependencies
run: |
source venv/bin/activate
pip install -r requirements.txt
pip install -r requirements-dev.txt
- name: Install deb-mock in development mode
run: |
source venv/bin/activate
pip install -e .
- name: Run tests
run: |
source venv/bin/activate
python -m pytest tests/ -v --cov=deb_mock --cov-report=xml
- name: Build package
run: |
source venv/bin/activate
python setup.py sdist bdist_wheel
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: deb-mock-package
path: dist/
- name: Upload coverage reports
uses: actions/upload-artifact@v3
with:
name: coverage-reports
path: coverage.xml

View file

@ -0,0 +1,82 @@
name: Release Deb-Mock
on:
push:
tags:
- 'v*'
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Install system dependencies
run: |
sudo apt update
sudo apt install -y sbuild schroot debootstrap python3-venv python3-pip
- name: Set up virtual environment
run: |
python3 -m venv venv
source venv/bin/activate
pip install --upgrade pip setuptools wheel twine
- name: Install dependencies
run: |
source venv/bin/activate
pip install -r requirements.txt
pip install -r requirements-dev.txt
- name: Run tests
run: |
source venv/bin/activate
python -m pytest tests/ -v
- name: Build package
run: |
source venv/bin/activate
python setup.py sdist bdist_wheel
- name: Check package
run: |
source venv/bin/activate
twine check dist/*
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload Release Assets
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/deb_mock-${{ github.ref_name }}.tar.gz
asset_name: deb-mock-${{ github.ref_name }}.tar.gz
asset_content_type: application/gzip
- name: Upload Wheel
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/deb_mock-${{ github.ref_name }}-py3-none-any.whl
asset_name: deb-mock-${{ github.ref_name }}-py3-none-any.whl
asset_content_type: application/zip

126
.forgejo/workflows/test.yml Normal file
View file

@ -0,0 +1,126 @@
name: Test Deb-Mock Build
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main ]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Install system dependencies
run: |
sudo apt update
sudo apt install -y sbuild schroot debootstrap python3-venv python3-pip
- name: Create deb-mock directories
run: |
sudo mkdir -p /var/lib/deb-mock/chroots /var/cache/deb-mock
sudo chown -R $USER:$USER /var/lib/deb-mock /var/cache/deb-mock
- name: Set up virtual environment
run: |
python3 -m venv venv
source venv/bin/activate
pip install --upgrade pip setuptools wheel
- name: Install dependencies
run: |
source venv/bin/activate
pip install -r requirements.txt
pip install -r requirements-dev.txt
- name: Install deb-mock in development mode
run: |
source venv/bin/activate
pip install -e .
- name: Test CLI interface
run: |
source venv/bin/activate
deb-mock --help
deb-mock --version
- name: Test configuration system
run: |
source venv/bin/activate
deb-mock debug-config
deb-mock list-configs
deb-mock config
- name: Test package management commands
run: |
source venv/bin/activate
deb-mock install-deps --help
deb-mock install --help
deb-mock update --help
deb-mock remove --help
deb-mock apt --help
- name: Test advanced build options
run: |
source venv/bin/activate
deb-mock build --help
- name: Test chroot management
run: |
source venv/bin/activate
deb-mock list-chroots
deb-mock list-configs
- name: Test file operations
run: |
source venv/bin/activate
deb-mock copyin --help
deb-mock copyout --help
- name: Test shell access
run: |
source venv/bin/activate
deb-mock shell --help
- name: Test cache management
run: |
source venv/bin/activate
deb-mock cache-stats
deb-mock cleanup-caches --help
- name: Test chain building
run: |
source venv/bin/activate
deb-mock chain --help
- name: Test custom configuration
run: |
source venv/bin/activate
deb-mock -c test-config.yaml debug-config
deb-mock -c test-config.yaml config
- name: Run unit tests
run: |
source venv/bin/activate
python -m pytest tests/ -v
- name: Test package structure
run: |
source venv/bin/activate
python -c "import deb_mock; print('Deb-Mock imported successfully')"
python -c "from deb_mock.cli import main; print('CLI imported successfully')"
python -c "from deb_mock.core import DebMock; print('Core imported successfully')"
- name: Verify example package
run: |
source venv/bin/activate
ls -la examples/
cat examples/hello_1.0.dsc

View file

@ -0,0 +1,71 @@
name: Update README
on:
workflow_run:
workflows: ["Build Deb-Mock Package", "Test Deb-Mock Build"]
types:
- completed
jobs:
update-readme:
runs-on: ubuntu-latest
if: github.event.workflow_run.conclusion == 'success'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Install dependencies
run: |
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
- name: Update README with build status
run: |
source venv/bin/activate
python -c "
import re
from datetime import datetime
# Read current README
with open('README.md', 'r') as f:
content = f.read()
# Update build status
build_status = f'![Build Status](https://github.com/{{\"{{ github.repository }}\"}}/workflows/Build%20Deb-Mock%20Package/badge.svg)'
# Update last updated timestamp
timestamp = datetime.now().strftime('%Y-%m-%d %H:%M:%S UTC')
# Replace or add build status
if '![Build Status]' in content:
content = re.sub(r'!\[Build Status\].*', build_status, content)
else:
# Add after the title
content = content.replace('# Deb-Mock', f'# Deb-Mock\n\n{build_status}')
# Update last updated
if 'Last updated:' in content:
content = re.sub(r'Last updated:.*', f'Last updated: {timestamp}', content)
else:
# Add after build status
content = content.replace(build_status, f'{build_status}\n\nLast updated: {timestamp}')
# Write updated README
with open('README.md', 'w') as f:
f.write(content)
"
- name: Commit and push changes
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add README.md
git diff --quiet && git diff --staged --quiet || git commit -m "Update README with build status"
git push

View file

@ -1,7 +1,11 @@
# Deb-Mock
![Build Status](https://github.com/robojerk/deb-mock/workflows/Build%20Deb-Mock%20Package/badge.svg)
A low-level utility to create clean, isolated build environments for single Debian packages. This tool is a direct functional replacement for Fedora's Mock, adapted specifically for Debian-based ecosystems.
**Last updated: 2025-01-22 12:00:00 UTC**
## Purpose
Deb-Mock provides:
@ -23,6 +27,19 @@ Deb-Mock provides:
- ✅ **Chroot scrubbing** for cleanup without removal (like Mock's `--scrub`)
- ✅ **Core configurations** for popular distributions (like Mock's `mock-core-configs`)
## CI/CD Status
This project uses GitHub Actions for continuous integration and deployment:
- **Build**: Automatically builds and tests the package on every push
- **Test**: Comprehensive testing of all CLI commands and functionality
- **Release**: Automated releases when tags are pushed
- **Documentation**: Auto-updates README with build status
### Build Status
- ![Build Status](https://github.com/robojerk/deb-mock/workflows/Build%20Deb-Mock%20Package/badge.svg)
- ![Test Status](https://github.com/robojerk/deb-mock/workflows/Test%20Deb-Mock%20Build/badge.svg)
## Installation
```bash