Skip to content

Commit 5ea15b9

Browse files
committed
Update .gitignore, CI scripts, and changelog for improved package handling
- Enhance .gitignore to include additional build artifacts and editor files - Refactor CI scripts to unify package testing logic - Update changelog to reflect versioning change from beta to stable format - Remove obsolete CI test scripts for DEB and RPM packages
1 parent 9e09075 commit 5ea15b9

File tree

8 files changed

+157
-138
lines changed

8 files changed

+157
-138
lines changed

.github/workflows/packages.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ jobs:
106106
name: ${{ matrix.pkg == 'deb' && 'debian-package' || 'rpm-package' }}
107107

108108
- name: Test
109-
run: bash scripts/ci-test-${{ matrix.pkg }}.sh ${{ matrix.pkg == 'deb' && './sqlpage*.deb' || './x86_64/*.rpm' }}
109+
run: bash scripts/ci-test-package.sh ${{ matrix.pkg == 'deb' && './sqlpage*.deb' || './x86_64/*.rpm' }}
110110

111111
publish:
112112
name: Publish

.gitignore

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,43 @@
1-
# Existing ignores (if any)
2-
/target
1+
# Build artifacts and outputs
2+
/target/
3+
/build-output/
4+
/sqlpage.bin
5+
*.deb
6+
*.rpm
7+
*.tar.gz
8+
*.zip
9+
*.buildinfo
10+
*.changes
11+
12+
# Rust/Cargo
313
Cargo.lock
4-
*.swp
5-
*.swo
6-
*~
7-
.DS_Store
814

