Skip to content

Commit a495345

Browse files
committed
Simplify CI workflow and remove unnecessary freetds dependency
- Remove freetds-dev build dependency (not needed - MSSQL uses ODBC only) - Consolidate workflow from 268 to 224 lines (-44 lines) - Update build scripts to handle dependency installation - Keep test scripts separate for clarity
1 parent 383e526 commit a495345

File tree

5 files changed

+71
-140
lines changed

5 files changed

+71
-140
lines changed

.github/workflows/packages.yml

Lines changed: 15 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ permissions:
2525
jobs:
2626
build-deb:
2727
name: Build Debian Package
28-
runs-on: ubuntu-20.04 # Use older Ubuntu for wider glibc compatibility
28+
runs-on: ubuntu-20.04
2929
steps:
3030
- uses: actions/checkout@v4
3131
with:
@@ -34,17 +34,8 @@ jobs:
3434
- name: Install build dependencies
3535
run: |
3636
sudo apt-get update
37-
sudo apt-get install -y \
38-
debhelper \
39-
dh-make \
40-
devscripts \
41-
lintian \
42-
dpkg-dev \
43-
build-essential \
44-
unixodbc-dev \
45-
freetds-dev \
46-
libssl-dev \
47-
pkg-config
37+
sudo apt-get install -y debhelper dpkg-dev build-essential \
38+
libssl-dev pkg-config unixodbc-dev lintian
4839
4940
- name: Install Rust toolchain
5041
uses: dtolnay/rust-toolchain@stable
@@ -54,29 +45,18 @@ jobs:
5445
- name: Set up cargo cache
5546
uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6
5647

