Skip to content

feat: add AGENTS.md and CHANGELOG.md for development documentation an… #17

feat: add AGENTS.md and CHANGELOG.md for development documentation an…

feat: add AGENTS.md and CHANGELOG.md for development documentation an… #17

Workflow file for this run

name: CI
on:
push:
branches: [ main ]
tags:
- 'v*.*.*' # Push events to matching semantic versions only (v1.0.0, v1.2.3, etc.)
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
test-aptly-installation:
name: Test Aptly Installation
runs-on: ubuntu-24.04
strategy:
matrix:
aptly-version: ['1.6.2']
cache: ['true', 'false']
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup uv
uses: astral-sh/setup-uv@v6
with:
enable-cache: true
- name: Setup Python environment
run: |
uv venv
uv pip install -r requirements-test.txt
- name: Test aptly installation
uses: ./
with:
version: ${{ matrix.aptly-version }}
cache: ${{ matrix.cache }}
- name: Run Python test suite
run: |
source .venv/bin/activate
python test.py
test-aptly-publishing:
name: Test Aptly Publishing (Mock)
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create mock .deb files for testing
run: |
mkdir -p test-debs
# Create a minimal mock .deb file structure
mkdir -p mock-package/DEBIAN
cat > mock-package/DEBIAN/control << EOF
Package: test-package
Version: 1.0.0
Section: utils
Priority: optional
Architecture: amd64
Maintainer: Test <test@example.com>
Description: Mock package for testing
EOF
# Create the .deb file
dpkg-deb --build mock-package test-debs/test-package_1.0.0_amd64.deb
echo "Created mock .deb files:"
ls -la test-debs/
- name: Setup GPG for testing
run: |
# Create a test GPG key for signing
cat > gpg-batch << EOF
Key-Type: RSA
Key-Length: 2048
Subkey-Type: RSA
Subkey-Length: 2048
Name-Real: Test User
Name-Email: test@example.com
Expire-Date: 1y
%no-protection
%commit
EOF
gpg --batch --generate-key gpg-batch
# Export the key ID
GPG_KEY_ID=$(gpg --list-secret-keys --keyid-format LONG | grep sec | head -1 | sed 's/.*\/\([A-F0-9]*\).*/\1/')
echo "GPG_KEY_ID=$GPG_KEY_ID" >> $GITHUB_ENV
echo "Generated test GPG key: $GPG_KEY_ID"
- name: Test mock publishing workflow
uses: ./
with:
publish: true
component: test-package
distribution: noble
channel: testing
debs-path: test-debs
pages-repo: https://github.com/feelpp/apt.git
gpg-key-id: ${{ env.GPG_KEY_ID }}
apt-repo-path: .
continue-on-error: true
id: mock-publish
- name: Verify mock publishing behavior
run: |
if [ "${{ steps.mock-publish.outcome }}" = "success" ]; then
echo "✅ Mock publishing workflow completed successfully"
else
echo "⚠️ Mock publishing failed as expected (no real git access)"
echo "This is normal for the mock test environment"
fi
test-cross-platform:
name: Test Cross-Platform Support
runs-on: ${{ matrix.runner }}
strategy:
matrix:
include:
- runner: ubuntu-24.04
arch: amd64
aptly-version: '1.6.2'
- runner: ubuntu-24.04-arm
arch: arm64
aptly-version: '1.6.2'
- runner: ubuntu-22.04
arch: amd64
aptly-version: '1.6.2'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Test aptly installation on ${{ matrix.runner }} (${{ matrix.arch }})
uses: ./
with:
version: ${{ matrix.aptly-version }}
architecture: ${{ matrix.arch }}
- name: Verify cross-platform functionality
run: |
aptly version
uname -m
echo "✅ Aptly works on ${{ matrix.runner }} (${{ matrix.arch }})"
test-input-validation:
name: Test Input Validation
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Test with invalid version (should fail gracefully)
uses: ./
with:
version: '999.999.999'
continue-on-error: true
id: invalid-version
- name: Verify invalid version handling
run: |
if [ "${{ steps.invalid-version.outcome }}" = "success" ]; then
echo "❌ Expected failure for invalid version"
exit 1
else
echo "✅ Invalid version handled correctly"
fi
test-caching:
name: Test Caching Behavior
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: First run with caching enabled
uses: ./
with:
version: '1.6.2'
cache: 'true'
- name: Second run should use cache
uses: ./
with:
version: '1.6.2'
cache: 'true'
- name: Verify caching works
run: |
echo "✅ Caching behavior verified"
integration-test:
name: Integration Test
runs-on: ubuntu-24.04
needs: [test-aptly-installation, test-cross-platform]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Full integration test
uses: ./
with:
version: '1.6.2'
cache: 'true'
- name: Test aptly functionality
run: |
set -e
echo "Testing aptly functionality..."
# Test repository operations
aptly repo create integration-test-repo
aptly repo list | grep integration-test-repo
# Test snapshot operations
aptly snapshot create empty-snapshot from repo integration-test-repo
aptly snapshot list | grep empty-snapshot
# Test cleanup
aptly snapshot drop empty-snapshot
aptly repo drop integration-test-repo
echo "✅ Aptly functionality verified"
test-python:
name: Test Python Components
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup uv
uses: astral-sh/setup-uv@v6
with:
enable-cache: true
- name: Setup Python environment and install dependencies
run: |
uv venv
uv pip install -r requirements-test.txt
- name: Install aptly for testing
uses: ./
with:
version: '1.6.2'
cache: 'true'
- name: Run Python tests
run: |
source .venv/bin/activate
python -m pytest tests/ -v --tb=short
- name: Run local Python test script
run: |
source .venv/bin/activate
python test.py
release:
name: Create Release
runs-on: ubuntu-24.04
if: startsWith(github.ref, 'refs/tags/v')
needs: [test-aptly-installation, test-aptly-publishing, test-cross-platform, test-input-validation, test-caching, integration-test, test-python]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create or Update Release
id: release
continue-on-error: true
uses: softprops/action-gh-release@v2
with:
draft: false
prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') || contains(github.ref, 'rc')}}
name: Release ${{ github.ref_name }}
generate_release_notes: true
tag_name: ${{ github.ref }}
token: ${{ secrets.GITHUB_TOKEN }}
make_latest: ${{ !contains(github.ref, 'alpha') && !contains(github.ref, 'beta') && !contains(github.ref, 'rc') }}
fail_on_unmatched_files: false
- name: Handle existing release
if: steps.release.outcome == 'failure'
run: |
echo "Release may already exist for tag ${{ github.ref_name }}"
echo "This can happen when the release was created via GitHub UI"
echo "The major version tag will still be updated below"
echo "⚠️ Release creation skipped - release may already exist"
- name: Update major version tag
if: ${{ !contains(github.ref, 'alpha') && !contains(github.ref, 'beta') && !contains(github.ref, 'rc') }}
run: |
# Extract major version from tag (e.g., v1.2.3 -> v1)
TAG_NAME=${GITHUB_REF#refs/tags/}
MAJOR_VERSION=$(echo $TAG_NAME | sed -E 's/^(v[0-9]+)\..*/\1/')
echo "Updating major version tag $MAJOR_VERSION to point to $TAG_NAME"
# Configure git
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
# Create/update the major version tag
git tag -f $MAJOR_VERSION
git push origin $MAJOR_VERSION --force