cv-frontend-vue icon indicating copy to clipboard operation
cv-frontend-vue copied to clipboard

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

Open gitsofaryan opened this issue 8 months ago • 6 comments

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.

gitsofaryan avatar Mar 14 '25 14:03 gitsofaryan

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.

coderabbitai[bot] avatar Mar 14 '25 14:03 coderabbitai[bot]

Deploy Preview for circuitverse ready!

Name Link
Latest commit 7241d8b57f56dad9eb1b99a4f4c609b6ef1e7246
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
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.

netlify[bot] avatar Mar 14 '25 14:03 netlify[bot]

"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 : https://github.com/CircuitVerse/cv-frontend-vue/pull/503

cc : @vedant-jain03 @niladrix719 @tachyons

gitsofaryan avatar Mar 14 '25 15:03 gitsofaryan

seems good, have to implement code signing next

niladrix719 avatar Mar 14 '25 15:03 niladrix719

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?

gitsofaryan avatar Mar 14 '25 15:03 gitsofaryan

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

ThatDeparted2061 avatar Mar 17 '25 09:03 ThatDeparted2061