Skip to content

Build Linux Packages - #78

Merged
christianhelle merged 27 commits into
masterfrom
linux-deploy
May 6, 2025
Merged

christianhelle merged 27 commits into
masterfrom
linux-deploy

Conversation

@christianhelle

@christianhelle christianhelle commented May 6, 2025 •

Copy link
Copy Markdown
Owner

This pull request introduces significant changes to the build and packaging workflows for the SQLiteQueryAnalyzer project. The modifications transition the project from using qmake and make to a CMake-based workflow, add support for packaging using CPack, and enhance cross-platform build scripts. Below are the most important changes grouped by theme:

Workflow and Build System Updates

  • Updated .github/workflows/linux.yml to replace qmake and make with CMake commands for building, installing, and packaging. Added steps to generate multiple package formats (e.g., .tar.gz, .deb, .rpm) and publish artifacts. ([.github/workflows/linux.ymlR27-R59](https://github.com/christianhelle/sqlitequery/pull/78/files#diff-21364b2e6fae1f2875cee1ab3daefb0685403687eaf8bc32b5c6eacda351c9d3R27-R59))

Packaging Configuration

  • Added CPack configuration to src/project/CMakeLists.txt, including package metadata (e.g., name, description, vendor) and dependencies for Debian packages. ([src/project/CMakeLists.txtR69-R78](https://github.com/christianhelle/sqlitequery/pull/78/files#diff-d0b751957f9fb4c59680d6ce93db372b62d73a014e7986575db3ba0b1aff67ccR69-R78))
  • Adjusted installation paths in CMakeLists.txt to ensure proper runtime and bundle destinations. ([src/project/CMakeLists.txtL59-R60](https://github.com/christianhelle/sqlitequery/pull/78/files#diff-d0b751957f9fb4c59680d6ce93db372b62d73a014e7986575db3ba0b1aff67ccL59-R60))

Cross-Platform Build Script Enhancements

  • Enhanced src/project/build.ps1 to support packaging and installation on Linux and macOS. Introduced new flags (-Package, -Install) and added CPack commands for generating multiple package formats. ([src/project/build.ps1L3-R46](https://github.com/christianhelle/sqlitequery/pull/78/files#diff-3de23a5a48e2c382cd3171ccf8f406735f8588df45aeb0af436822b521fbf0ddL3-R46))

Summary by CodeRabbit

  • New Features

    • Added packaging support for multiple archive formats (7Z, ZIP, TBZ2, TGZ, TXZ, TZ) and Linux packages (DEB, RPM).
    • Introduced an install option in the build script for Linux, allowing direct installation and creation of a symlink for easier access.
    • Added post-install and pre-removal scripts to manage executable symlinks on Linux packages.
  • Improvements

    • Switched the build system to use CMake for configuration, building, and packaging.
    • Enhanced build scripts for clearer separation and consistent handling of build, package, and install steps across platforms.
    • Updated workflow to upload packaged artifacts with version and platform-specific naming.

@christianhelle
christianhelle requested a review from Copilot May 6, 2025 14:49
@christianhelle christianhelle self-assigned this May 6, 2025
@christianhelle christianhelle added the build CI / CD label May 6, 2025
@christianhelle christianhelle linked an issue May 6, 2025 that may be closed by this pull request
3 of 4 tasks
@coderabbitai

coderabbitai Bot commented May 6, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

The changes transition the Linux build and packaging process from QMake/Make to CMake/CPack, update the GitHub workflow to automate version string replacement and artifact uploads, and enhance the PowerShell build script with explicit build, package, and install steps for multiple platforms. CPack packaging metadata, Debian control scripts, and install destinations are also refined in the CMake configuration.

Changes

File(s) Change Summary
.github/workflows/linux.yml Switched build system from QMake/Make to CMake; added version string update in CMakeLists.txt; configured packaging with CPack for multiple archive and Linux package formats; added artifact upload step with version and platform naming.
src/project/CMakeLists.txt Modified install destinations for bundle/runtime; added CPack configuration for package metadata, install prefix, Debian maintainer and dependencies; referenced Debian package control scripts (postinst, prerm); enabled packaging support.
src/project/build.ps1 Added [switch] $Install parameter; renamed $package to $Package; refined build/packaging logic for Windows, Linux, and macOS; added explicit install step and symlink creation on Linux; improved parameter consistency and platform separation.
src/project/postinst Added post-install script creating symlink /usr/bin/sqlitequery pointing to /opt/sqlitequery/bin/SQLiteQueryAnalyzer.
src/project/prerm Added pre-removal script removing /usr/bin/sqlitequery symlink during package uninstall or upgrade.

Sequence Diagram(s)

sequenceDiagram
    participant GitHub Actions
    participant Build Script
    participant CMake
    participant CPack
    participant Artifact Store

    GitHub Actions->>Build Script: Trigger Linux workflow
    Build Script->>CMake: Configure & build (Release, install prefix)
    Build Script->>CMake: Install to prefix (if requested)
    Build Script->>CPack: Package in multiple archive and Linux package formats (if requested)
    Build Script->>Artifact Store: Upload packaged artifacts with version/platform naming
Loading

Possibly related PRs

  • Fix Windows build #77: Modifies GitHub Actions workflows to update the version string in CMakeLists.txt and improve build steps, focusing on Windows workflow and version update improvements, related by version update automation in workflows.

Poem

🐇
Hopped from QMake to CMake’s den,
Packed with CPack, again and again.
Artifacts bundled, zipped, and neat,
Linux, Windows, all complete!
With scripts refined and steps anew,
This bunny builds for every crew.
🗃️✨


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request updates the Linux build workflow for the SQLiteQueryAnalyzer project by transitioning to a CMake-based build system, integrating CPack for packaging, and enhancing cross-platform build scripts.

  • Replaces QMake/Make with CMake commands and steps to generate multi-format packages.
  • Updates package metadata and installation paths in CMakeLists.txt.
  • Enhances the PowerShell build script to support Linux and macOS installation and packaging.
Files not reviewed (2)
  • src/project/CMakeLists.txt: Language not supported
  • src/project/build.ps1: Language not supported

Comment thread .github/workflows/linux.yml Outdated
Comment thread .github/workflows/linux.yml Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (3)
src/project/CMakeLists.txt (1)

70-78: Good CPack configuration setup

The CPack configuration is well-structured with all necessary metadata for proper package generation. The Debian dependencies (libc6, libstdc++6, libgcc-s1) are appropriate standard system libraries.

Consider also adding RPM package dependencies with CPACK_RPM_PACKAGE_DEPENDS for more comprehensive cross-platform packaging support.

.github/workflows/linux.yml (1)

53-58: Missing newline at end of file

The artifact publication looks good, but there's a missing newline character at the end of the file.

Add a newline character at the end of the file to comply with YAML best practices.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 58-58: no new line character at the end of file

(new-line-at-end-of-file)

src/project/build.ps1 (1)

39-46: Redundant conditional check for macOS packaging

The macOS build section has a redundant conditional check for $Package.

Line 43's if ($Package) check is redundant since the entire block at line 39 already checks if ($IsMacOS -And $Package). You can remove the nested condition and keep the macdeployqt command.

-if ($IsMacOS -And $Package) {
+if ($IsMacOS) {
     
     cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/tmp/sqlitequery
     cmake --build build --config Release --parallel 32
-    if ($Package) {
+    if ($Package) {
         macdeployqt build/SQLiteQueryAnalyzer.app -dmg -appstore-compliant
     }
 }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0d04d17 and f5e8b1c.

📒 Files selected for processing (3)
  • .github/workflows/linux.yml (1 hunks)
  • src/project/CMakeLists.txt (2 hunks)
  • src/project/build.ps1 (1 hunks)
🧰 Additional context used
🪛 YAMLlint (1.35.1)
.github/workflows/linux.yml

[error] 58-58: no new line character at the end of file

(new-line-at-end-of-file)

🔇 Additional comments (5)
src/project/CMakeLists.txt (1)

59-60: Well-structured installation path changes

The updates to installation paths are appropriate. Using the current directory for BUNDLE and ${CMAKE_INSTALL_BINDIR} for RUNTIME follows CMake best practices and provides better consistency with standard installation locations.

.github/workflows/linux.yml (3)

27-28: Consistent version management

Good approach to update the version in CMakeLists.txt, which aligns with the migration to CMake build system.


36-41: Well-structured CMake build process

The transition from qmake/make to CMake is well-implemented with appropriate configuration for Release builds and installation paths.


42-52: Comprehensive package format support

Excellent addition of multiple package formats using CPack, which will improve distribution options for different Linux environments.

src/project/build.ps1 (1)

1-7: Improved parameter structure

The parameter structure is now more consistent and provides separate control for packaging and installation operations.

Comment thread src/project/build.ps1

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
.github/workflows/linux.yml (1)

53-58: Missing newline at end of file

While the artifact publishing looks good, the file is missing a newline at the end, which some tools flag as an issue.

          src/project/SQLiteQueryAnalyzer-${{ env.VERSION }}-Linux.*
+
🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 58-58: no new line character at the end of file

(new-line-at-end-of-file)

src/project/build.ps1 (1)

39-45: Redundant package condition check in macOS section

The macOS section checks $Package twice - once in the outer if statement and again in the nested if. This is redundant and could be simplified.

-if ($IsMacOS -And $Package) {
+if ($IsMacOS) {
     
     cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/tmp/sqlitequery
     cmake --build build --config Release --parallel 32
     if ($Package) {
         macdeployqt build/SQLiteQueryAnalyzer.app -dmg -appstore-compliant
     }
}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0d04d17 and f5e8b1c.

📒 Files selected for processing (3)
  • .github/workflows/linux.yml (1 hunks)
  • src/project/CMakeLists.txt (2 hunks)
  • src/project/build.ps1 (1 hunks)
🧰 Additional context used
🪛 YAMLlint (1.35.1)
.github/workflows/linux.yml

[error] 58-58: no new line character at the end of file

(new-line-at-end-of-file)

🔇 Additional comments (7)
src/project/CMakeLists.txt (2)

59-60: Updated installation destinations improve deployment consistency

The updated BUNDLE and RUNTIME destinations properly align with CMake best practices. Setting BUNDLE DESTINATION to "." ensures the application bundle is installed in the expected location, while updating RUNTIME DESTINATION to ${CMAKE_INSTALL_BINDIR} follows standard system directory conventions.


70-78:

Details

✅ Verification successful

Well-structured CPack configuration for multi-format packaging

The CPack configuration is comprehensive and properly sets up metadata for various package formats. The installation prefix in /opt is appropriate for standalone applications, and the Debian package dependencies cover the essential runtime libraries.

One suggestion to consider - verify that the installation prefix is consistent across all your build scripts and documentation.


🏁 Script executed:

#!/bin/bash
# Check for consistency of installation paths across build files
grep -r "CMAKE_INSTALL_PREFIX\|CPACK_PACKAGING_INSTALL_PREFIX" .github/workflows/ src/project/

Length of output: 505


Installation prefix consistency verified

The CI workflows and PowerShell build scripts use CMAKE_INSTALL_PREFIX=/tmp/sqlitequery to stage files, while CPACK_PACKAGING_INSTALL_PREFIX is deliberately set to /opt/sqlitequery in CMakeLists.txt for the final package install location. These values serve different purposes (staging vs. target installation) and are intentionally distinct—no changes required.

.github/workflows/linux.yml (3)

27-28: Effective version string replacement strategy

The PowerShell commands correctly update the version string in CMakeLists.txt, ensuring consistent versioning across the project.


36-41: Build process successfully modernized to use CMake

The transition from qmake/make to CMake with explicit build type and installation prefix is a significant improvement. The parallel build flag will accelerate CI builds on multicore systems.


42-52: Comprehensive packaging strategy with multiple formats

The CPack commands generate an impressive variety of package formats (archives and Linux-specific packages), providing excellent distribution flexibility.

src/project/build.ps1 (2)

3-6: Parameter naming improved and installation option added

Capitalizing $Package follows PowerShell conventions, and adding the $Install switch provides useful flexibility for users.


18-31: Comprehensive Linux build and packaging configuration

The updated Linux build section properly configures CMake with release mode and generates multiple package formats consistent with the GitHub workflow.

Comment thread src/project/build.ps1

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
src/project/CMakeLists.txt (2)

10-13: Multi-line formatting for macOS resource is acceptable but consider consistency.
The refactored set_source_files_properties call remains functionally identical. For readability, ensure that similar blocks elsewhere follow this indentation and quoting style (e.g., no unnecessary quotes around paths unless required).


56-58: Unify indentation for target_link_libraries.
The extra indentation here differs from the earlier Qt::Core/Gui/Sql block. For consistency, align the lists in all target_link_libraries calls:

-if ((QT_VERSION_MAJOR GREATER 4))
-  target_link_libraries(SQLiteQueryAnalyzer PRIVATE
-            Qt::Widgets
-  )
-endif ()
+if (QT_VERSION_MAJOR GREATER 4)
+  target_link_libraries(SQLiteQueryAnalyzer PRIVATE Qt::Widgets)
+endif()
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f5e8b1c and f3e06d4.

📒 Files selected for processing (3)
  • src/project/CMakeLists.txt (3 hunks)
  • src/project/postinst (1 hunks)
  • src/project/prerm (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • src/project/prerm
  • src/project/postinst
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: macos-intel / template
  • GitHub Check: build
🔇 Additional comments (1)
src/project/CMakeLists.txt (1)

62-63: Verify install destinations for all platforms.
Installing BUNDLE DESTINATION . is intended for macOS bundles, while RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} targets executables on other systems. Confirm in CI and package tests that:

  1. On macOS, the .app ends up at <prefix>/SQLiteQueryAnalyzer.app.
  2. On Linux/Windows, the binary installs to <prefix>/bin (as per CMAKE_INSTALL_BINDIR).

Comment on lines +73 to +83
set(CPACK_PACKAGE_NAME SQLiteQueryAnalyzer)
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "SQLite Query Analyzer")
set(CPACK_PACKAGE_VENDOR "Christian Resma Helle")
set(CPACK_PACKAGE_INSTALL_DIRECTORY ${CPACK_PACKAGE_NAME})
set(CPACK_VERBATIM_VARIABLES ON)
set(CPACK_PACKAGING_INSTALL_PREFIX "/opt/sqlitequery")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Christian Resma Helle <crhelle@proton.me>")
set(CPACK_DEBIAN_PACKAGE_DEPENDS libxcb-xinerama0)
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_SOURCE_DIR}/postinst" PARENT_SCOPE)
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_SOURCE_DIR}/prerm" PARENT_SCOPE)
include(CPack)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix Debian control script inclusion to avoid overriding.
Currently, two separate set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA … PARENT_SCOPE) calls will overwrite each other, causing only prerm to be installed. Combine them into a single list and drop PARENT_SCOPE (unnecessary at top-level):

-set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_SOURCE_DIR}/postinst" PARENT_SCOPE)
-set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_SOURCE_DIR}/prerm" PARENT_SCOPE)
+set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
+    "${CMAKE_CURRENT_SOURCE_DIR}/postinst"
+    "${CMAKE_CURRENT_SOURCE_DIR}/prerm"
+)

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

♻️ Duplicate comments (2)
src/project/build.ps1 (2)

33-36: ⚠️ Potential issue

Linux installation symlink is reversed.

The symbolic link command has the source and target reversed. It should create a symlink from the system directory to the installed binary, not the other way around.

if ($Install) {
    cmake --install build
-    ln -s ~/.local/bin/sqlitequery /tmp/sqlitequery/bin/SQLiteQueryAnalyzer
+    mkdir -p ~/.local/bin
+    ln -s /tmp/sqlitequery/bin/SQLiteQueryAnalyzer ~/.local/bin/sqlitequery
}

Additionally, you should create the ~/.local/bin directory if it doesn't exist, as it's not guaranteed to be present on all Linux distributions.


33-36: 🛠️ Refactor suggestion

Consider a more reliable installation location than /tmp

Using /tmp for installation is problematic as this directory is cleared on system reboot on most Linux distributions, leading to lost installations.

Consider using a more persistent location aligned with the XDG specification:

if ($Install) {
-   cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/tmp/sqlitequery
+   cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$env:HOME/.local"
    cmake --build build --config Release --parallel 32
    cmake --install build
-   ln -s ~/.local/bin/sqlitequery /tmp/sqlitequery/bin/SQLiteQueryAnalyzer
}

This installs directly to a user-specific location that persists across reboots and follows the XDG specification, eliminating the need for manual symlink creation.

🧹 Nitpick comments (3)
.github/workflows/linux.yml (2)

36-40: The CMake configuration looks good, but there's a redundant prefix setting.

The --prefix flag in the install command is redundant since you've already set the install prefix during configuration. Both are using the same value, so it's not causing issues, but one of them is unnecessary.

  cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/tmp/sqlitequery .
  cmake --build . --config Release --parallel 32
- cmake --install . --config Release --prefix /tmp/sqlitequery
+ cmake --install . --config Release

53-58: Artifact publishing looks good, but missing newline at end of file.

The artifact naming is correct, and the path pattern will capture all generated package formats.

Add a newline at the end of the file to satisfy YAML linting requirements:

  path: |
    src/project/SQLiteQueryAnalyzer-${{ env.VERSION }}-Linux.*
+
🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 58-58: no new line character at the end of file

(new-line-at-end-of-file)

src/project/build.ps1 (1)

39-46: macOS build block has a redundant condition.

The condition on line 39 already checks for $IsMacOS -And $Package, making the inner if ($Package) check redundant.

-if ($IsMacOS -And $Package) {
+if ($IsMacOS) {
    
    cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/tmp/sqlitequery
    cmake --build build --config Release --parallel 32
    if ($Package) {
        macdeployqt build/SQLiteQueryAnalyzer.app -dmg -appstore-compliant
    }
}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f3e06d4 and 29605d8.

📒 Files selected for processing (5)
  • .github/workflows/linux.yml (1 hunks)
  • src/project/CMakeLists.txt (3 hunks)
  • src/project/build.ps1 (1 hunks)
  • src/project/postinst (1 hunks)
  • src/project/prerm (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/project/prerm
  • src/project/postinst
  • src/project/CMakeLists.txt
🧰 Additional context used
🪛 YAMLlint (1.35.1)
.github/workflows/linux.yml

[error] 58-58: no new line character at the end of file

(new-line-at-end-of-file)

🔇 Additional comments (5)
.github/workflows/linux.yml (2)

27-28: Version string update in CMakeLists.txt looks good.

The script now updates the version in the CMakeLists.txt file to maintain consistency with the version defined in the environment variables, which is an important part of the transition to CMake-based builds.


42-52: Comprehensive packaging approach with CPack.

Using CPack to generate multiple package formats provides excellent flexibility for users. The inclusion of both archive formats (7Z, ZIP, TBZ2, etc.) and Linux package formats (DEB, RPM) is a good approach for distribution.

src/project/build.ps1 (3)

2-7: Parameter declaration improvements are good.

The script now properly declares parameters using PowerShell conventions, with the $Package parameter renamed (capitalized) and a new $Install parameter added to support installation operations.


12-12: Variable name has been properly capitalized.

The conditional now uses the capitalized $Package parameter name, consistent with the parameter declaration.


18-31: Linux build and package steps look good.

The Linux-specific build section now properly uses CMake with appropriate build type and installation paths. The packaging options with CPack are comprehensive and align with the workflow configuration.

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@sonarqubecloud

sonarqubecloud Bot commented May 6, 2025

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

♻️ Duplicate comments (1)
src/project/build.ps1 (1)

33-37: ⚠️ Potential issue

Ensure reliable install location on Linux

The installation to /tmp/sqlitequery is problematic as this is an ephemeral directory that will be cleared on system reboot, leading to the application being unavailable after restart.

Consider using a persistent location following the FHS or XDG specifications:

- cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/tmp/sqlitequery
+ cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$env:HOME/.local"

  if ($Install) {
      cmake --install build
-     mkdir -p ~/.local/bin
-     ln -s /tmp/sqlitequery/bin/SQLiteQueryAnalyzer ~/.local/bin/sqlitequery
  }

Using $env:HOME/.local as the install prefix follows the XDG Base Directory Specification and eliminates the need for manual symlinking.

🧹 Nitpick comments (2)
src/project/build.ps1 (2)

40-46: Simplify macOS conditional logic

The $Package condition is checked twice unnecessarily.

- if ($IsMacOS -And $Package) {
+ if ($IsMacOS) {
    
    cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/tmp/sqlitequery
    cmake --build build --config Release --parallel 32
    if ($Package) {
        macdeployqt build/SQLiteQueryAnalyzer.app -dmg -appstore-compliant
    }
}

40-47: Consider adding install support for macOS

The script supports installation on Linux but not on macOS. For consistency across platforms, consider adding similar install functionality for macOS.

if ($IsMacOS) {
    cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/tmp/sqlitequery
    cmake --build build --config Release --parallel 32
    if ($Package) {
        macdeployqt build/SQLiteQueryAnalyzer.app -dmg -appstore-compliant
    }
+   if ($Install) {
+       cmake --install build
+       mkdir -p /usr/local/bin
+       ln -s /tmp/sqlitequery/bin/SQLiteQueryAnalyzer /usr/local/bin/sqlitequery
+   }
}

Note that this would also benefit from using a persistent installation path rather than /tmp/sqlitequery.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 29605d8 and 0d93479.

📒 Files selected for processing (1)
  • src/project/build.ps1 (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: build / template
  • GitHub Check: macos-intel / template
  • GitHub Check: build
🔇 Additional comments (4)
src/project/build.ps1 (4)

3-6: Good parameter naming improvements

The capitalization of $Package parameter follows PowerShell naming conventions better, and the addition of the $Install switch is a good separation of build, package, and install concerns.


12-12: LGTM - Parameter name updated for consistency

Updated to use the renamed parameter with capital P.


18-20: Improved explicit CMake configuration

The separate Linux block with explicit CMAKE_BUILD_TYPE and installation prefix is clearer than before.


22-31: Comprehensive packaging options for Linux

This is a great addition using CPack to support multiple packaging formats, aligning with the new CPack configuration in CMakeLists.txt.

@christianhelle
christianhelle merged commit ca406d6 into master May 6, 2025
This was referenced May 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build CI / CD

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build Linux Packages

2 participants