1- ---
21name : CI/CD Pipeline
32
43on :
1918 strategy :
2019 fail-fast : false
2120 matrix :
22- os : [ubuntu-latest , macos-latest, windows-latest]
21+ os : [ubuntu-22.04 , macos-latest, windows-latest]
2322 include :
24- - os : ubuntu-latest
23+ - os : ubuntu-22.04
2524 target : wasm32-unknown-unknown
2625 platform : web
2726 - os : macos-latest
3635 uses : actions/checkout@v4
3736
3837 - name : Install Rust toolchain
39- uses : actions-rs/ toolchain@v1
38+ uses : dtolnay/rust- toolchain@stable
4039 with :
41- profile : minimal
42- toolchain : stable
43- override : true
44- target : ${{ matrix.target }}
40+ targets : ${{ matrix.target }}
4541
4642 - name : Cache dependencies
4743 uses : actions/cache@v4
@@ -53,76 +49,66 @@ jobs:
5349 key : ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
5450 restore-keys : ${{ runner.os }}-cargo-
5551
56- - name : Install Dioxus CLI
57- uses : actions-rs/cargo@v1
58- with :
59- command : install
60- args : dioxus-cli --force
52+ - name : Add WASM target
53+ if : ${{ matrix.platform == 'web' }}
54+ run : rustup target add wasm32-unknown-unknown
6155
6256 - name : Install Linux dependencies
63- if : matrix.os == 'ubuntu-latest'
57+ if : ${{ matrix.os == 'ubuntu-22.04' }}
6458 run : |
6559 sudo apt-get update
66- sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3- dev librsvg2-dev patchelf
60+ sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libayatana-appindicator3- dev librsvg2-dev patchelf pkg-config libssl-dev libsoup-3.0-dev
6761
6862 - name : Install wasm-bindgen-cli
69- if : matrix.platform == 'web'
70- uses : actions-rs/cargo@v1
71- with :
72- command : install
73- args : wasm-bindgen-cli
63+ if : ${{ matrix.platform == 'web' }}
64+ run : cargo install wasm-bindgen-cli
7465
75- - name : Install wasm-opt
76- if : matrix.platform == 'web'
66+ - name : Build for Web
67+ if : ${{ matrix.platform == 'web' }}
7768 run : |
78- if [ "$RUNNER_OS" == "Linux" ]; then
79- curl -L https://github.com/WebAssembly/binaryen/releases/download/version_111/binaryen-version_111-x86_64-linux.tar.gz | tar xz
80- sudo cp binaryen-version_111/bin/wasm-opt /usr/local/bin/
81- elif [ "$RUNNER_OS" == "macOS" ]; then
82- brew install binaryen
83- else
84- choco install binaryen
85- fi
86- shell : bash
69+ cd opensvm-dioxus
70+ cargo build --target wasm32-unknown-unknown --features web --release --no-default-features
8771
88- - name : Build for Web
89- if : matrix.platform == 'web'
72+ - name : Build for Desktop (macOS)
73+ if : ${{ matrix.platform == 'desktop' && matrix.os == 'macos-latest' }}
9074 run : |
9175 cd opensvm-dioxus
92- dioxus build --features web --profile wasm-release --platform web --release
76+ RUSTFLAGS="-C target-cpu=native" cargo build --features desktop --release --no-default-features
77+ shell : bash
9378
94- - name : Build for Desktop (macOS/ Linux)
95- if : matrix.platform == 'desktop' && matrix.os != 'windows-latest'
79+ - name : Build for Desktop (Linux)
80+ if : ${{ matrix.platform == 'desktop' && matrix.os == 'ubuntu-22.04' }}
9681 run : |
9782 cd opensvm-dioxus
98- RUSTFLAGS="-C target-cpu=native" dioxus build --features desktop --profile desktop- release --platform desktop --release
83+ RUSTFLAGS="-C target-cpu=native" cargo build --features desktop --release --no-default-features
9984 shell : bash
10085
10186 - name : Build for Desktop (Windows)
102- if : matrix.platform == 'desktop' && matrix.os == 'windows-latest'
87+ if : ${{ matrix.platform == 'desktop' && matrix.os == 'windows-latest' }}
10388 run : |
10489 cd opensvm-dioxus
10590 $env:RUSTFLAGS="-C target-cpu=native"
106- dioxus build --features desktop --profile desktop- release --platform desktop --release
91+ cargo build --features desktop --release --no-default-features
10792 shell : pwsh
10893
10994 - name : Run tests
11095 run : |
11196 cd opensvm-dioxus
112- cargo test --all -features
97+ cargo test --features ${{ matrix.platform }} --no-default -features
11398
11499 - name : Upload artifacts
115100 uses : actions/upload-artifact@v4
116101 with :
117102 name : opensvm-dioxus-${{ matrix.os }}-${{ matrix.platform }}
118103 path : |
119- opensvm-dioxus/dist/
104+ opensvm-dioxus/target/*/release/opensvm-dioxus*
105+ opensvm-dioxus/target/release/opensvm-dioxus*
120106
121107 release :
122108 name : Create Release
123109 needs : build-and-test
124110 if : startsWith(github.ref, 'refs/tags/v')
125- runs-on : ubuntu-latest
111+ runs-on : ubuntu-22.04
126112 steps :
127113 - name : Checkout repository
128114 uses : actions/checkout@v4
@@ -137,24 +123,31 @@ jobs:
137123 mkdir -p release-assets
138124
139125 # Web (WASM)
140- if [ -d "artifacts/opensvm-dioxus-ubuntu-latest-web/ web" ]; then
141- cd artifacts/opensvm-dioxus-ubuntu-latest-web/ web
142- zip -r ../../../ release-assets/opensvm-dioxus-web.zip .
143- cd ../../..
126+ if [ -d "artifacts/opensvm-dioxus-ubuntu-22.04- web" ]; then
127+ cd artifacts/opensvm-dioxus-ubuntu-22.04- web
128+ zip -r ../release-assets/opensvm-dioxus-web.zip .
129+ cd ..
144130 fi
145131
146132 # macOS
147- if [ -d "artifacts/opensvm-dioxus-macos-latest-desktop/desktop " ]; then
148- cd artifacts/opensvm-dioxus-macos-latest-desktop/desktop
149- zip -r ../../../ release-assets/opensvm-dioxus-macos.zip .
150- cd ../../..
133+ if [ -d "artifacts/opensvm-dioxus-macos-latest-desktop" ]; then
134+ cd artifacts/opensvm-dioxus-macos-latest-desktop
135+ zip -r ../release-assets/opensvm-dioxus-macos.zip .
136+ cd ..
151137 fi
152138
153139 # Windows
154- if [ -d "artifacts/opensvm-dioxus-windows-latest-desktop/desktop" ]; then
155- cd artifacts/opensvm-dioxus-windows-latest-desktop/desktop
156- zip -r ../../../release-assets/opensvm-dioxus-windows.zip .
157- cd ../../..
140+ if [ -d "artifacts/opensvm-dioxus-windows-latest-desktop" ]; then
141+ cd artifacts/opensvm-dioxus-windows-latest-desktop
142+ zip -r ../release-assets/opensvm-dioxus-windows.zip .
143+ cd ..
144+ fi
145+
146+ # Android
147+ if [ -d "artifacts/opensvm-dioxus-android" ]; then
148+ cd artifacts/opensvm-dioxus-android
149+ zip -r ../release-assets/opensvm-dioxus-android.zip .
150+ cd ..
158151 fi
159152 shell : bash
160153
@@ -194,8 +187,11 @@ jobs:
194187 VERSION=${GITHUB_REF#refs/tags/v}
195188 DOWNLOAD_URL="https://github.com/${{ github.repository }}/releases/download/v${VERSION}/opensvm-dioxus-macos.zip"
196189
197- # Calculate SHA256
198- curl -L -o opensvm-dioxus-macos.zip "$DOWNLOAD_URL"
190+ # Wait for release to be available
191+ sleep 30
192+
193+ # Calculate SHA256 of the released asset
194+ curl -L -o opensvm-dioxus-macos.zip "$DOWNLOAD_URL" || exit 1
199195 SHA256=$(shasum -a 256 opensvm-dioxus-macos.zip | awk '{print $1}')
200196
201197 # Create formula directory if it doesn't exist
@@ -217,49 +213,40 @@ jobs:
217213 end
218214 EOF
219215
220- # Create a new branch
216+ # Create a new branch for the formula update
221217 git checkout -b update-homebrew-formula-v$VERSION
222218
223219 # Commit and push changes
224220 git add Formula/opensvm-dioxus.rb
225221 git commit -m "Update Homebrew formula to v$VERSION"
226222 git push origin update-homebrew-formula-v$VERSION
227223
228- # Create pull request
224+ # Create pull request using GitHub CLI
229225 gh pr create --title "Update Homebrew formula to v$VERSION" --body "Updates the Homebrew formula for opensvm-dioxus to version $VERSION" --base main --head update-homebrew-formula-v$VERSION
230226 env :
231227 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
232228
233229 android-build :
234230 name : Build Android
235- runs-on : ubuntu-latest
231+ runs-on : ubuntu-22.04
236232 if : github.event_name == 'push'
237233 steps :
238234 - name : Checkout repository
239235 uses : actions/checkout@v4
240236
241- - name : Set up JDK
237+ - name : Set up JDK 17
242238 uses : actions/setup-java@v4
243239 with :
244240 distribution : ' temurin'
245241 java-version : ' 17'
246242
247243 - name : Install Rust toolchain
248- uses : actions-rs/ toolchain@v1
244+ uses : dtolnay/rust- toolchain@stable
249245 with :
250- profile : minimal
251- toolchain : stable
252- override : true
253- target : aarch64-linux-android
246+ targets : aarch64-linux-android
254247
255248 - name : Install Android SDK
256- uses : android-actions/setup-android@v2
257-
258- - name : Install Dioxus CLI
259- uses : actions-rs/cargo@v1
260- with :
261- command : install
262- args : dioxus-cli --force
249+ uses : android-actions/setup-android@v3
263250
264251 - name : Cache dependencies
265252 uses : actions/cache@v4
@@ -274,24 +261,10 @@ jobs:
274261 - name : Build for Android
275262 run : |
276263 cd opensvm-dioxus
277- RUSTFLAGS="-C opt-level=3 -C lto=thin" dioxus build --features android --platform android --release
278-
279- - name : Optimize APK
280- run : |
281- cd opensvm-dioxus/dist/android
282- $ANDROID_HOME/build-tools/33.0.0/zipalign -v -p 4 app-release-unsigned.apk app-release-aligned.apk
283- $ANDROID_HOME/build-tools/33.0.0/apksigner sign --ks debug.keystore --ks-pass pass:android --key-pass pass:android --out opensvm-dioxus.apk app-release-aligned.apk
264+ RUSTFLAGS="-C opt-level=3 -C lto=thin" cargo build --target aarch64-linux-android --features android --release --no-default-features
284265
285266 - name : Upload Android artifact
286267 uses : actions/upload-artifact@v4
287268 with :
288269 name : opensvm-dioxus-android
289- path : opensvm-dioxus/dist/android/opensvm-dioxus.apk
290-
291- - name : Add Android APK to release
292- if : startsWith(github.ref, 'refs/tags/v')
293- uses : softprops/action-gh-release@v1
294- with :
295- files : opensvm-dioxus/dist/android/opensvm-dioxus.apk
296- env :
297- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
270+ path : opensvm-dioxus/target/aarch64-linux-android/release/opensvm-dioxus
0 commit comments