Ci: fix desktop release CI (#50)

This commit is contained in:
Huakun Shen 2025-01-07 05:16:11 -05:00 committed by GitHub
parent b1e21aa040
commit 943f52d929
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 80 additions and 21 deletions

View File

@ -16,10 +16,11 @@ jobs:
settings: settings:
- platform: "macos-14" # for Arm based macs (M1 and above). - platform: "macos-14" # for Arm based macs (M1 and above).
args: "--target aarch64-apple-darwin --verbose" args: "--target aarch64-apple-darwin --verbose"
- platform: "macos-14" # for Intel based macs. - platform: "macos-13" # for Intel based macs.
args: "--target x86_64-apple-darwin --verbose" args: "--target x86_64-apple-darwin --verbose"
- platform: "macos-14" # for Both Arm and Intel based macs. # Universal Build no longer supported after adding openssl, which is not cross-compilable.
args: "--target universal-apple-darwin --verbose" # - platform: "macos-14" # for Both Arm and Intel based macs.
# args: "--target universal-apple-darwin --verbose"
- platform: "ubuntu-22.04" # for Tauri v1 you could replace this with ubuntu-20.04. - platform: "ubuntu-22.04" # for Tauri v1 you could replace this with ubuntu-20.04.
args: "--verbose" args: "--verbose"
- platform: "windows-latest" - platform: "windows-latest"
@ -31,35 +32,36 @@ jobs:
with: with:
submodules: "true" submodules: "true"
- name: install dependencies (ubuntu only) - name: Install Dependencies (ubuntu only)
if: matrix.settings.platform == 'ubuntu-22.04' # This must match the platform value defined above. if: matrix.settings.platform == 'ubuntu-22.04' # This must match the platform value defined above.
run: | run: |
sudo apt-get update sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf libxdo-dev sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf libxdo-dev
# You can remove the one that doesn't apply to your app to speed up the workflow a bit. # You can remove the one that doesn't apply to your app to speed up the workflow a bit.
- name: Install protobuf (Mac) - name: Install protobuf (Mac)
if: matrix.settings.platform == 'macos-14' if: startsWith(matrix.settings.platform, 'macos')
run: | run: |
brew install protobuf brew install protobuf
brew install openssl
- name: Install Protobuf (Ubuntu) - name: Install Protobuf (Ubuntu)
if: matrix.settings.platform == 'ubuntu-22.04' if: matrix.settings.platform == 'ubuntu-22.04'
run: | run: |
sudo apt install -y protobuf-compiler sudo apt install -y protobuf-compiler
- name: Install protoc and openssl for windows
if: matrix.settings.platform == 'windows-latest'
run: |
choco install protoc
choco install openssl
echo OPENSSL_DIR='"C:\\Program Files\\OpenSSL-Win64"' >> $env:GITHUB_ENV
echo OPENSSL_INCLUDE_DIR='"C:\\Program Files\\OpenSSL-Win64\\include"' >> $env:GITHUB_ENV
echo OPENSSL_LIB_DIR='"C:\\Program Files\\OpenSSL-Win64\\lib\\VC\\x64\\MDd"' >> $env:GITHUB_ENV
- uses: pnpm/action-setup@v4 - uses: pnpm/action-setup@v4
- name: setup node - name: Setup Node
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: lts/* node-version: lts/*
cache: "pnpm" # Set this to npm, yarn or pnpm. cache: "pnpm" # Set this to npm, yarn or pnpm.
cache-dependency-path: ./pnpm-lock.yaml cache-dependency-path: ./pnpm-lock.yaml
- name: Install protoc and openssl for windows
if: matrix.settings.platform == 'windows-latest'
run: |
choco install protoc
choco install openssl
echo OPENSSL_DIR='C:\Program Files\OpenSSL' >> $env:GITHUB_ENV
echo OPENSSL_INCLUDE_DIR='C:\Program Files\OpenSSL\include' >> $env:GITHUB_ENV
echo OPENSSL_LIB_DIR='C:\Program Files\OpenSSL\lib\VC\x64\MDd' >> $env:GITHUB_ENV
- name: Install Rust stable - name: Install Rust stable
uses: dtolnay/rust-toolchain@stable uses: dtolnay/rust-toolchain@stable
@ -71,7 +73,7 @@ jobs:
run: | run: |
rustup target add aarch64-apple-darwin rustup target add aarch64-apple-darwin
rustup target add x86_64-apple-darwin rustup target add x86_64-apple-darwin
- name: Rust cache - name: Rust Cache
uses: swatinem/rust-cache@v2 uses: swatinem/rust-cache@v2
with: with:
workspaces: ". -> target" workspaces: ". -> target"
@ -80,6 +82,10 @@ jobs:
bun-version: latest bun-version: latest
- name: Install Dependencies - name: Install Dependencies
run: pnpm install run: pnpm install
- name: Environment Check
run: |
# pnpm --filter=@kksh/ci run ci-env-check
bun packages/ci/scripts/ci-env-check.ts
- name: Build Packages - name: Build Packages
run: pnpm build run: pnpm build
- name: Get App Version - name: Get App Version

View File

@ -1,6 +1,6 @@
{ {
"name": "@kksh/desktop", "name": "@kksh/desktop",
"version": "0.1.11", "version": "0.1.12",
"description": "", "description": "",
"type": "module", "type": "module",
"scripts": { "scripts": {

View File

@ -3,13 +3,14 @@
"module": "index.ts", "module": "index.ts",
"type": "module", "type": "module",
"scripts": { "scripts": {
"prepare": "bun scripts/setup.ts" "prepare": "bun scripts/setup.ts",
"ci-env-check": "bun scripts/ci-env-check.ts"
}, },
"devDependencies": { "devDependencies": {
"@types/bun": "latest", "@types/bun": "latest",
"@kksh/typescript-config": "workspace:*" "@kksh/typescript-config": "workspace:*"
}, },
"peerDependencies": { "peerDependencies": {
"typescript": "^5.0.0" "typescript": "^5.7.2"
} }
} }

View File

@ -0,0 +1,49 @@
import fs from "fs"
import path from "path"
const OPENSSL_DIR = process.env.OPENSSL_DIR
const OPENSSL_INCLUDE_DIR = process.env.OPENSSL_INCLUDE_DIR
const OPENSSL_LIB_DIR = process.env.OPENSSL_LIB_DIR
console.log("OPENSSL_DIR", OPENSSL_DIR)
console.log("OPENSSL_INCLUDE_DIR", OPENSSL_INCLUDE_DIR)
console.log("OPENSSL_LIB_DIR", OPENSSL_LIB_DIR)
if (process.platform === "win32") {
// check if each directory exists
if (!OPENSSL_DIR || !OPENSSL_INCLUDE_DIR || !OPENSSL_LIB_DIR) {
console.error("OPENSSL_DIR, OPENSSL_INCLUDE_DIR, or OPENSSL_LIB_DIR is not set")
process.exit(1)
}
const programFilesDir = "C:\\Program Files"
console.log(
`Program Files Directory (${programFilesDir}) Exists: ${fs.existsSync(programFilesDir)}`
)
console.log("Program Files Directory Contents:")
for (const dir of fs.readdirSync(programFilesDir)) {
console.log(dir)
}
console.log(`OPENSSL_DIR (${OPENSSL_DIR}) Exists: ${fs.existsSync(OPENSSL_DIR)}`)
console.log(
`OPENSSL_INCLUDE_DIR (${OPENSSL_INCLUDE_DIR}) Exists: ${fs.existsSync(OPENSSL_INCLUDE_DIR)}`
)
console.log(`OPENSSL_LIB_DIR (${OPENSSL_LIB_DIR}) Exists: ${fs.existsSync(OPENSSL_LIB_DIR)}`)
if (
!fs.existsSync(OPENSSL_DIR) ||
!fs.existsSync(OPENSSL_INCLUDE_DIR) ||
!fs.existsSync(OPENSSL_LIB_DIR)
) {
console.error("OPENSSL_DIR, OPENSSL_INCLUDE_DIR, or OPENSSL_LIB_DIR is not set")
process.exit(1)
}
} else if (process.platform === "darwin") {
if (OPENSSL_DIR) {
if (fs.existsSync(OPENSSL_DIR)) {
console.log("OPENSSL_DIR exists", OPENSSL_DIR)
} else {
console.log("OPENSSL_DIR does not exist", OPENSSL_DIR)
}
}
} else if (process.platform === "linux") {
}

View File

@ -1,10 +1,13 @@
use applications::utils::image::{RustImage, RustImageData}; use applications::utils::image::{RustImage, RustImageData};
use std::path::Path;
use std::{ use std::{
ffi::OsStr, ffi::OsStr,
fs::File, fs::File,
io::{BufReader, Cursor}, io::{BufReader, Cursor},
path::PathBuf, path::PathBuf,
}; };
use uuid::Uuid;
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
use tauri_icns::{IconFamily, IconType}; use tauri_icns::{IconFamily, IconType};

4
pnpm-lock.yaml generated
View File

@ -547,8 +547,8 @@ importers:
packages/ci: packages/ci:
dependencies: dependencies:
typescript: typescript:
specifier: ^5.0.0 specifier: ^5.7.2
version: 5.5.4 version: 5.7.2
devDependencies: devDependencies:
'@kksh/typescript-config': '@kksh/typescript-config':
specifier: workspace:* specifier: workspace:*

@ -1 +1 @@
Subproject commit 5766c04cb255b88fb569e6db2ae910ad237fef34 Subproject commit 890edc0216f5d7d36de7dcdd1809b7551c342e06