Skip to content
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

CI : Automated Release Pipeline for Tauri Desktop Simulator with enhanced Build Performance #536

Open
wants to merge 41 commits into
base: main
Choose a base branch
from

Conversation

gitsofaryan
Copy link
Contributor

@gitsofaryan gitsofaryan commented Mar 14, 2025

Fixes #534

Describe the changes you have made in this PR -

This PR introduces a comprehensive CI workflow that establishes an automated release pipeline for Tauri Simulator Desktop. The workflow ensures streamlined deployment across multiple platforms (Windows, macOS, and Linux) and integrates version management, artifact handling, and GitHub release automation.

Changes Introduced

1. GitHub Actions CI/CD Workflow

  • Triggers:

    • Runs on every push to main.
    • Executes when a new release is created.
  • Multi-platform support:

    • Builds on Ubuntu, Windows, and macOS.
  • Dependency management:

    • Caches Node.js and Rust dependencies for faster builds.
  • Build automation:

    • Installs dependencies and builds the Tauri application.
  • Artifact management:

    • Uploads platform-specific build outputs for later use.
  • Automated GitHub Release Creation:

    • Automatically increments version and generates release notes.

    • Uploads platform-specific binaries for user download.

2. Optimized Rust Build Configurations

  • Development Profile (profile.dev) Enhancements:

    • Enables incremental compilation for faster development builds.
  • Release Profile (profile.release) Optimizations:

    • Disables incremental compilation for better performance.

    • Enables Link Time Optimization (LTO) for efficient binary size.

    • Uses opt-level = "s" to optimize for a smaller binary size.

    • Strips debug symbols to reduce final executable size.

    • Sets panic = "abort" to eliminate unnecessary runtime checks.

    Workflow Breakdown

  • Build Tauri Application (build-tauri job)

    • Setup Environment:

    • Checkout repository.

    • Setup Node.js.

      • Cache Node.js dependencies.

      • Install project dependencies.

      • Install Tauri CLI and required dependencies.

  • Cross-Platform Build Execution:

    • Install Rust (for non-Windows builds).

    • Install platform-specific dependencies (Linux/macOS).

    • Cache Rust dependencies.

    • Build the Tauri application.

    • Upload build artifacts for later use.

    • Release Creation (create-release job)

  • Download Build Artifacts:

    • Retrieve the build outputs from the previous job.
  • Prepare Release Assets:

    • Organizes binaries by platform (Deb, AppImage, MSI, DMG, etc.).

    • Zips .app bundles for macOS.

  • Install GitHub CLI & Automate Release:

    • Fetches the latest tag.

    • Increments the patch version automatically.

    • Creates a new GitHub Release with the updated version.

    • Uploads binaries to the release.

Screenshots of the changes (If any) -

image
image

Post-Work :

Code Signing Configuration :

  • we need set up
# Windows Code Signing
- name: Sign Windows Executable
  run: |
    echo "$WINDOWS_CERT" | base64 --decode > cert.pfx
    osslsigncode sign -pkcs12 cert.pfx -pass "$WINDOWS_CERT_PASSWORD" -in target/release/app.exe -out target/release/app-signed.exe
  env:
    WINDOWS_CERT: ${{ secrets.WINDOWS_CERT }}
    WINDOWS_CERT_PASSWORD: ${{ secrets.WINDOWS_CERT_PASSWORD }}

# macOS Code Signing
- name: Sign macOS Application
  run: |
    echo "$MACOS_CERT" | base64 --decode > certificate.p12
    security import certificate.p12 -k ~/Library/Keychains/login.keychain-db -P "$MACOS_CERT_PASSWORD" -T /usr/bin/codesign
    codesign --deep --force --verbose --sign "Developer ID Application: Your Name" target/release/app.app
  env:
    MACOS_CERT: ${{ secrets.MACOS_CERT }}
    MACOS_CERT_PASSWORD: ${{ secrets.MACOS_CERT_PASSWORD }}

# Linux Code Signing
- name: Sign Linux Binary
  run: |
    echo "$LINUX_CERT" | base64 --decode > gpg-private-key.asc
    gpg --import gpg-private-key.asc
    gpg --detach-sign --armor --output target/release/app.sig target/release/app
  env:
    LINUX_CERT: ${{ secrets.LINUX_CERT }}

To add code signing, we need to set up a few repository secrets so that the signing steps can authenticate and use our certificates/keys. Here’s a quick rundown:

Windows:

WINDOWS_CERT: code signing certificate (in Base64 format)
WINDOWS_CERT_PASSWORD: The password for certificate