9-
# Debian packaging
15+
# Debian packaging build artifacts
1016
debian/.debhelper/
1117
debian/sqlpage/
1218
debian/cargo_home/
1319
debian/files
1420
debian/*.substvars
1521
debian/*.log
1622
debian/*.debhelper
17-
../*.deb
18-
../*.changes
19-
../*.buildinfo
23+
debian/debhelper-build-stamp
2024

21-
# RPM packaging
22-
*.rpm
25+
# RPM packaging build artifacts
26+
rpmbuild/
2327
*.src.rpm
2428

25-
# Build artifacts
26-
*.tar.gz
27-
*.zip
28-
sqlpage.bin
29+
# Editor and system files
30+
*.swp
31+
*.swo
32+
*~
33+
.DS_Store
34+
*.tmp
35+
*.temp
36+
37+
# Node modules (if any)
38+
node_modules/
39+
40+
# IDE and development files
41+
.vscode/
42+
.idea/
43+
*.code-workspace

debian/changelog

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
sqlpage (0.38.0~beta.1-1) unstable; urgency=medium
1+
sqlpage (0.38.0-beta.1-1) unstable; urgency=medium
22

33
* Initial Debian package release
44
* SQL-only webapp builder with support for multiple databases

scripts/ci-build-deb.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ mv ../*.deb build-output/
1111
mv ../*.changes build-output/ 2>/dev/null || true
1212
mv ../*.buildinfo build-output/ 2>/dev/null || true
1313

14-
lintian --no-tag-display-limit build-output/*.deb || true
15-
dpkg-deb --contents build-output/*.deb
16-
dpkg-deb --info build-output/*.deb
14+
lintian --no-tag-display-limit build-output/sqlpage_*.deb || true
15+
dpkg-deb --contents build-output/sqlpage_*.deb
16+
dpkg-deb --info build-output/sqlpage_*.deb
1717

1818
echo "✓ DEB package built successfully"

scripts/ci-test-deb.sh

Lines changed: 0 additions & 38 deletions
This file was deleted.

scripts/ci-test-package.sh

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
# Detect package manager and set variables accordingly
5+
if command -v apt-get &> /dev/null; then
6+
PACKAGE_MANAGER="apt"
7+
INSTALL_CMD="apt-get install -y"
8+
UPDATE_CMD="apt-get update -qq"
9+
QUERY_CMD="dpkg -l | grep sqlpage"
10+
SERVICE_PATH="/lib/systemd/system/sqlpage.service"
11+
elif command -v dnf &> /dev/null; then
12+
PACKAGE_MANAGER="dnf"
13+
INSTALL_CMD="dnf install -y"
14+
UPDATE_CMD=""
15+
QUERY_CMD="rpm -qi sqlpage"
16+
SERVICE_PATH="/usr/lib/systemd/system/sqlpage.service"
17+
elif command -v yum &> /dev/null; then
18+
PACKAGE_MANAGER="yum"
19+
INSTALL_CMD="yum install -y"
20+
UPDATE_CMD=""
21+
QUERY_CMD="rpm -qi sqlpage"
22+
SERVICE_PATH="/usr/lib/systemd/system/sqlpage.service"
23+
else
24+
echo "Error: No supported package manager found (apt, dnf, yum)"
25+
exit 1
26+
fi
27+
28+
PACKAGE_FILE=${1:-sqlpage*.deb}
29+
if [[ $PACKAGE_FILE == *.rpm ]]; then
30+
PACKAGE_FILE=${PACKAGE_FILE}
31+
elif [[ $PACKAGE_FILE == *.deb ]]; then
32+
PACKAGE_FILE=${PACKAGE_FILE}
33+
else
34+
# Auto-detect package type based on available files, prefer main package over debug symbols
35+
if ls sqlpage*.rpm 1> /dev/null 2>&1; then
36+
PACKAGE_FILE="sqlpage*.rpm"
37+
elif ls sqlpage*.deb 1> /dev/null 2>&1; then
38+
# Find the main package (not debug symbols)
39+
MAIN_PACKAGE=$(ls sqlpage*.deb | grep -v dbgsym | head -1)
40+
PACKAGE_FILE="$MAIN_PACKAGE"
41+
fi
42+
fi
43+
44+
echo "=== Installing package using $PACKAGE_MANAGER ==="
45+
if [[ -n "$UPDATE_CMD" ]]; then
46+
$UPDATE_CMD
47+
fi
48+
# Install the package, avoiding debug symbols if possible
49+
if [[ $PACKAGE_MANAGER == "apt" ]]; then
50+
apt-get install -y "$PACKAGE_FILE" --no-install-recommends || apt-get install -y "$PACKAGE_FILE"
51+
else
52+
$INSTALL_CMD "$PACKAGE_FILE"
53+
fi
54+
55+
echo "=== Verifying installation ==="
56+
sqlpage --version
57+
which sqlpage
58+
$QUERY_CMD
59+
60+
echo "=== Checking files ==="
61+
test -f /usr/bin/sqlpage
62+
test -d /etc/sqlpage
63+
test -f /etc/sqlpage/sqlpage.json
64+
test -d /etc/sqlpage/templates
65+
test -f "$SERVICE_PATH"
66+
test -f /usr/share/man/man1/sqlpage.1.gz
67+
68+
echo "=== Verifying systemd service ==="
69+
systemctl cat sqlpage.service || cat "$SERVICE_PATH"
70+
71+
echo "=== Verifying user ==="
72+
id sqlpage
73+
getent passwd sqlpage
74+
75+
echo "=== Testing functionality with systemd ==="
76+
echo "SELECT 'json' as component; SELECT 1 as it_works;" > /var/www/sqlpage/index.sql
77+
78+
# Enable and start the service
79+
systemctl enable sqlpage
80+
systemctl start sqlpage
81+
82+
# Wait for service to start
83+
sleep 3
84+
85+
# Test if the web interface works
86+
curl -sf http://localhost:8080/ | grep -q it_works
87+
88+
# Clean up
89+
systemctl stop sqlpage
90+
systemctl disable sqlpage
91+
92+
echo "✓ All package tests passed!"

scripts/ci-test-rpm.sh

Lines changed: 0 additions & 41 deletions
This file was deleted.

scripts/test-packages.sh

Lines changed: 29 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -29,61 +29,52 @@ log_success() {
2929
echo -e "${GREEN}[SUCCESS]${NC} $1"
3030
}
3131

32-
# Test DEB package on Debian/Ubuntu
33-
test_deb() {
32+
# Test package using unified test script
33+
test_package() {
3434
local distro=$1
3535
local version=$2
36-
log_info "Testing DEB package on $distro:$version"
37-
38-
docker run --rm -v "$PROJECT_ROOT":/workspace "$distro:$version" bash -c "
39-
set -e
40-
apt-get update
41-
apt-get install -y /workspace/../sqlpage*.deb
42-
sqlpage --version
43-
systemctl --version || true
44-
dpkg -l | grep sqlpage
45-
dpkg -L sqlpage
46-
" && log_success "DEB test passed on $distro:$version" || log_error "DEB test failed on $distro:$version"
47-
}
36+
local package_type=$3
37+
log_info "Testing $package_type package on $distro:$version"
4838

49-
# Test RPM package on Fedora/RHEL
50-
test_rpm() {
51-
local distro=$1
52-
local version=$2
53-
log_info "Testing RPM package on $distro:$version"
54-
55-
docker run --rm -v "$HOME/rpmbuild":/rpmbuild "$distro:$version" bash -c "
56-
set -e
57-
yum install -y /rpmbuild/RPMS/x86_64/sqlpage*.rpm || dnf install -y /rpmbuild/RPMS/x86_64/sqlpage*.rpm
58-
sqlpage --version
59-
systemctl --version || true
60-
rpm -qi sqlpage
61-
rpm -ql sqlpage
62-
" && log_success "RPM test passed on $distro:$version" || log_error "RPM test failed on $distro:$version"
39+
if [ "$package_type" = "deb" ]; then
40+
docker run --rm -v "$PROJECT_ROOT/build-output":/packages "$distro:$version" bash -c "
41+
apt-get update -qq
42+
PACKAGE_FILE=\$(ls /packages/sqlpage*.deb | grep -v dbgsym | head -1)
43+
echo \"Installing: \$PACKAGE_FILE\"
44+
apt-get install -y \"\$PACKAGE_FILE\"
45+
" && log_success "$package_type test passed on $distro:$version" || log_error "$package_type test failed on $distro:$version"
46+
elif [ "$package_type" = "rpm" ]; then
47+
docker run --rm -v "$HOME/rpmbuild":/rpmbuild -v "$PROJECT_ROOT/scripts":/scripts "$distro:$version" bash -c "
48+
cp /scripts/ci-test-package.sh /tmp/
49+
chmod +x /tmp/ci-test-package.sh
50+
cd /tmp
51+
./ci-test-package.sh /rpmbuild/RPMS/x86_64/sqlpage*.rpm
52+
" && log_success "$package_type test passed on $distro:$version" || log_error "$package_type test failed on $distro:$version"
53+
fi
6354
}
6455

6556
# Main test suite
6657
main() {
6758
log_info "Starting package installation tests"
6859

6960
# Test DEB packages
70-
if [ -f "$PROJECT_ROOT/../sqlpage"*.deb ]; then
61+
if ls "$PROJECT_ROOT/build-output/sqlpage"*.deb 1> /dev/null 2>&1; then
7162
log_info "Found DEB package, testing on multiple distributions..."
72-
test_deb "debian" "bookworm"
73-
test_deb "debian" "bullseye"
74-
test_deb "ubuntu" "24.04"
75-
test_deb "ubuntu" "22.04"
63+
test_package "debian" "bookworm" "deb"
64+
test_package "debian" "bullseye" "deb"
65+
test_package "ubuntu" "24.04" "deb"
66+
test_package "ubuntu" "22.04" "deb"
7667
else
7768
log_warn "No DEB package found, skipping DEB tests"
7869
fi
79-
70+
8071
# Test RPM packages
8172
if [ -d "$HOME/rpmbuild/RPMS" ] && find "$HOME/rpmbuild/RPMS" -name "sqlpage*.rpm" | grep -q .; then
8273
log_info "Found RPM package, testing on multiple distributions..."
83-
test_rpm "fedora" "latest"
84-
test_rpm "fedora" "39"
85-
test_rpm "rockylinux" "9"
86-
test_rpm "rockylinux" "8"
74+
test_package "fedora" "latest" "rpm"
75+
test_package "fedora" "39" "rpm"
76+
test_package "rockylinux" "9" "rpm"
77+
test_package "rockylinux" "8" "rpm"
8778
else
8879
log_warn "No RPM package found, skipping RPM tests"
8980
fi

0 commit comments

Comments
 (0)