Skip to content

Commit 0653db7

Browse files
committed
chore: speed up CI installs and desktop packaging
1 parent 658ba5b commit 0653db7

File tree

10 files changed

+610
-41
lines changed

10 files changed

+610
-41
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,11 @@ jobs:
4141
with:
4242
node-version: 22
4343
cache: pnpm
44+
cache-dependency-path: pnpm-lock.yaml
4445

4546
- name: Install dependencies
47+
env:
48+
NEXU_SKIP_RUNTIME_POSTINSTALL: "1"
4649
run: pnpm install --frozen-lockfile
4750

4851
- name: Typecheck
@@ -66,8 +69,11 @@ jobs:
6669
with:
6770
node-version: 22
6871
cache: pnpm
72+
cache-dependency-path: pnpm-lock.yaml
6973

7074
- name: Install dependencies
75+
env:
76+
NEXU_SKIP_RUNTIME_POSTINSTALL: "1"
7177
run: pnpm install --frozen-lockfile
7278

7379
- name: Lint
@@ -91,8 +97,11 @@ jobs:
9197
with:
9298
node-version: 22
9399
cache: pnpm
100+
cache-dependency-path: pnpm-lock.yaml
94101

95102
- name: Install dependencies
103+
env:
104+
NEXU_SKIP_RUNTIME_POSTINSTALL: "1"
96105
run: pnpm install --frozen-lockfile
97106

98107
- name: Build

.github/workflows/desktop-build.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@ jobs:
8686
cache: pnpm
8787
cache-dependency-path: pnpm-lock.yaml
8888

89+
- name: Restore npm cache for runtime installs
90+
uses: actions/cache@v4
91+
with:
92+
path: ~/.npm
93+
key: desktop-npm-cache-${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('openclaw-runtime/package-lock.json', 'apps/controller/static/runtime-plugins/openclaw-weixin/package-lock.json') }}
94+
8995
- name: Resolve build metadata
9096
id: meta
9197
shell: bash

.github/workflows/desktop-ci-dev.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ jobs:
6060
cache: pnpm
6161
cache-dependency-path: pnpm-lock.yaml
6262

63+
- name: Restore npm cache for runtime installs
64+
uses: actions/cache@v4
65+
with:
66+
path: ~/.npm
67+
key: desktop-npm-cache-${{ runner.os }}-arm64-${{ hashFiles('openclaw-runtime/package-lock.json', 'apps/controller/static/runtime-plugins/openclaw-weixin/package-lock.json') }}
68+
6369
- name: Install dependencies
6470
run: pnpm install --frozen-lockfile
6571