macOS:

MACOS_CERT: Your Developer ID certificate (in Base64 format, usually a .p12 file)
MACOS_CERT_PASSWORD: The password for the certificate
APPLE_ID: Apple Developer email
APPLE_APP_SPECIFIC_PASSWORD: The app-specific password for notarization
APPLE_TEAM_ID: Apple Developer Team ID

Linux:

LINUX_GPG_KEY: GPG private key (in Base64 format) for signing
These secrets allow the workflow steps to decode your certificate/key files and perform the signing process.

Note: Please check Allow edits from maintainers. if you would like us to assist in the PR.

Summary by CodeRabbit

Summary by CodeRabbit

  • Chores
    • Upgraded the release workflow to deliver more reliable and consistent desktop updates.
    • Streamlined the build process with enhanced dependency caching and refined automation, resulting in faster build times and smaller, more efficient binaries.
    • Optimized build configurations for improved cross-platform performance, ensuring a smoother overall user experience.
    • Introduced a new job for automated release preparation in the CI/CD workflow.

Copy link
Contributor

coderabbitai bot commented Mar 14, 2025

Walkthrough

This pull request updates the CI/CD pipeline and build configuration for a Tauri application. The workflow now splits dependency installation into caching and separate installation steps, adds OS-specific dependencies, and replaces the previous Tauri action with a direct npm build command. A new job for automating release creation is introduced. Additionally, the build process is simplified through a dedicated Node.js script, and the Rust build profiles are optimized for both development and release builds.

Changes

File(s) Change Summary
.github/workflows/tauri-release.yml Updates CI/CD workflow for Tauri app releases: splits Node.js dependency caching and installation, installs OS-specific dependencies, modifies Rust caching, replaces the tauri-action with a direct build command, and adds a new create-release job with steps for artifact preparation and release creation.
src-tauri/tauri.conf.json, tauri-build.js Simplifies the build process by replacing the previous multi-command build with a single call to node tauri-build.js, which executes the build and conditionally copies files based on the OS.
src-tauri/Cargo.toml Introduces new profile settings: enables incremental builds for development and configures optimized settings for release (including LTO, code generation, and binary size optimization).

Assessment against linked issues

