|
1 | 1 | # GitHub Actions Workflows |
2 | 2 |
|
3 | | -This directory contains GitHub Actions workflow configurations for the OpenSVM-Dioxus project. |
| 3 | +This directory contains GitHub Actions workflow definitions for automating the build, test, and release processes for the OpenSVM-Dioxus project. |
4 | 4 |
|
5 | | -## CI Workflow (`ci.yml`) |
| 5 | +## CI/CD Pipeline (`ci.yml`) |
6 | 6 |
|
7 | | -The CI workflow automates building, testing, and releasing the OpenSVM-Dioxus application. |
| 7 | +This workflow handles the continuous integration and continuous deployment process for the OpenSVM-Dioxus project. |
8 | 8 |
|
9 | 9 | ### Triggers |
10 | 10 |
|
11 | | -- **Push to main branch**: Runs build and tests |
12 | | -- **Pull requests to main branch**: Runs build and tests |
13 | | -- **Release publication**: Runs build, tests, and creates release artifacts |
| 11 | +- **Push** to the `main` branch |
| 12 | +- **Push** of tags matching the pattern `v*` (e.g., `v1.0.0`) |
| 13 | +- **Pull requests** targeting the `main` branch |
14 | 14 |
|
15 | 15 | ### Jobs |
16 | 16 |
|
17 | | -1. **build-and-test**: Builds and tests the application on Ubuntu, macOS, and Windows |
18 | | -2. **build-web**: Builds the optimized web (WASM) version of the application, including WASM size reduction, code minification, and SIMD acceleration |
19 | | -3. **build-desktop**: Builds optimized desktop versions for Linux, macOS (Intel and Apple Silicon), and Windows with native CPU instruction sets and performance tuning |
20 | | -4. **build-android**: Builds optimized Android APK with resource management and balanced performance/size optimizations |
21 | | -5. **create-release**: Collects all artifacts and attaches them to the GitHub release |
22 | | -6. **homebrew**: Creates and updates a Homebrew formula for easy installation on macOS |
| 17 | +#### 1. Build & Test |
23 | 18 |
|
24 | | -### Usage |
| 19 | +This job builds and tests the application across multiple platforms: |
25 | 20 |
|
26 | | -#### Regular Development |
| 21 | +- **Web (WASM)** - Built on Ubuntu |
| 22 | +- **Desktop (macOS)** - Built on macOS |
| 23 | +- **Desktop (Windows)** - Built on Windows |
| 24 | +- **Android** - Built on Ubuntu |
27 | 25 |
|
28 | | -The CI workflow automatically runs on every push to the main branch and on pull requests to ensure code quality. |
| 26 | +Each platform build includes platform-specific optimizations: |
29 | 27 |
|
30 | | -#### Creating a Release |
| 28 | +- **Web**: WASM optimization with `wasm-opt` |
| 29 | +- **Desktop**: Native CPU instructions with `-C target-cpu=native` |
| 30 | +- **Android**: APK optimization with `zipalign` and `apksigner` |
31 | 31 |
|
32 | | -To create a new release with binaries: |
| 32 | +#### 2. Release |
33 | 33 |
|
34 | | -1. Go to the GitHub repository |
35 | | -2. Click on "Releases" in the sidebar |
36 | | -3. Click "Draft a new release" |
37 | | -4. Create a new tag (e.g., `v0.1.0`) |
38 | | -5. Fill in the release title and description |
39 | | -6. Click "Publish release" |
| 34 | +This job is triggered only when a tag matching the pattern `v*` is pushed. It: |
40 | 35 |
|
41 | | -The workflow will automatically build all platform binaries and attach them to the release. It will also update the Homebrew formula for macOS users. |
| 36 | +- Downloads all build artifacts |
| 37 | +- Packages them into platform-specific ZIP files |
| 38 | +- Creates a GitHub release with the packaged artifacts |
| 39 | +- Generates release notes automatically |
42 | 40 |
|
43 | | -#### Installing via Homebrew |
| 41 | +#### 3. Homebrew Formula Update |
44 | 42 |
|
45 | | -After a release is published, macOS users can install the application using Homebrew: |
| 43 | +This job is triggered only when a tag matching the pattern `v*` is pushed. It: |
46 | 44 |
|
47 | | -```bash |
48 | | -# Add the tap (first time only) |
49 | | -brew tap opensvm/opensvm |
| 45 | +- Creates or updates a Homebrew formula for the macOS release |
| 46 | +- Calculates the SHA256 hash of the macOS release artifact |
| 47 | +- Creates a pull request to update the formula |
50 | 48 |
|
51 | | -# Install the application |
52 | | -brew install opensvm-dioxus |
53 | | -``` |
| 49 | +#### 4. Android Build |
54 | 50 |
|
55 | | -### Platform-Specific Optimizations |
| 51 | +This job builds the Android APK and: |
56 | 52 |
|
57 | | -The CI workflow applies several platform-specific optimizations to ensure optimal performance: |
| 53 | +- Optimizes the APK with `zipalign` |
| 54 | +- Signs the APK with a debug key |
| 55 | +- Uploads the APK as an artifact |
| 56 | +- Adds the APK to the GitHub release (if triggered by a tag) |
58 | 57 |
|
59 | | -#### Web (WASM) Optimizations |
| 58 | +## GitHub Actions Used |
60 | 59 |
|
61 | | -- Uses custom `wasm-release` profile optimized for binary size |
62 | | -- Enables WASM SIMD instructions with `-C target-feature=+atomics,+bulk-memory,+simd128` |
63 | | -- Applies `wasm-opt -Oz` for additional size optimization |
64 | | -- Minifies JavaScript with terser for faster loading |
| 60 | +This workflow uses the following GitHub Actions: |
65 | 61 |
|
66 | | -#### Desktop Optimizations |
| 62 | +- `actions/checkout@v4`: Checks out the repository |
| 63 | +- `actions/setup-java@v4`: Sets up JDK for Android builds |
| 64 | +- `actions/cache@v4`: Caches Cargo dependencies for faster builds |
| 65 | +- `actions/upload-artifact@v4`: Uploads build artifacts |
| 66 | +- `actions/download-artifact@v4`: Downloads artifacts for releases |
| 67 | +- `actions-rs/toolchain@v1`: Sets up Rust toolchain |
| 68 | +- `actions-rs/cargo@v1`: Runs Cargo commands |
| 69 | +- `softprops/action-gh-release@v1`: Creates GitHub releases |
| 70 | +- `android-actions/setup-android@v2`: Sets up Android SDK |
67 | 71 |
|
68 | | -- Uses `-C target-cpu=native` to utilize all available CPU features |
69 | | -- Applies fat LTO for maximum runtime performance |
70 | | -- Configures thread pool size based on available CPU cores |
71 | | -- Optimizes memory allocator settings for desktop environments |
| 72 | +## Usage |
72 | 73 |
|
73 | | -#### Android Optimizations |
| 74 | +### Regular Development |
74 | 75 |
|
75 | | -- Uses thin LTO for balanced performance and APK size |
76 | | -- Optimizes APKs with zipalign for improved runtime memory usage |
77 | | -- Automatically signs APKs for installation |
78 | | -- Limits background threads to conserve battery life |
| 76 | +The CI pipeline will automatically run on all pull requests to validate changes. |
79 | 77 |
|
80 | | -### Customization |
| 78 | +### Creating a Release |
81 | 79 |
|
82 | | -To modify the CI workflow: |
| 80 | +To create a new release: |
| 81 | + |
| 82 | +1. Create and push a new tag following semantic versioning: |
| 83 | + ```bash |
| 84 | + git tag v1.0.0 |
| 85 | + git push origin v1.0.0 |
| 86 | + ``` |
| 87 | + |
| 88 | +2. The workflow will automatically: |
| 89 | + - Build all platform versions |
| 90 | + - Create a GitHub release with all artifacts |
| 91 | + - Update the Homebrew formula |
| 92 | + |
| 93 | +### Customizing the Workflow |
| 94 | + |
| 95 | +To modify the workflow: |
83 | 96 |
|
84 | 97 | 1. Edit the `.github/workflows/ci.yml` file |
85 | 98 | 2. Commit and push your changes |
86 | 99 | 3. The updated workflow will be used for subsequent runs |
87 | | - |
88 | | -To modify platform-specific optimizations: |
89 | | - |
90 | | -1. Edit `opensvm-dioxus/src/platform_optimizations.rs` for runtime optimizations |
91 | | -2. Edit `opensvm-dioxus/Cargo.toml` for compile-time optimizations |
92 | | -3. Update the appropriate job in the CI workflow for build-time optimizations |
|
0 commit comments