Skip to content

Commit dc1371c

Browse files
feat: add aw-tauri CI builds alongside aw-qt (#1209)
* ci(build): modernize runners, node, cache keys for aw-qt CI - Ubuntu 22.04 → 24.04, add macos-latest alongside macOS-13 - Node 20 → 22 - Fix macOS Python setup condition (matrix.os instead of runner.os) - Use matrix.os in cache keys for unique per-variant caching - Enable cargo cache on macOS (was disabled) - Fix qt5-default → qt5-qmake + qtbase5-dev (ubuntu-24.04) - Fix artifact upload name collision (matrix.os) - Fix typo: 'Wether' → 'Whether' * feat: add aw-tauri and awatcher submodules aw-tauri is the Tauri-based replacement for aw-qt (system tray). awatcher is used on Linux for Wayland-compatible window watching. * feat: add aw-tauri CI workflow, Makefile support, and packaging Add a separate build-tauri.yml CI workflow that builds aw-tauri alongside the existing aw-qt builds. The two build pipelines coexist independently. Makefile changes: - TAURI_BUILD=true flag switches between aw-qt and aw-tauri submodules - aw-server-rust builds only aw-sync in Tauri mode (not full server) - ICON points to aw-tauri icons when TAURI_BUILD is set - Conditional packaging: aw-tauri app bundle on macOS, Inno Setup on Windows Packaging: - build_app_tauri.sh: macOS .app bundle creator for Tauri - aw-tauri.iss: Windows Inno Setup with different AppId/AppName to avoid colliding with existing aw-qt installations (addresses review comment) - move-to-aw-modules.sh: Linux module discovery helper (rsync -a, proper line continuation) - README.txt: Linux end-user instructions (typos fixed) - package-all.sh: Tauri-aware zip/installer selection Build-tauri.yml features: - Multi-OS: ubuntu-24.04, ubuntu-24.04-arm, windows-latest, macOS-13, macos-latest - Retry wrapper (nick-fields/retry) for flaky builds - Separate artifact names (builds-tauri-*) to not collide with aw-qt - Tauri-specific APT deps (libgtk-3-dev, libwebkit2gtk-4.1-dev, etc.) Also updates contributor CSV files (brayo-pip → 0xbrayo). Based on work by @0xbrayo in PR #1163. * ci: fix macOS-13 runner label casing (macOS-13 -> macos-13) GitHub Actions runner labels are case-sensitive. `macOS-13` (capital OS) is not a valid runner label and causes CI failures. The correct label is `macos-13` (all lowercase). Fix this in both build.yml and build-tauri.yml. * ci: replace deprecated macos-13 with macos-14 runner macos-13 (x86_64) is deprecated by GitHub Actions. Replace with macos-14 (ARM64/Apple Silicon) in both build.yml and build-tauri.yml. Also remove the macos-13-specific Python workaround (custom pkg install for macOS 10.9 compatibility) since macos-14 uses standard actions/setup-python. * ci: upgrade Poetry from 1.3.2 to 1.4.2 to fix Windows race condition Poetry 1.3.x has a known Windows file-locking race condition when installing packages (tilde-prefixed dist-info temp files cause OSError). Version 1.4.0+ fixes this. Using 1.4.2 (last release in 1.4.x series) to stay on same lockfile format as 1.3.x. Fixes: Windows CI failure in jobs that run 'poetry install' * ci: cache node_modules and aw-tauri cargo target to reduce build times - Cache node_modules directly instead of npm global cache. The global cache only saves download time, but npm ci still does a full install into node_modules every run (~5-7 min per npm ci call). Caching node_modules directly skips this entirely on cache hit. - Cache aw-tauri/src-tauri/target alongside aw-server-rust/target in the Tauri workflow. The Tauri Cargo release build takes ~8 min uncached and was not being cached previously. - Also cache aw-tauri/node_modules in the Tauri workflow (has its own package-lock.json separate from aw-webui). Expected improvement: ~15-20 min savings on cached Windows Tauri builds (from ~34 min to ~15 min).
1 parent ab3316b commit dc1371c

File tree

13 files changed

+525
-60
lines changed

13 files changed

+525
-60
lines changed

.github/workflows/build-tauri.yml

Lines changed: 245 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,245 @@
1+
name: Build Tauri
2+
3+
on:
4+
push:
5+
branches: [master]
6+
tags:
7+
- v*
8+
pull_request:
9+
branches: [master]
10+
11+
jobs:
12+
build:
13+
name: ${{ matrix.os }}, py-${{ matrix.python_version }}, node-${{ matrix.node_version }}
14+
runs-on: ${{ matrix.os }}
15+
continue-on-error: ${{ matrix.experimental }}
16+
env:
17+
# Whether to build and include extras (like aw-notify and aw-watcher-input)
18+
AW_EXTRAS: true
19+
TAURI_BUILD: true
20+
# sets the macOS version target, see: https://users.rust-lang.org/t/compile-rust-binary-for-older-versions-of-mac-osx/38695
21+
MACOSX_DEPLOYMENT_TARGET: 10.9
22+
defaults:
23+
run:
24+
shell: bash
25+
strategy:
26+
fail-fast: false
27+
max-parallel: 5
28+
matrix:
29+
os:
30+
[
31+
ubuntu-24.04,
32+
ubuntu-24.04-arm,
33+
windows-latest,
34+
macos-14,
35+
macos-latest,
36+
]
37+
python_version: [3.9]
38+
node_version: [22]
39+
skip_rust: [false]
40+
skip_webui: [false]
41+
experimental: [false]
42+
43+
steps:
44+
- uses: actions/checkout@v4
45+
with:
46+
submodules: "recursive"
47+
fetch-depth: 0
48+
49+
- name: Set environment variables
50+
run: |
51+
echo "RELEASE=${{ startsWith(github.ref_name, 'v') || github.ref_name == 'master' }}" >> $GITHUB_ENV
52+
echo "TAURI_BUILD=true" >> $GITHUB_ENV
53+
54+
- name: Set up Python
55+
uses: actions/setup-python@v5
56+
with:
57+
python-version: ${{ matrix.python_version }}
58+
59+
- name: Set up Node
60+
if: ${{ !matrix.skip_webui }}
61+
uses: actions/setup-node@v4
62+
with:
63+
node-version: ${{ matrix.node_version }}
64+
65+
- name: Set up Rust
66+
if: ${{ !matrix.skip_rust }}
67+
uses: dtolnay/rust-toolchain@master
68+
id: toolchain
69+
with:
70+
toolchain: stable
71+
72+
- name: Cache node_modules
73+
uses: actions/cache@v4
74+
if: ${{ !matrix.skip_webui }}
75+
with:
76+
path: |
77+
aw-server-rust/aw-webui/node_modules
78+
aw-tauri/node_modules
79+
key: ${{ matrix.os }}-node_modules-${{ hashFiles('**/package-lock.json') }}
80+
restore-keys: |
81+
${{ matrix.os }}-node_modules-
82+
83+
- name: Cache cargo build
84+
uses: actions/cache@v4
85+
env:
86+
cache-name: cargo-build-target
87+
with:
88+
path: |
89+
aw-server-rust/target
90+
aw-tauri/src-tauri/target
91+
key: ${{ matrix.os }}-${{ env.cache-name }}-${{ steps.toolchain.outputs.cachekey }}-${{ hashFiles('**/Cargo.lock') }}
92+
restore-keys: |
93+
${{ matrix.os }}-${{ env.cache-name }}-${{ steps.toolchain.outputs.rustc_hash }}-
94+
95+
- name: Install APT dependencies
96+
if: runner.os == 'Linux'
97+
run: |
98+
sudo apt-get update
99+
sudo apt-get install -y \
100+
libgtk-3-dev \
101+
libwebkit2gtk-4.1-dev \
102+
libayatana-appindicator3-dev \
103+
librsvg2-dev \
104+
libjavascriptcoregtk-4.1-dev \
105+
libsoup-3.0-dev \
106+
xdg-utils
107+
108+
- name: Install dependencies
109+
run: |
110+
if [ "$RUNNER_OS" == "Windows" ]; then
111+
choco install innosetup
112+
fi
113+
pip3 install poetry==1.4.2
114+
115+
- name: Build
116+
uses: nick-fields/retry@v3
117+
with:
118+
timeout_minutes: 60
119+
max_attempts: 3
120+
shell: bash
121+
command: |
122+
python3 -m venv venv
123+
source venv/bin/activate || source venv/Scripts/activate
124+
poetry install
125+
make build SKIP_WEBUI=${{ matrix.skip_webui }} SKIP_SERVER_RUST=${{ matrix.skip_rust }}
126+
pip freeze
127+
128+
- name: Run tests
129+
uses: nick-fields/retry@v3
130+
with:
131+
timeout_minutes: 60
132+
max_attempts: 3
133+
shell: bash
134+
command: |
135+
source venv/bin/activate || source venv/Scripts/activate
136+
make test SKIP_SERVER_RUST=${{ matrix.skip_rust }}
137+
138+
- name: Package
139+
run: |
140+
source venv/bin/activate || source venv/Scripts/activate
141+
poetry install
142+
make package SKIP_SERVER_RUST=${{ matrix.skip_rust }}
143+
144+
- name: Package dmg
145+
if: runner.os == 'macOS'
146+
run: |
147+
if [ -n "$APPLE_EMAIL" ]; then
148+
./scripts/ci/import-macos-p12.sh
149+
fi
150+
151+
source venv/bin/activate
152+
make dist/ActivityWatch.dmg
153+
154+
if [ -n "$APPLE_EMAIL" ]; then
155+
codesign --verbose -s ${APPLE_PERSONALID} dist/ActivityWatch.dmg
156+
157+
brew install akeru-inc/tap/xcnotary
158+
xcnotary precheck dist/ActivityWatch.app
159+
xcnotary precheck dist/ActivityWatch.dmg
160+
161+
make dist/notarize
162+
fi
163+
mv dist/ActivityWatch.dmg dist/activitywatch-$(scripts/package/getversion.sh)-macos-x86_64.dmg
164+
env:
165+
APPLE_EMAIL: ${{ secrets.APPLE_EMAIL }}
166+
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
167+
APPLE_PERSONALID: ${{ secrets.APPLE_TEAMID }}
168+
APPLE_TEAMID: ${{ secrets.APPLE_TEAMID }}
169+
CERTIFICATE_MACOS_P12_BASE64: ${{ secrets.CERTIFICATE_MACOS_P12_BASE64 }}
170+
CERTIFICATE_MACOS_P12_PASSWORD: ${{ secrets.CERTIFICATE_MACOS_P12_PASSWORD }}
171+
172+
- name: Upload packages
173+
uses: actions/upload-artifact@v4
174+
with:
175+
name: builds-tauri-${{ matrix.os }}-py${{ matrix.python_version }}
176+
path: dist/activitywatch-*.*
177+
178+
release-notes:
179+
runs-on: ubuntu-latest
180+
if: startsWith(github.ref, 'refs/tags/v')
181+
steps:
182+
- uses: actions/checkout@v4
183+
with:
184+
submodules: "recursive"
185+
fetch-depth: 0
186+
187+
- uses: ActivityWatch/check-version-format-action@v2
188+
id: version
189+
with:
190+
prefix: "v"
191+
192+
- name: Echo version
193+
run: |
194+
echo "${{ steps.version.outputs.full }} (stable: ${{ steps.version.outputs.is_stable }})"
195+
196+
- name: Set up Python
197+
uses: actions/setup-python@v5
198+
with:
199+
python-version: "3.12"
200+
201+
- name: Install deps
202+
run: |
203+
pip install requests
204+
205+
- name: Generate release notes
206+
run: |
207+
LAST_RELEASE=`STABLE_ONLY=${{ steps.version.output.is_stable }} ./scripts/get_latest_release.sh`
208+
./scripts/build_changelog.py --range "$LAST_RELEASE...${{ steps.version.outputs.full }}"
209+
210+
- name: Rename
211+
run: |
212+
mv changelog.md release_notes.md
213+
214+
- name: Upload release notes
215+
uses: actions/upload-artifact@v4
216+
with:
217+
name: release_notes_tauri
218+
path: release_notes.md
219+
220+
release:
221+
needs: [build, release-notes]
222+
if: startsWith(github.ref, 'refs/tags/v')
223+
runs-on: ubuntu-latest
224+
steps:
225+
- name: Download build artifacts
226+
uses: actions/download-artifact@v4
227+
with:
228+
path: dist
229+
230+
- name: Display structure of downloaded files
231+
run: ls -R
232+
working-directory: dist
233+
234+
- uses: ActivityWatch/check-version-format-action@v2
235+
id: version
236+
with:
237+
prefix: "v"
238+
239+
- name: Release
240+
uses: softprops/action-gh-release@v1
241+
with:
242+
draft: true
243+
files: dist/*/activitywatch-*.*
244+
body_path: dist/release_notes_tauri/release_notes.md
245+
prerelease: ${{ !(steps.version.outputs.is_stable == 'true') }}

.github/workflows/build.yml

Lines changed: 15 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
runs-on: ${{ matrix.os }}
1717
continue-on-error: ${{ matrix.experimental }}
1818
env:
19-
# Wether to build and include extras (like aw-notify and aw-watcher-input)
19+
# Whether to build and include extras (like aw-notify and aw-watcher-input)
2020
AW_EXTRAS: true
2121
# sets the macOS version target, see: https://users.rust-lang.org/t/compile-rust-binary-for-older-versions-of-mac-osx/38695
2222
MACOSX_DEPLOYMENT_TARGET: 10.9
@@ -26,9 +26,9 @@ jobs:
2626
strategy:
2727
fail-fast: false
2828
matrix:
29-
os: [ubuntu-22.04, windows-latest, macOS-13]
29+
os: [ubuntu-24.04, windows-latest, macos-14, macos-latest]
3030
python_version: [3.9]
31-
node_version: [20]
31+
node_version: [22]
3232
skip_rust: [false]
3333
skip_webui: [false]
3434
experimental: [false]
@@ -53,31 +53,10 @@ jobs:
5353
echo "RELEASE=${{ startsWith(github.ref_name, 'v') || github.ref_name == 'master' }}" >> $GITHUB_ENV
5454
5555
- name: Set up Python
56-
if: runner.os != 'macOS'
5756
uses: actions/setup-python@v5
5857
with:
5958
python-version: ${{ matrix.python_version }}
6059

61-
# Setup Python version built for older macOS (https://github.com/actions/virtual-environments/issues/1256)
62-
- name: Set up Python for macOS
63-
if: runner.os == 'macOS'
64-
run: |
65-
curl https://www.python.org/ftp/python/${PYTHON_VERSION}/python-${PYTHON_VERSION}-macosx10.9.pkg -o "python.pkg"
66-
67-
# Python 3.11+ only has *macos11.pkg, so no more *macosx10.9.pkg
68-
# the 'macos11' naming seems to suggest it only supports macos11 and up,
69-
# but the release page says "for macOS 10.9 and later",
70-
# unclear what the resulting binary compatibility will be.
71-
#
72-
# curl https://www.python.org/ftp/python/${PYTHON_VERSION}/python-${PYTHON_VERSION}-macos11.pkg -o "python.pkg"
73-
74-
sudo installer -pkg python.pkg -target /
75-
echo "/Library/Frameworks/Python.framework/Versions/${{ matrix.python_version }}/bin" >> $GITHUB_PATH
76-
"/Applications/Python ${{ matrix.python_version }}/Install Certificates.command"
77-
env:
78-
# Add the patch number to the Python version (for FTP download link)
79-
PYTHON_VERSION: ${{ matrix.python_version }}.13
80-
8160
- name: Set up Node
8261
if: ${{ !matrix.skip_webui }}
8362
uses: actions/setup-node@v4
@@ -91,33 +70,26 @@ jobs:
9170
with:
9271
toolchain: stable
9372

94-
- name: Get npm cache dir
95-
id: npm-cache-dir
96-
run: |
97-
echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT
98-
99-
- uses: actions/cache@v4
100-
name: Cache npm
73+
- name: Cache node_modules
74+
uses: actions/cache@v4
10175
if: ${{ !matrix.skip_webui }}
102-
env:
103-
cache-name: node
10476
with:
105-
path: ${{ steps.npm-cache-dir.outputs.dir }}
106-
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
77+
path: aw-server-rust/aw-webui/node_modules
78+
key: ${{ matrix.os }}-node_modules-${{ hashFiles('**/package-lock.json') }}
10779
restore-keys: |
108-
${{ runner.os }}-${{ env.cache-name }}-
80+
${{ matrix.os }}-node_modules-
10981
11082
- name: Cache cargo build
11183
uses: actions/cache@v4
112-
if: ${{ !matrix.skip_rust && (runner.os != 'macOS') }} # cache doesn't seem to behave nicely on macOS, see: https://github.com/ActivityWatch/aw-server-rust/issues/180
84+
# if: ${{ !matrix.skip_rust && (runner.os != 'macOS') }} # cache doesn't seem to behave nicely on macOS, see: https://github.com/ActivityWatch/aw-server-rust/issues/180
11385
env:
11486
cache-name: cargo-build-target
11587
with:
11688
path: aw-server-rust/target
11789
# key needs to contain rustc_hash due to https://github.com/ActivityWatch/aw-server-rust/issues/180
118-
key: ${{ runner.os }}-${{ env.cache-name }}-${{ steps.toolchain.outputs.cachekey }}-${{ hashFiles('**/Cargo.lock') }}
90+
key: ${{ matrix.os }}-${{ env.cache-name }}-${{ steps.toolchain.outputs.cachekey }}-${{ hashFiles('**/Cargo.lock') }}
11991
restore-keys: |
120-
${{ runner.os }}-${{ env.cache-name }}-${{ steps.toolchain.outputs.rustc_hash }}-
92+
${{ matrix.os }}-${{ env.cache-name }}-${{ steps.toolchain.outputs.rustc_hash }}-
12193
12294
- name: Install APT dependencies
12395
if: runner.os == 'Linux'
@@ -126,7 +98,8 @@ jobs:
12698
# Unsure which of these are actually necessary...
12799
sudo apt-get install -y \
128100
appstream \
129-
qtbase5-dev qt5-qmake \
101+
qt5-qmake \
102+
qtbase5-dev \
130103
qtwayland5 \
131104
libqt5x11extras5 \
132105
libfontconfig1 \
@@ -147,7 +120,7 @@ jobs:
147120
if [ "$RUNNER_OS" == "Windows" ]; then
148121
choco install innosetup
149122
fi
150-
pip3 install poetry==1.3.2
123+
pip3 install poetry==1.4.2
151124
152125
- name: Build
153126
run: |
@@ -223,7 +196,7 @@ jobs:
223196
- name: Upload packages
224197
uses: actions/upload-artifact@v4
225198
with:
226-
name: builds-${{ runner.os }}-py${{ matrix.python_version }}
199+
name: builds-${{ matrix.os }}-py${{ matrix.python_version }}
227200
path: dist/activitywatch-*.*
228201

229202
release-notes:

.gitmodules

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,9 @@
2525
[submodule "aw-watcher-input"]
2626
path = aw-watcher-input
2727
url = https://github.com/ActivityWatch/aw-watcher-input.git
28+
[submodule "aw-tauri"]
29+
path = aw-tauri
30+
url = https://github.com/activitywatch/aw-tauri
31+
[submodule "awatcher"]
32+
path = awatcher
33+
url = https://github.com/2e3s/awatcher

0 commit comments

Comments
 (0)