Objective Addressed Explanation
Release Binaries Pipeline for Tauri Desktop Application (#534)

Suggested reviewers

  • niladrix719

Tip

⚡🧪 Multi-step agentic review comment chat (experimental)
  • We're introducing multi-step agentic chat in review comments. This experimental feature enhances review discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments.
    - To enable this feature, set early_access to true under in the settings.

🪧 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.

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 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.

Copy link

netlify bot commented Mar 14, 2025

Deploy Preview for circuitverse ready!

Name Link
🔨 Latest commit 7241d8b
🔍 Latest deploy log https://app.netlify.com/sites/circuitverse/deploys/67d7bfc38b9b590008c217f1
😎 Deploy Preview https://deploy-preview-536--circuitverse.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 47
Accessibility: 72
Best Practices: 92
SEO: 80
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

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 (4)
src-tauri/Cargo.toml (1)

31-39: Excellent release profile optimization with room for improvement

The release profile configuration is well-optimized for binary size and performance. However, consider adding comments for all settings to improve maintainability.

 [profile.release]
 incremental = false         
 codegen-units = 1           # Use one code generation unit to improve cross-module optimization
 lto = true                  # Enable Link Time Optimization to optimize across the entire binary
 opt-level = "s"             # Optimize for small binary size.
-panic = "abort"             
-strip = true                
-debug = false               
-debug-assertions = false   
+panic = "abort"             # Terminate immediately on panic (smaller binary)
+strip = true                # Remove symbols from binary (smaller size)
+debug = false               # Disable debug information (smaller size)
+debug-assertions = false    # Disable debug assertions (better performance)
tauri-build.js (1)

24-36: Good cross-platform file handling implementation

The script correctly handles platform-specific differences for file copying between Windows and Unix-based systems. The environment variable setup and build command execution are also well-implemented.

Consider adding a check to verify the existence of source and destination directories before attempting file operations:

 if (platform === 'win32') {
+  // Verify that directories exist before copying
+  if (!require('fs').existsSync('dist\\index-cv.html')) {
+    console.error('Source file dist\\index-cv.html does not exist');
+    process.exit(1);
+  }
   runCommand('copy dist\\index-cv.html dist\\index.html');
 } else {
+  if (!require('fs').existsSync('dist/index-cv.html')) {
+    console.error('Source file dist/index-cv.html does not exist');
+    process.exit(1);
+  }
   runCommand('cp dist/index-cv.html dist/index.html');
 }
.github/workflows/tauri-release.yml (2)

104-134: Comprehensive release asset preparation logic

The script handles platform-specific artifacts well, including special handling for macOS app bundles that need to be zipped. The error handling with || true makes the script more robust against minor issues.

Consider removing trailing whitespace from lines 107, 115, 120, and 132 to improve code cleanliness:

           mkdir -p release-assets
-          
+
           # For Ubuntu (Linux)
           if [ -d "artifacts/Tauri Build Artifacts (ubuntu-latest)/deb" ]; then
             cp artifacts/Tauri\ Build\ Artifacts\ \(ubuntu-latest\)/deb/*.deb release-assets/ || true
           fi
           if [ -d "artifacts/Tauri Build Artifacts (ubuntu-latest)/appimage" ]; then
             cp artifacts/Tauri\ Build\ Artifacts\ \(ubuntu-latest\)/appimage/*.AppImage release-assets/ || true
           fi
-          
+
           # For Windows
           if [ -d "artifacts/Tauri Build Artifacts (windows-latest)/msi" ]; then
             cp artifacts/Tauri\ Build\ Artifacts\ \(windows-latest\)/msi/*.msi release-assets/ || true
           fi
-          
+
           # For macOS
           if [ -d "artifacts/Tauri Build Artifacts (macos-latest)/dmg" ]; then
             cp artifacts/Tauri\ Build\ Artifacts\ \(macos-latest\)/dmg/*.dmg release-assets/ || true
           fi
           if [ -d "artifacts/Tauri Build Artifacts (macos-latest)/app" ]; then
             cd artifacts/Tauri\ Build\ Artifacts\ \(macos-latest\)/app
             for app in *.app; do
               zip -r "../../../release-assets/${app%.app}.zip" "$app"
             done
             cd - || exit
           fi
-          
+
           ls -la release-assets/
🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 107-107: trailing spaces

(trailing-spaces)


[error] 115-115: trailing spaces

(trailing-spaces)


[error] 120-120: trailing spaces

(trailing-spaces)


[error] 132-132: trailing spaces

(trailing-spaces)


144-170: Effective version management and release creation

The script automatically manages version incrementing using semantic versioning principles and creates properly formatted GitHub releases. This automation streamlines the release process significantly.

Consider enhancing the version incrementing logic to support different types of version changes (major, minor, patch) based on commit message conventions or workflow inputs:

-          # Increment patch version
-          NEW_VERSION="v$MAJOR.$MINOR.$((PATCH + 1))"
+          # Determine version increment type (default to patch)
+          INCREMENT_TYPE="${GITHUB_EVENT_INPUT_INCREMENT_TYPE:-patch}"
+          
+          case "$INCREMENT_TYPE" in
+            major)
+              NEW_VERSION="v$((MAJOR + 1)).0.0"
+              ;;
+            minor)
+              NEW_VERSION="v$MAJOR.$((MINOR + 1)).0"
+              ;;
+            patch|*)
+              NEW_VERSION="v$MAJOR.$MINOR.$((PATCH + 1))"
+              ;;
+          esac

This would provide more flexibility in your release process.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 150-150: trailing spaces

(trailing-spaces)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 2a9f309 and 4e80172.

📒 Files selected for processing (4)
  • .github/workflows/tauri-release.yml (1 hunks)
  • src-tauri/Cargo.toml (1 hunks)
  • src-tauri/tauri.conf.json (1 hunks)
  • tauri-build.js (1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/tauri-release.yml

97-97: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🪛 YAMLlint (1.35.1)
.github/workflows/tauri-release.yml

[error] 107-107: trailing spaces

(trailing-spaces)


[error] 115-115: trailing spaces

(trailing-spaces)


[error] 120-120: trailing spaces

(trailing-spaces)


[error] 132-132: trailing spaces

(trailing-spaces)


[error] 150-150: trailing spaces

(trailing-spaces)

🔇 Additional comments (10)
src-tauri/tauri.conf.json (1)

10-10: Great simplification of the build command!

Replacing the complex build command with a single Node.js script call improves maintainability by centralizing build logic in a dedicated file.

src-tauri/Cargo.toml (1)

28-29: Good optimization for development builds!

Enabling incremental compilation for development builds will significantly speed up rebuild times during development, enhancing developer productivity.

tauri-build.js (1)

1-21: Well-structured command execution function with proper error handling

The runCommand function correctly captures and logs command output and errors, with appropriate process termination on failures. This ensures build issues are clearly reported and fail fast.

.github/workflows/tauri-release.yml (7)

26-31: Great addition of dependency caching!

Adding Node.js dependency caching will significantly improve workflow performance by avoiding redundant downloads across runs. The cache key based on package-lock.json ensures proper cache invalidation when dependencies change.


43-45: Excellent integration of cross-platform build script

Using the new tauri-build.js script aligns well with the configuration changes in tauri.conf.json, creating a more maintainable and consistent build process across the workflow.


54-67: Comprehensive OS-specific dependencies for Ubuntu

The addition of Ubuntu-specific dependencies ensures all required libraries are available for building the Tauri application on Linux. This is a critical improvement for multi-platform builds.


69-74: macOS dependencies properly added

Including platform-specific dependencies for macOS builds ensures consistent build environments across all platforms.


76-79: Improved Rust dependency caching

Specifying the workspace path for Rust cache improves caching efficiency by focusing only on the relevant directory.


81-83: Simplified Tauri build step

Replacing the previous tauri-action with a direct npm command simplifies the workflow and aligns better with the project's build scripts.


92-94: Well-structured release automation job

Adding a dedicated job for release creation with proper dependencies ensures releases are only created after successful builds across all platforms.

@gitsofaryan
Copy link
Contributor Author

gitsofaryan commented Mar 14, 2025

"I have been working on the CI implementation for the past week and have now did it. During this time, some contributors made changes to my work without consulting or informing me. Despite this, I have continued working on my implementation to ensure it meets the project’s requirements. Given the effort I have put in, I have raised the PR independently to ensure my contributions are recognized and not wasted. I welcome any feedback and am open to refining the implementation if needed."

my prev pr which was merged : #503

cc : @vedant-jain03 @niladrix719 @tachyons

@niladrix719
Copy link
Member

seems good, have to implement code signing next

@gitsofaryan gitsofaryan changed the title CI : Automated Release Pipeline for Tauri Simulator Desktop with enhanced Build Performance CI : Automated Release Pipeline for Tauri Desktop Simulator with enhanced Build Performance Mar 14, 2025
@gitsofaryan
Copy link
Contributor Author

seems good, have to implement code signing next

Thanks @niladrix719 sir! For code signing, we'll need private keys. Have they been set up already?

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (3)
.github/workflows/tauri-release.yml (3)

107-107: Remove Trailing Whitespace
Static analysis has flagged trailing whitespace on these lines. Please remove these extraneous spaces to improve file cleanliness and prevent potential formatting issues.

Also applies to: 115-115, 120-120, 132-132, 150-150

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 107-107: trailing spaces

(trailing-spaces)


148-153: Inconsistent Release Title Branding
Within the "Auto-increment version and create GitHub Release" step, the release title is set to "CircuitVerse Desktop $NEW_VERSION", while the workflow name is "Vue + Tauri Simulator Desktop Release". Please verify the intended product branding and update the release title (and related notes) accordingly to ensure consistency.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 150-150: trailing spaces

(trailing-spaces)


146-147: Version Increment Logic Review
The approach for extracting the latest version and incrementing the patch number is correct for basic semantic versioning. Ensure this strategy aligns with the overall versioning policy—especially if major or minor version bumps should also be considered.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 4e80172 and 7241d8b.

📒 Files selected for processing (1)
  • .github/workflows/tauri-release.yml (2 hunks)
🧰 Additional context used
🪛 YAMLlint (1.35.1)
.github/workflows/tauri-release.yml

[error] 107-107: trailing spaces

(trailing-spaces)


[error] 115-115: trailing spaces

(trailing-spaces)


[error] 120-120: trailing spaces

(trailing-spaces)


[error] 132-132: trailing spaces

(trailing-spaces)


[error] 150-150: trailing spaces

(trailing-spaces)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (1)
.github/workflows/tauri-release.yml (1)

18-20: Inconsistent Checkout Action Version in "build-tauri" Job
The "build-tauri" job uses actions/checkout@v3 while the "create-release" job uses actions/checkout@v4. For consistency and to leverage improvements in the latest version, update the checkout action in the "build-tauri" job to v4.

🧰 Tools
🪛 actionlint (1.7.4)

19-19: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

@ThatDeparted2061
Copy link
Member

The codeclimate issue can be ignored ig, the function seems to be simple.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feat: Release Binaries Pipeline for Tauri Desktop Application
3 participants