-
Notifications
You must be signed in to change notification settings - Fork 640
132 lines (112 loc) · 3.36 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
on:
push:
paths-ignore:
- "documentation/**"
branches:
- main
pull_request:
paths-ignore:
- "documentation/**"
branches:
- main
workflow_dispatch:
name: CI
jobs:
rust-format:
name: Check Rust Code Format
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- name: Run cargo fmt
run: cargo fmt --check
rust-build-and-test:
name: Build and Test Rust Project
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Install Dependencies
run: |
sudo apt update -y
sudo apt install -y libdbus-1-dev gnome-keyring libxcb1-dev
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- name: Cache Cargo Registry
uses: actions/cache@v3
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-
- name: Cache Cargo Index
uses: actions/cache@v3
with:
path: ~/.cargo/index
key: ${{ runner.os }}-cargo-index
restore-keys: |
${{ runner.os }}-cargo-index
- name: Cache Cargo Build
uses: actions/cache@v3
with:
path: target
key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-build-
- name: Build and Test
run: |
gnome-keyring-daemon --components=secrets --daemonize --unlock <<< 'foobar'
cargo test
working-directory: crates
# Add disk space cleanup before linting
- name: Check disk space before cleanup
run: df -h
- name: Clean up disk space
run: |
echo "Cleaning up disk space..."
# Remove debug artifacts that are no longer needed after tests
rm -rf target/debug/deps
rm -rf target/debug/build
rm -rf target/debug/incremental
# Clean npm cache if it exists
npm cache clean --force || true
# Clean apt cache
sudo apt-get clean
# Remove unnecessary large directories
rm -rf ~/.cargo/registry/index || true
# Remove docker images if any
docker system prune -af || true
# Remove unused packages
sudo apt-get autoremove -y || true
- name: Check disk space after cleanup
run: df -h
- name: Lint
run: cargo clippy -- -D warnings
desktop-lint:
name: Lint Electron Desktop App
runs-on: macos-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: "lts/*"
- name: Install Dependencies
run: npm ci
working-directory: ui/desktop
- name: Run Lint
run: npm run lint:check
working-directory: ui/desktop
# Faster Desktop App build for PRs only
bundle-desktop-unsigned:
uses: ./.github/workflows/bundle-desktop.yml
if: github.event_name == 'pull_request'
with:
signing: false