-
Notifications
You must be signed in to change notification settings - Fork 150
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
base: main
Are you sure you want to change the base?
Conversation
WalkthroughThis 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
Assessment against linked issues
Suggested reviewers
Tip ⚡🧪 Multi-step agentic review comment chat (experimental)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
✅ Deploy Preview for circuitverse ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this 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 improvementThe 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 implementationThe 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 logicThe 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 creationThe 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))" + ;; + esacThis 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
📒 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 handlingThe
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 scriptUsing 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 UbuntuThe 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 addedIncluding platform-specific dependencies for macOS builds ensures consistent build environments across all platforms.
76-79
: Improved Rust dependency cachingSpecifying the workspace path for Rust cache improves caching efficiency by focusing only on the relevant directory.
81-83
: Simplified Tauri build stepReplacing 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 jobAdding a dedicated job for release creation with proper dependencies ensures releases are only created after successful builds across all platforms.
"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 |
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? |
There was a problem hiding this 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
📒 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 usesactions/checkout@v3
while the "create-release" job usesactions/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)
The codeclimate issue can be ignored ig, the function seems to be simple. |
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:
Multi-platform support:
Dependency management:
Build automation:
Artifact management:
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:
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:
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) -
Post-Work :
Code Signing Configuration :
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