57-
- name: Build Debian package
48+
- name: Build package
5849
run: |
59-
# Update changelog with current version
6050
VERSION=$(grep '^version = ' Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/')
6151
sed -i "1s/.*/sqlpage ($VERSION-1) unstable; urgency=medium/" debian/changelog
62-
63-
# Build package (use -d to bypass build dependency checks since Rust is provided by CI)
6452
dpkg-buildpackage -us -uc -b -d
65-
66-
- name: Collect build artifacts
67-
run: |
53+
6854
mkdir -p build-output
69-
mv ../*.deb build-output/ || true
55+
mv ../*.deb build-output/
7056
mv ../*.changes build-output/ || true
7157
mv ../*.buildinfo build-output/ || true
72-
ls -lh build-output/
73-
74-
- name: Run lintian checks
75-
run: |
58+
7659
lintian --no-tag-display-limit build-output/*.deb || true
77-
78-
- name: List package contents
79-
run: |
8060
dpkg-deb --contents build-output/*.deb
8161
dpkg-deb --info build-output/*.deb
8262
@@ -97,7 +77,7 @@ jobs:
9777
build-rpm:
9878
name: Build RPM Package
9979
runs-on: ubuntu-latest
100-
container: quay.io/pypa/manylinux_2_28_x86_64 # Maximum glibc compatibility (glibc 2.28)
80+
container: quay.io/pypa/manylinux_2_28_x86_64
10181
steps:
10282
- name: Install git for checkout
10383
run: yum install -y git
@@ -110,15 +90,7 @@ jobs:
11090
run: git config --global --add safe.directory /__w/SQLPage/SQLPage
11191

11292
- name: Install build dependencies
113-
run: |
114-
yum update -y
115-
yum install -y \
116-
rpm-build \
117-
rpmdevtools \
118-
openssl-devel \
119-
systemd \
120-
unixODBC-devel \
121-
freetds-devel
93+
run: yum install -y rpm-build rpmdevtools openssl-devel systemd unixODBC-devel
12294

12395
- name: Install Rust toolchain
12496
uses: dtolnay/rust-toolchain@stable
@@ -128,37 +100,22 @@ jobs:
128100
- name: Set up cargo cache
129101
uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6
130102

131-
- name: Set up RPM build tree
132-
run: rpmdev-setuptree
133-
134-
- name: Update spec file version
103+
- name: Build package
135104
run: |
105+
rpmdev-setuptree
136106
VERSION=$(grep '^version = ' Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/')
137-
# RPM doesn't allow hyphens in Version field, convert to tilde for pre-releases
138107
RPM_VERSION=$(echo "$VERSION" | sed 's/-/~/')
108+
139109
sed -i "s/^Version:.*/Version: ${RPM_VERSION}/" rpm/sqlpage.spec
140110
cp rpm/sqlpage.spec ~/rpmbuild/SPECS/
141-
142-
- name: Create source tarball
143-
run: |
144-
VERSION=$(grep '^version = ' Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/')
145-
RPM_VERSION=$(echo "$VERSION" | sed 's/-/~/')
146-
# Create tarball with version prefix matching spec file Source0
111+
147112
git archive --format=tar.gz --prefix="SQLPage-${RPM_VERSION}/" \
148113
-o ~/rpmbuild/SOURCES/v${RPM_VERSION}.tar.gz HEAD
149-
150-
- name: Build RPM package
151-
run: |
152-
# Use --nodeps to bypass build dependency checks since Rust is provided by CI
114+
153115
rpmbuild -ba --nodeps ~/rpmbuild/SPECS/sqlpage.spec
154-
155-
- name: Run rpmlint checks
156-
run: |
116+
157117
rpmlint ~/rpmbuild/RPMS/*/sqlpage*.rpm || true
158118
rpmlint ~/rpmbuild/SRPMS/sqlpage*.rpm || true
159-
160-
- name: List package contents
161-
run: |
162119
rpm -qilp ~/rpmbuild/RPMS/*/sqlpage*.rpm
163120
164121
- name: Upload RPM package

debian/control

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ Build-Depends: debhelper-compat (= 13),
88
rustc (>= 1.70),
99
libssl-dev,
1010
pkg-config,
11-
unixodbc-dev,
12-
freetds-dev
11+
unixodbc-dev
1312
Standards-Version: 4.6.2
1413
Homepage: https://sql-page.com
1514
Vcs-Browser: https://github.com/sqlpage/SQLPage

rpm/sqlpage.spec

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ BuildRequires: cargo >= 1.70
1919
BuildRequires: openssl-devel
2020
BuildRequires: systemd-rpm-macros
2121
BuildRequires: unixODBC-devel
22-
BuildRequires: freetds-devel
2322

2423
Requires: unixODBC
2524
Recommends: sqlite

scripts/build-deb.sh

Lines changed: 32 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
#!/bin/bash
22
set -euo pipefail
33

4-
# Build Debian package for SQLPage
5-
# This script builds a .deb package following Debian best practices
6-
74
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
85
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
96

10-
# Colors for output
117
RED='\033[0;31m'
128
GREEN='\033[0;32m'
139
YELLOW='\033[1;33m'
14-
NC='\033[0m' # No Color
10+
NC='\033[0m'
1511

1612
log_info() {
1713
echo -e "${GREEN}[INFO]${NC} $1"
@@ -25,45 +21,45 @@ log_error() {
2521
echo -e "${RED}[ERROR]${NC} $1"
2622
}
2723

28-
# Check if we're on a Debian-based system
29-
if ! command -v dpkg-buildpackage &> /dev/null; then
30-
log_error "dpkg-buildpackage not found. Install it with: apt-get install dpkg-dev"
31-
exit 1
32-
fi
24+
cd "$PROJECT_ROOT"
3325

34-
# Check for required tools
35-
MISSING_DEPS=()
36-
if ! command -v debhelper &> /dev/null; then
37-
MISSING_DEPS+=("debhelper")
38-
fi
39-
if ! command -v cargo &> /dev/null; then
40-
MISSING_DEPS+=("cargo")
26+
log_info "Installing build dependencies..."
27+
if command -v apt-get &> /dev/null; then
28+
sudo apt-get update -qq
29+
sudo apt-get install -y \
30+
debhelper \
31+
dpkg-dev \
32+
build-essential \
33+
libssl-dev \
34+
pkg-config \
35+
unixodbc-dev \
36+
lintian
4137
fi
4238

43-
if [ ${#MISSING_DEPS[@]} -gt 0 ]; then
44-
log_error "Missing dependencies: ${MISSING_DEPS[*]}"
45-
log_info "Install them with: apt-get install ${MISSING_DEPS[*]}"
39+
if ! command -v cargo &> /dev/null; then
40+
log_error "Rust/Cargo not found. Install from https://rustup.rs"
4641
exit 1
4742
fi
4843

49-
cd "$PROJECT_ROOT"
50-
51-
log_info "Cleaning previous builds..."
52-
rm -rf debian/.debhelper debian/sqlpage debian/cargo_home
53-
cargo clean || true
44+
log_info "Updating changelog with current version..."
45+
VERSION=$(grep '^version = ' Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/')
46+
sed -i "1s/.*/sqlpage ($VERSION-1) unstable; urgency=medium/" debian/changelog
5447

5548
log_info "Building Debian package..."
56-
dpkg-buildpackage -us -uc -b
49+
dpkg-buildpackage -us -uc -b -d
5750

58-
log_info "Package built successfully!"
59-
log_info "Output files:"
60-
ls -lh ../*.deb || true
51+
log_info "Collecting build artifacts..."
52+
mkdir -p build-output
53+
mv ../*.deb build-output/ 2>/dev/null || true
54+
mv ../*.changes build-output/ 2>/dev/null || true
55+
mv ../*.buildinfo build-output/ 2>/dev/null || true
6156

62-
# Run lintian if available
63-
if command -v lintian &> /dev/null; then
64-
log_info "Running lintian checks..."
65-
lintian ../*.deb || log_warn "Some lintian checks failed (this may be acceptable)"
66-
fi
57+
log_info "Running lintian checks..."
58+
lintian --no-tag-display-limit build-output/*.deb || log_warn "Some lintian checks failed"
59+
60+
log_info "Package contents:"
61+
dpkg-deb --contents build-output/*.deb
62+
dpkg-deb --info build-output/*.deb
6763

68-
log_info "Done! Package is ready at:"
69-
readlink -f ../*.deb || true
64+
log_info "Done! Package ready at:"
65+
ls -lh build-output/*.deb

scripts/build-rpm.sh

Lines changed: 23 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
#!/bin/bash
22
set -euo pipefail
33

4-
# Build RPM package for SQLPage
5-
# This script builds an .rpm package following RPM best practices
6-
74
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
85
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
96

10-
# Colors for output
117
RED='\033[0;31m'
128
GREEN='\033[0;32m'
139
YELLOW='\033[1;33m'
14-
NC='\033[0m' # No Color
10+
NC='\033[0m'
1511

1612
log_info() {
1713
echo -e "${GREEN}[INFO]${NC} $1"
@@ -25,60 +21,44 @@ log_error() {
2521
echo -e "${RED}[ERROR]${NC} $1"
2622
}
2723

28-
# Check if we're on an RPM-based system
29-
if ! command -v rpmbuild &> /dev/null; then
30-
log_error "rpmbuild not found. Install it with: yum install rpm-build or dnf install rpm-build"
31-
exit 1
32-
fi
24+
cd "$PROJECT_ROOT"
3325

34-
# Check for required tools
35-
MISSING_DEPS=()
36-
if ! command -v cargo &> /dev/null; then
37-
MISSING_DEPS+=("cargo")
38-
fi
39-
if ! command -v rpmdev-setuptree &> /dev/null; then
40-
MISSING_DEPS+=("rpmdevtools")
26+
log_info "Installing build dependencies..."
27+
if command -v dnf &> /dev/null; then
28+
sudo dnf install -y rpm-build rpmdevtools openssl-devel systemd unixODBC-devel
29+
elif command -v yum &> /dev/null; then
30+
sudo yum install -y rpm-build rpmdevtools openssl-devel systemd unixODBC-devel
4131
fi
4232

43-
if [ ${#MISSING_DEPS[@]} -gt 0 ]; then
44-
log_error "Missing dependencies: ${MISSING_DEPS[*]}"
45-
log_info "Install them with: yum install ${MISSING_DEPS[*]} or dnf install ${MISSING_DEPS[*]}"
33+
if ! command -v cargo &> /dev/null; then
34+
log_error "Rust/Cargo not found. Install from https://rustup.rs"
4635
exit 1
4736
fi
4837

49-
cd "$PROJECT_ROOT"
50-
51-
# Setup RPM build tree
5238
log_info "Setting up RPM build tree..."
5339
rpmdev-setuptree
5440

55-
# Get version from Cargo.toml
5641
VERSION=$(grep '^version = ' Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/')
57-
log_info "Building RPM for version $VERSION"
42+
RPM_VERSION=$(echo "$VERSION" | sed 's/-/~/')
43+
log_info "Building RPM for version $VERSION (RPM: $RPM_VERSION)"
5844

59-
# Copy spec file
60-
log_info "Copying spec file..."
45+
log_info "Updating spec file version..."
46+
sed -i "s/^Version:.*/Version: ${RPM_VERSION}/" rpm/sqlpage.spec
6147
cp rpm/sqlpage.spec ~/rpmbuild/SPECS/
6248

63-
# Create source tarball
6449
log_info "Creating source tarball..."
65-
TARBALL="sqlpage-${VERSION}.tar.gz"
66-
git archive --format=tar.gz --prefix="SQLPage-${VERSION}/" -o ~/rpmbuild/SOURCES/"$TARBALL" HEAD
50+
git archive --format=tar.gz --prefix="SQLPage-${RPM_VERSION}/" \
51+
-o ~/rpmbuild/SOURCES/v${RPM_VERSION}.tar.gz HEAD
6752

68-
# Build the RPM
6953
log_info "Building RPM package..."
70-
rpmbuild -ba ~/rpmbuild/SPECS/sqlpage.spec
54+
rpmbuild -ba --nodeps ~/rpmbuild/SPECS/sqlpage.spec
7155

72-
log_info "Package built successfully!"
73-
log_info "Output files:"
74-
find ~/rpmbuild/RPMS -name "sqlpage*.rpm" -exec ls -lh {} \;
75-
find ~/rpmbuild/SRPMS -name "sqlpage*.rpm" -exec ls -lh {} \;
56+
log_info "Running rpmlint checks..."
57+
rpmlint ~/rpmbuild/RPMS/*/sqlpage*.rpm || log_warn "Some rpmlint checks failed"
58+
rpmlint ~/rpmbuild/SRPMS/sqlpage*.rpm || true
7659

77-
# Run rpmlint if available
78-
if command -v rpmlint &> /dev/null; then
79-
log_info "Running rpmlint checks..."
80-
rpmlint ~/rpmbuild/RPMS/*/sqlpage*.rpm || log_warn "Some rpmlint checks failed (this may be acceptable)"
81-
fi
60+
log_info "Package contents:"
61+
rpm -qilp ~/rpmbuild/RPMS/*/sqlpage*.rpm
8262

83-
log_info "Done! Packages are ready at:"
84-
find ~/rpmbuild/RPMS -name "sqlpage*.rpm" -o -path ~/rpmbuild/SRPMS -name "sqlpage*.rpm"
63+
log_info "Done! Packages ready at:"
64+
find ~/rpmbuild/RPMS ~/rpmbuild/SRPMS -name "sqlpage*.rpm" -exec ls -lh {} \;

0 commit comments

Comments
 (0)