Lines changed: 188 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
1+
name: Desktop CI Dist Heavy
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- "apps/desktop/**"
9+
- "apps/controller/**"
10+
- "apps/web/**"
11+
- "packages/shared/**"
12+
- "openclaw-runtime/**"
13+
- ".npmrc"
14+
- "package.json"
15+
- "pnpm-lock.yaml"
16+
- "pnpm-workspace.yaml"
17+
- "scripts/desktop-check-dist.sh"
18+
- "scripts/desktop-ci-check.mjs"
19+
- "tsconfig.base.json"
20+
- ".github/workflows/desktop-ci-dist.yml"
21+
- ".github/workflows/desktop-ci-dist-heavy.yml"
22+
workflow_dispatch:
23+
24+
permissions:
25+
contents: read
26+
27+
concurrency:
28+
group: desktop-ci-dist-heavy-${{ github.ref }}
29+
cancel-in-progress: true
30+
31+
jobs:
32+
desktop-ci:
33+
strategy:
34+
matrix:
35+
include:
36+
- runner: macos-14
37+
arch: arm64
38+
- runner: macos-15-intel
39+
arch: x64
40+
runs-on: ${{ matrix.runner }}
41+
timeout-minutes: 45
42+
env:
43+
NEXU_DESKTOP_MAC_TARGETS: dmg zip
44+
45+
steps:
46+
- name: Checkout
47+
uses: actions/checkout@v4
48+
49+
- name: Setup pnpm
50+
uses: pnpm/action-setup@v4
51+
with:
52+
version: 10.26.0
53+
54+
- name: Setup Node.js
55+
uses: actions/setup-node@v4
56+
with:
57+
node-version: 22
58+
cache: pnpm
59+
cache-dependency-path: pnpm-lock.yaml
60+
61+
- name: Restore npm cache for runtime installs
62+
uses: actions/cache@v4
63+
with:
64+
path: ~/.npm
65+
key: desktop-npm-cache-${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('openclaw-runtime/package-lock.json', 'apps/controller/static/runtime-plugins/openclaw-weixin/package-lock.json') }}
66+
67+
- name: Install dependencies
68+
run: pnpm install --frozen-lockfile
69+
70+
- name: Show desktop toolchain versions
71+
shell: bash
72+
run: |
73+
set -euo pipefail
74+
pnpm exec electron --version
75+
76+
- name: Build unsigned macOS desktop bundle
77+
env:
78+
NEXU_DESKTOP_TARGET_ARCH: ${{ matrix.arch }}
79+
run: pnpm dist:mac:unsigned
80+
81+
- name: Set packaged app paths
82+
shell: bash
83+
run: |
84+
set -euo pipefail
85+
shopt -s nullglob
86+
87+
runner_home="$HOME"
88+
packaged_home="$RUNNER_TEMP/desktop-home"
89+
packaged_user_data_dir="$packaged_home/Library/Application Support/@nexu/desktop"
90+
packaged_logs_dir="$packaged_user_data_dir/logs"
91+
packaged_runtime_logs_dir="$packaged_logs_dir/runtime-units"
92+
default_user_data_dir="$runner_home/Library/Application Support/@nexu/desktop"
93+
default_logs_dir="$default_user_data_dir/logs"
94+
default_runtime_logs_dir="$default_logs_dir/runtime-units"
95+
packaged_apps=(apps/desktop/release/mac*/Nexu.app)
96+
97+
if [ "${#packaged_apps[@]}" -eq 0 ]; then
98+
echo "No packaged app bundle found under apps/desktop/release/mac*" >&2
99+
exit 1
100+
fi
101+
102+
packaged_app="${packaged_apps[0]}"
103+
packaged_executable="$packaged_app/Contents/MacOS/Nexu"
104+
105+
mkdir -p "$RUNNER_TEMP/desktop-ci" "$packaged_home" "$RUNNER_TEMP/desktop-tmp"
106+
107+
{
108+
echo "PACKAGED_HOME=$packaged_home"
109+
echo "PACKAGED_LOGS_DIR=$packaged_logs_dir"
110+
echo "PACKAGED_USER_DATA_DIR=$packaged_user_data_dir"
111+
echo "PACKAGED_RUNTIME_LOGS_DIR=$packaged_runtime_logs_dir"
112+
echo "DEFAULT_LOGS_DIR=$default_logs_dir"
113+
echo "DEFAULT_USER_DATA_DIR=$default_user_data_dir"
114+
echo "DEFAULT_RUNTIME_LOGS_DIR=$default_runtime_logs_dir"
115+
echo "PACKAGED_APP=$packaged_app"
116+
echo "PACKAGED_EXECUTABLE=$packaged_executable"
117+
} >> "$GITHUB_ENV"
118+
119+
- name: Verify packaged desktop artifacts
120+
shell: bash
121+
run: |
122+
set -euo pipefail
123+
shopt -s nullglob
124+
125+
dmg_artifacts=(apps/desktop/release/*.dmg)
126+
zip_artifacts=(apps/desktop/release/*.zip)
127+
128+
if [ "${#dmg_artifacts[@]}" -eq 0 ]; then
129+
echo "No desktop DMG artifact was produced" >&2
130+
exit 1
131+
fi
132+
133+
if [ "${#zip_artifacts[@]}" -eq 0 ]; then
134+
echo "No desktop ZIP artifact was produced" >&2
135+
exit 1
136+
fi
137+
138+
printf 'Built artifacts:\n'
139+
printf ' - %s\n' "${dmg_artifacts[@]}"
140+
printf ' - %s\n' "${zip_artifacts[@]}"
141+
142+
test -d "$PACKAGED_APP"
143+
test -x "$PACKAGED_EXECUTABLE"
144+
145+
- name: Upload desktop build artifacts
146+
if: success()
147+
uses: actions/upload-artifact@v4
148+
with:
149+
name: desktop-ci-dist-${{ matrix.arch }}
150+
path: |
151+
apps/desktop/release/*.dmg
152+
apps/desktop/release/*.zip
153+
if-no-files-found: error
154+
retention-days: 3
155+
156+
- name: Verify packaged runtime unit health
157+
env:
158+
NEXU_DESKTOP_CHECK_CAPTURE_DIR: ${{ runner.temp }}/desktop-ci
159+
NEXU_DESKTOP_CHECK_TMPDIR: ${{ runner.temp }}/desktop-tmp
160+
run: pnpm check:dist
161+
162+
- name: Capture desktop logs
163+
if: always()
164+
shell: bash
165+
run: |
166+
set -euo pipefail
167+
mkdir -p "$RUNNER_TEMP/desktop-ci"
168+
if [ -d "$PACKAGED_LOGS_DIR" ]; then
169+
cp -R "$PACKAGED_LOGS_DIR" "$RUNNER_TEMP/desktop-ci/packaged-logs"
170+
fi
171+
if [ -d "$PACKAGED_RUNTIME_LOGS_DIR" ]; then
172+
cp -R "$PACKAGED_RUNTIME_LOGS_DIR" "$RUNNER_TEMP/desktop-ci/runtime-unit-logs"
173+
fi
174+
if [ -d "$DEFAULT_LOGS_DIR" ]; then
175+
cp -R "$DEFAULT_LOGS_DIR" "$RUNNER_TEMP/desktop-ci/default-logs"
176+
fi
177+
if [ -d "$DEFAULT_RUNTIME_LOGS_DIR" ]; then
178+
cp -R "$DEFAULT_RUNTIME_LOGS_DIR" "$RUNNER_TEMP/desktop-ci/default-runtime-unit-logs"
179+
fi
180+
181+
- name: Upload desktop logs
182+
if: always()
183+
uses: actions/upload-artifact@v4
184+
with:
185+
name: desktop-ci-logs-${{ matrix.arch }}
186+
path: ${{ runner.temp }}/desktop-ci
187+
if-no-files-found: warn
188+
retention-days: 3

.github/workflows/desktop-ci-dist.yml

Lines changed: 15 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,17 @@
1-
name: Desktop CI Dist
1+
name: Desktop CI Dist PR
22

33
on:
44
pull_request:
55
paths:
66
- "apps/desktop/**"
7+
- "apps/controller/**"
78
- "apps/web/**"
89
- "packages/shared/**"
910
- "openclaw-runtime/**"
1011
- ".npmrc"
1112
- "package.json"
1213
- "pnpm-lock.yaml"
1314
- "pnpm-workspace.yaml"
14-
- "scripts/desktop-check-dev.sh"
15-
- "scripts/desktop-check-dist.sh"
16-
- "scripts/desktop-ci-check.mjs"
17-
- "tsconfig.base.json"
18-
- ".github/workflows/desktop-ci-dist.yml"
19-
push:
20-
branches:
21-
- main
22-
paths:
23-
- "apps/desktop/**"
24-
- "apps/web/**"
25-
- "packages/shared/**"
26-
- "openclaw-runtime/**"
27-
- ".npmrc"
28-
- "package.json"
29-
- "pnpm-lock.yaml"
30-
- "pnpm-workspace.yaml"
31-
- "scripts/desktop-check-dev.sh"
3215
- "scripts/desktop-check-dist.sh"
3316
- "scripts/desktop-ci-check.mjs"
3417
- "tsconfig.base.json"
@@ -43,15 +26,10 @@ concurrency:
4326

4427
jobs:
4528
desktop-ci:
46-
strategy:
47-
matrix:
48-
include:
49-
- runner: macos-14
50-
arch: arm64
51-
- runner: macos-15-intel
52-
arch: x64
53-
runs-on: ${{ matrix.runner }}
29+
runs-on: macos-14
5430
timeout-minutes: 45
31+
env:
32+
NEXU_DESKTOP_MAC_TARGETS: zip
5533

5634
steps:
5735
- name: Checkout
@@ -69,6 +47,12 @@ jobs:
6947
cache: pnpm
7048
cache-dependency-path: pnpm-lock.yaml
7149

50+
- name: Restore npm cache for runtime installs
51+
uses: actions/cache@v4
52+
with:
53+
path: ~/.npm
54+
key: desktop-npm-cache-${{ runner.os }}-arm64-${{ hashFiles('openclaw-runtime/package-lock.json', 'apps/controller/static/runtime-plugins/openclaw-weixin/package-lock.json') }}
55+
7256
- name: Install dependencies
7357
run: pnpm install --frozen-lockfile
7458

@@ -80,7 +64,7 @@ jobs:
8064
8165
- name: Build unsigned macOS desktop bundle
8266
env:
83-
NEXU_DESKTOP_TARGET_ARCH: ${{ matrix.arch }}
67+
NEXU_DESKTOP_TARGET_ARCH: arm64
8468
run: pnpm dist:mac:unsigned
8569

8670
- name: Set packaged app paths
@@ -127,21 +111,14 @@ jobs:
127111
set -euo pipefail
128112
shopt -s nullglob
129113
130-
dmg_artifacts=(apps/desktop/release/*.dmg)
131114
zip_artifacts=(apps/desktop/release/*.zip)
132115
133-
if [ "${#dmg_artifacts[@]}" -eq 0 ]; then
134-
echo "No desktop DMG artifact was produced" >&2
135-
exit 1
136-
fi
137-
138116
if [ "${#zip_artifacts[@]}" -eq 0 ]; then
139117
echo "No desktop ZIP artifact was produced" >&2
140118
exit 1
141119
fi
142120
143121
printf 'Built artifacts:\n'
144-
printf ' - %s\n' "${dmg_artifacts[@]}"
145122
printf ' - %s\n' "${zip_artifacts[@]}"
146123
147124
test -d "$PACKAGED_APP"
@@ -151,9 +128,9 @@ jobs:
151128
if: success()
152129
uses: actions/upload-artifact@v4
153130
with:
154-
name: desktop-ci-dist-${{ matrix.arch }}
131+
name: desktop-ci-dist-arm64
155132
path: |
156-
apps/desktop/release/*.dmg
133+
apps/desktop/release/*.zip
157134
if-no-files-found: error
158135
retention-days: 3
159136

@@ -186,7 +163,7 @@ jobs:
186163
if: always()
187164
uses: actions/upload-artifact@v4
188165
with:
189-
name: desktop-ci-logs-${{ matrix.arch }}
166+
name: desktop-ci-logs-arm64
190167
path: ${{ runner.temp }}/desktop-ci
191168
if-no-files-found: warn
192169
retention-days: 3

.github/workflows/desktop-release.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,13 @@ jobs:
4848
with:
4949
node-version: 22
5050
cache: pnpm
51+
cache-dependency-path: pnpm-lock.yaml
52+
53+
- name: Restore npm cache for runtime installs
54+
uses: actions/cache@v4
55+
with:
56+
path: ~/.npm
57+
key: desktop-npm-cache-${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('openclaw-runtime/package-lock.json', 'apps/controller/static/runtime-plugins/openclaw-weixin/package-lock.json') }}
5158

5259
- name: Resolve release metadata
5360
id: meta

0 commit comments

Comments
 (0)