-
Notifications
You must be signed in to change notification settings - Fork 12
106 lines (93 loc) · 2.88 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
name: "CI"
on:
workflow_call: {} # Allow this workflow to be called by other workflows
push:
branches:
- master
paths:
- 'src-tauri/**'
- 'src/**'
- 'static/**'
- 'package.json'
- 'bun.lockb'
- 'svelte.config.js'
- 'tailwind.config.js'
- 'vite.config.js'
- '.github/workflows/ci.yml'
pull_request:
paths:
- 'src-tauri/**'
- 'src/**'
- 'static/**'
- 'package.json'
- 'bun.lockb'
- 'svelte.config.js'
- 'tailwind.config.js'
- 'vite.config.js'
- '.github/workflows/ci.yml'
jobs:
check:
strategy:
fail-fast: false
matrix:
include:
# macOS desktop builds
- name: "macOS (Apple Silicon)"
platform: "macos-latest"
args: "--target aarch64-apple-darwin"
arch: "aarch64"
- name: "macOS (Intel)"
platform: "macos-latest"
args: "--target x86_64-apple-darwin"
arch: "x86_64"
# Linux desktop builds
- name: "Linux Desktop"
platform: "ubuntu-22.04"
args: ""
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
- name: Add Rust cache
uses: Swatinem/rust-cache@v2
with:
# Specify the working directory for Rust cache
workspaces: "src-tauri -> target"
# Cache cargo registry
cache-directories: |
~/.cargo/registry
~/.cargo/git
# Add a suffix to distinguish between different platforms and architectures
key: ${{ matrix.platform }}${{ matrix.arch && '-' }}${{ matrix.arch }}
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
targets: >-
${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
- name: Cache bun dependencies
uses: actions/cache@v4
with:
path: |
~/.bun/install/cache
node_modules
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }}
restore-keys: |
${{ runner.os }}-bun-
- name: Setup bun
uses: oven-sh/setup-bun@v1
with:
bun-version: 1.1.39
- name: Install system dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
- name: Install frontend dependencies
run: bun install
- name: Build frontend
run: bun run build
- name: Run tests
run: cd src-tauri && cargo test ${{ matrix.args }}
- name: Run frontend tests
run: bun test
- name: Run clippy
run: cd src-tauri && cargo clippy ${{ matrix.args }} -- -D warnings