-
Notifications
You must be signed in to change notification settings - Fork 50
add Debian (Ubuntu) packages #86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
oliverkurth
wants to merge
7
commits into
master
Choose a base branch
from
topic/okurth/debian-package
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
a7f9e15
add debian/ files to create a Debian package
oliverkurth 3c8663c
add tests for Debian packages
oliverkurth bba869a
fix Debian workflow
oliverkurth 309db80
fix multi arch test
oliverkurth a532cc2
fix 'No output specified...'
oliverkurth 46dfbff
drop Ubuntu 20.04 and add Debian bookworm
oliverkurth 0df8e0f
limit GITHUB_TOKEN permissions
oliverkurth File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,111 @@ | ||
| # GitHub Workflows for open-vmdk | ||
|
|
||
| This directory contains GitHub Actions workflows for building, testing, and releasing Debian packages for open-vmdk. | ||
|
|
||
| ## Workflows | ||
|
|
||
| ### 1. `debian-build-test.yml` - Build and Test Debian Packages | ||
|
|
||
| **Triggers:** | ||
| - Push to `main` or `master` branch | ||
| - Pull requests to `main` or `master` branch | ||
| - Manual workflow dispatch | ||
|
|
||
| **What it does:** | ||
| - Builds Debian packages on multiple Ubuntu versions (20.04, 22.04, 24.04) | ||
| - Handles fakeroot issues by falling back to manual build method | ||
| - Tests package installation and basic functionality | ||
| - Runs lintian quality checks | ||
| - Uploads built packages as artifacts | ||
|
|
||
| **Matrix strategy:** Tests on Ubuntu 20.04, 22.04, and 24.04 | ||
|
|
||
| ### 2. `multi-arch-test.yml` - Multi-Architecture Package Test | ||
|
|
||
| **Triggers:** | ||
| - Push to `main` or `master` branch | ||
| - Push of version tags (`v*`) | ||
| - Pull requests to `main` or `master` branch | ||
| - Manual workflow dispatch | ||
|
|
||
| **What it does:** | ||
| - Builds and tests packages on multiple architectures (amd64, arm64) | ||
| - Uses Docker with QEMU for cross-architecture testing | ||
| - Verifies packages work correctly on different CPU architectures | ||
| - Uploads packages from amd64 build as artifacts | ||
|
|
||
| ### 3. `release.yml` - Create Release Packages | ||
|
|
||
| **Triggers:** | ||
| - Push of version tags (`v*`) | ||
| - Manual workflow dispatch with tag input | ||
|
|
||
| **What it does:** | ||
| - Builds release-quality Debian packages | ||
| - Updates changelog with release version and date | ||
| - Runs quality checks with lintian | ||
| - Creates SHA256 checksums for packages | ||
|
|
||
| ## Usage | ||
|
|
||
| ### For Development | ||
|
|
||
| The build and test workflows run automatically on every push and pull request, ensuring packages build correctly across different environments. | ||
|
|
||
| ### Downloading Artifacts | ||
|
|
||
| Built packages are available as workflow artifacts: | ||
| - Go to the Actions tab | ||
| - Click on a completed workflow run | ||
| - Download the "debian-packages-*" artifacts | ||
|
|
||
| ## Environment Handling | ||
|
|
||
| The workflows handle common build environment issues: | ||
|
|
||
| - **Fakeroot problems:** Automatically falls back to manual build using sudo | ||
| - **Multi-architecture:** Uses QEMU for cross-compilation testing | ||
| - **Dependency resolution:** Installs all required build and runtime dependencies | ||
| - **Permission fixes:** Ensures proper file ownership after sudo operations | ||
|
|
||
| ## Package Testing | ||
|
|
||
| Each workflow includes comprehensive testing: | ||
|
|
||
| 1. **Build verification:** Ensures packages build successfully | ||
| 2. **Content verification:** Checks package contents and metadata | ||
| 3. **Installation testing:** Installs packages and resolves dependencies | ||
| 4. **Functionality testing:** Tests that installed binaries work | ||
| 5. **Configuration testing:** Verifies config files and directories are created | ||
| 6. **Quality checks:** Runs lintian for Debian policy compliance | ||
|
|
||
| ## Artifacts and Releases | ||
|
|
||
| - **Development builds:** Available as workflow artifacts (30-day retention) | ||
| - **Release builds:** Attached to GitHub releases with checksums | ||
| - **Build logs:** Available as artifacts when builds fail (7-day retention) | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| If workflows fail: | ||
|
|
||
| 1. Check the workflow logs for specific error messages | ||
| 2. Common issues: | ||
| - Dependency installation failures | ||
| - Fakeroot/permission issues (handled automatically) | ||
| - Network timeouts during package downloads | ||
| - Architecture-specific build failures | ||
|
|
||
| 3. Build logs and artifacts are preserved for debugging | ||
|
|
||
| ## Customization | ||
|
|
||
| To customize the workflows: | ||
|
|
||
| - **Add new test platforms:** Modify the matrix strategy in `debian-build-test.yml` | ||
| - **Change retention periods:** Adjust `retention-days` in upload-artifact steps | ||
| - **Add new architectures:** Extend the arch matrix in `multi-arch-test.yml` | ||
| - **Modify release format:** Update the release body template in `release.yml` | ||
|
|
||
|
|
||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,215 @@ | ||
| name: Build and Test Debian Packages | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ main, master ] | ||
| pull_request: | ||
| branches: [ main, master ] | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
| actions: write | ||
|
|
||
| jobs: | ||
| build-and-test: | ||
| runs-on: ubuntu-latest | ||
| container: | ||
| # Use the appropriate container based on the distro | ||
| image: ${{ matrix.distro == 'debian-bookworm' && 'debian:bookworm' || matrix.distro == 'ubuntu-22.04' && 'ubuntu:22.04' || 'ubuntu:24.04' }} | ||
| strategy: | ||
| matrix: | ||
| # Test on multiple distro versions | ||
| distro: ['ubuntu-22.04', 'ubuntu-24.04', 'debian-bookworm'] | ||
| fail-fast: false | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up build environment | ||
| run: | | ||
| apt-get update | ||
| apt-get install -y \ | ||
| build-essential \ | ||
| debhelper \ | ||
| devscripts \ | ||
| zlib1g-dev \ | ||
| gcc \ | ||
| fakeroot \ | ||
| lintian \ | ||
| dpkg-dev | ||
|
|
||
| - name: Install runtime dependencies for testing | ||
| run: | | ||
| apt-get install -y \ | ||
| coreutils \ | ||
| grep \ | ||
| python3-lxml \ | ||
| python3-yaml \ | ||
| sed \ | ||
| tar \ | ||
| util-linux \ | ||
| zlib1g \ | ||
| python3 \ | ||
| python3-libxml2 | ||
|
|
||
| - name: Build packages | ||
| run: | | ||
| echo "Building Debian packages..." | ||
| BUILD_SUCCESS=false | ||
|
|
||
| # Try standard build first, fall back to manual if fakeroot fails | ||
| if dpkg-buildpackage -us -uc --build=binary 2>/dev/null; then | ||
| echo "Standard build succeeded" | ||
| BUILD_SUCCESS=true | ||
| else | ||
| echo "Standard build failed, trying manual build..." | ||
| debian/rules clean | ||
| if debian/rules build && debian/rules binary; then | ||
| chown -R $(id -u):$(id -g) debian/ ../*.deb 2>/dev/null || true | ||
| echo "Manual build succeeded" | ||
| BUILD_SUCCESS=true | ||
| else | ||
| echo "Manual build also failed" | ||
| fi | ||
| fi | ||
|
|
||
| if [ "$BUILD_SUCCESS" != "true" ]; then | ||
| echo "ERROR: All build methods failed" | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: List built packages | ||
| run: | | ||
| echo "Built packages:" | ||
| if ! ls -la ../*.deb 2>/dev/null; then | ||
| echo "ERROR: No .deb files found in parent directory" | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Verify package contents | ||
| run: | | ||
| # Check for open-vmdk package (required) | ||
| if ! ls ../open-vmdk_*.deb 1> /dev/null 2>&1; then | ||
| echo "ERROR: open-vmdk package not found" | ||
| exit 1 | ||
| fi | ||
| echo "=== open-vmdk package info ===" | ||
| dpkg-deb -I ../open-vmdk_*.deb | ||
| echo "" | ||
| echo "=== open-vmdk package contents ===" | ||
| dpkg-deb -c ../open-vmdk_*.deb | ||
|
|
||
| # Check for ovfenv package (required) | ||
| if ! ls ../ovfenv_*.deb 1> /dev/null 2>&1; then | ||
| echo "ERROR: ovfenv package not found" | ||
| exit 1 | ||
| fi | ||
| echo "" | ||
| echo "=== ovfenv package info ===" | ||
| dpkg-deb -I ../ovfenv_*.deb | ||
| echo "" | ||
| echo "=== ovfenv package contents ===" | ||
| dpkg-deb -c ../ovfenv_*.deb | ||
|
|
||
| - name: Run lintian checks | ||
| run: | | ||
| echo "Running lintian checks..." | ||
| # Both packages should exist at this point | ||
| lintian --no-tag-display-limit ../open-vmdk_*.deb || true | ||
| lintian --no-tag-display-limit ../ovfenv_*.deb || true | ||
|
|
||
| - name: Install packages | ||
| run: | | ||
| echo "Installing packages..." | ||
| # Both packages should exist at this point | ||
| dpkg -i ../open-vmdk_*.deb ../ovfenv_*.deb || true | ||
| # Fix any dependency issues | ||
| apt-get install -f -y | ||
|
|
||
| - name: Test installed binaries | ||
| run: | | ||
| echo "Testing installed binaries..." | ||
|
|
||
| # Test vmdk-convert | ||
| echo "=== Testing vmdk-convert ===" | ||
| vmdk-convert --help || vmdk-convert -h || echo "vmdk-convert help not available" | ||
| which vmdk-convert | ||
| ls -la $(which vmdk-convert) | ||
|
|
||
| # Test ova-compose | ||
| echo "=== Testing ova-compose ===" | ||
| ova-compose --help || ova-compose -h || echo "ova-compose help not available" | ||
| which ova-compose | ||
| ls -la $(which ova-compose) | ||
|
|
||
| # Test mkova.sh | ||
| echo "=== Testing mkova.sh ===" | ||
| mkova.sh --help || mkova.sh -h || echo "mkova.sh help not available" | ||
| which mkova.sh | ||
| ls -la $(which mkova.sh) | ||
|
|
||
| # Test ovfenv | ||
| echo "=== Testing ovfenv ===" | ||
| ovfenv --help || ovfenv -h || echo "ovfenv help not available" | ||
| which ovfenv | ||
| ls -la $(which ovfenv) | ||
|
|
||
| - name: Test configuration files | ||
| run: | | ||
| echo "Testing configuration files..." | ||
| echo "=== /etc/open-vmdk.conf ===" | ||
| cat /etc/open-vmdk.conf | ||
|
|
||
| echo "=== /var/lib/ovfenv directory ===" | ||
| ls -la /var/lib/ovfenv/ | ||
|
|
||
| - name: Test OVF templates | ||
| run: | | ||
| echo "Testing OVF templates..." | ||
| echo "=== Templates directory ===" | ||
| ls -la /usr/share/open-vmdk/ | ||
| echo "=== Sample template content ===" | ||
| head -20 /usr/share/open-vmdk/template-hw20.ovf | ||
|
|
||
| - name: Basic functionality test | ||
| run: | | ||
| echo "Running basic functionality tests..." | ||
|
|
||
| # Create a small test image | ||
| dd if=/dev/zero of=test.img bs=1M count=10 | ||
|
|
||
| # Test vmdk-convert | ||
| echo "Testing vmdk-convert with test image..." | ||
| vmdk-convert test.img test.vmdk || echo "vmdk-convert failed (expected in CI environment)" | ||
|
|
||
| # Clean up | ||
| rm -f test.img test.vmdk | ||
|
|
||
| - name: Copy packages to workspace | ||
| run: | | ||
| mkdir -p packages | ||
| if ! cp ../*.deb packages/ 2>/dev/null; then | ||
| echo "ERROR: Failed to copy .deb files to packages directory" | ||
| exit 1 | ||
| fi | ||
| echo "Copied packages:" | ||
| ls -la packages/ | ||
|
|
||
| - name: Upload packages as artifacts | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: debian-packages-${{ matrix.distro }} | ||
| path: packages/*.deb | ||
| retention-days: 30 | ||
|
|
||
| - name: Upload build logs | ||
| if: failure() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: build-logs-${{ matrix.distro }} | ||
| path: | | ||
| debian/ | ||
| retention-days: 7 | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.