Skip to content

Commit 2f6eec8

Browse files
committed
fix ci
1 parent d38c5e1 commit 2f6eec8

2 files changed

Lines changed: 21 additions & 81 deletions

File tree

.github/workflows/ci.yml

Lines changed: 18 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,13 @@ jobs:
1010
test:
1111
name: Test Suite
1212
runs-on: ubuntu-latest
13-
1413
steps:
1514
- name: Checkout code
1615
uses: actions/checkout@v4
17-
1816
- name: Install Rust toolchain
19-
uses: actions-rs/toolchain@v1
17+
uses: dtolnay/rust-toolchain@stable
2018
with:
21-
toolchain: stable
22-
override: true
2319
components: rustfmt, clippy
24-
2520
- name: Install system dependencies
2621
run: |
2722
sudo apt-get update
@@ -36,146 +31,105 @@ jobs:
3631
systemd \
3732
libdbus-1-dev \
3833
pkg-config
39-
40-
- name: Cache cargo registry
41-
uses: actions/cache@v3
42-
with:
43-
path: ~/.cargo/registry
44-
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
45-
restore-keys: |
46-
${{ runner.os }}-cargo-registry-
47-
48-
- name: Cache cargo index
49-
uses: actions/cache@v3
50-
with:
51-
path: ~/.cargo/git
52-
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
53-
restore-keys: |
54-
${{ runner.os }}-cargo-index-
55-
56-
- name: Cache cargo build
57-
uses: actions/cache@v3
34+
- name: Cache cargo dependencies
35+
uses: actions/cache@v4
5836
with:
59-
path: target
60-
key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}
37+
path: |
38+
~/.cargo/registry
39+
~/.cargo/git
40+
target
41+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
6142
restore-keys: |
62-
${{ runner.os }}-cargo-build-
63-
43+
${{ runner.os }}-cargo-
6444
- name: Check code formatting
6545
run: cargo fmt -- --check
66-
6746
- name: Run clippy (linter)
6847
run: cargo clippy -- -D warnings
69-
7048
- name: Start D-Bus session for tests
7149
run: |
50+
# Start D-Bus daemon for testing
7251
export DBUS_SESSION_BUS_ADDRESS=$(dbus-daemon --session --print-address --fork)
7352
echo "DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS" >> $GITHUB_ENV
74-
53+
# Give D-Bus time to start
7554
sleep 2
76-
55+
# Verify D-Bus is working
7756
echo "Testing D-Bus connection..."
7857
dbus-send --session --dest=org.freedesktop.DBus --type=method_call \
7958
--print-reply /org/freedesktop/DBus org.freedesktop.DBus.ListNames > /dev/null
8059
echo "D-Bus session ready"
81-
8260
- name: Run unit tests
8361
env:
8462
RUST_BACKTRACE: 1
8563
run: |
8664
echo "Running all tests..."
8765
cargo test --verbose
88-
8966
- name: Run integration tests with output
9067
env:
9168
RUST_BACKTRACE: 1
9269
run: |
9370
echo "Running integration tests with detailed output..."
9471
cargo test --test integration_tests -- --nocapture
95-
9672
- name: Test mock script standalone
9773
run: |
9874
echo "Testing mock media player script..."
9975
timeout 3s python3 tests/mock_media_player.py || true
10076
echo "Mock script test completed"
101-
10277
- name: Build release binary
10378
run: |
10479
echo "Building release version..."
10580
cargo build --release
10681
ls -la target/release/
107-
10882
- name: Upload test artifacts on failure
10983
if: failure()
110-
uses: actions/upload-artifact@v3
84+
uses: actions/upload-artifact@v4
11185
with:
11286
name: test-logs-${{ github.run_number }}
11387
path: |
11488
target/debug/deps/
115-
~/.cargo/registry/src/
11689
retention-days: 5
11790

11891
lint:
11992
name: Linting
12093
runs-on: ubuntu-latest
121-
12294
steps:
12395
- name: Checkout code
12496
uses: actions/checkout@v4
125-
12697
- name: Install Rust toolchain
127-
uses: actions-rs/toolchain@v1
98+
uses: dtolnay/rust-toolchain@stable
12899
with:
129-
toolchain: stable
130-
override: true
131100
components: rustfmt, clippy
132-
133101
- name: Install system dependencies for clippy
134102
run: |
135103
sudo apt-get update
136104
sudo apt-get install -y libdbus-1-dev pkg-config
137-
138105
- name: Check formatting
139106
run: cargo fmt -- --check
140-
141107
- name: Run clippy
142108
run: cargo clippy --all-targets --all-features -- -D warnings
143109

144110
security:
145111
name: Security Audit
146112
runs-on: ubuntu-latest
147-
148113
steps:
149114
- name: Checkout code
150115
uses: actions/checkout@v4
151-
152116
- name: Install Rust toolchain
153-
uses: actions-rs/toolchain@v1
154-
with:
155-
toolchain: stable
156-
override: true
157-
117+
uses: dtolnay/rust-toolchain@stable
158118
- name: Install cargo-audit
159119
run: cargo install cargo-audit
160-
161120
- name: Run security audit
162121
run: cargo audit
163122

164123
coverage:
165124
name: Code Coverage
166125
runs-on: ubuntu-latest
167-
168126
steps:
169127
- name: Checkout code
170128
uses: actions/checkout@v4
171-
172129
- name: Install Rust toolchain
173-
uses: actions-rs/toolchain@v1
130+
uses: dtolnay/rust-toolchain@stable
174131
with:
175-
toolchain: stable
176-
override: true
177132
components: llvm-tools-preview
178-
179133
- name: Install system dependencies
180134
run: |
181135
sudo apt-get update
@@ -186,22 +140,19 @@ jobs:
186140
python3-gi \
187141
libdbus-1-dev \
188142
pkg-config
189-
190143
- name: Install cargo-llvm-cov
191144
run: cargo install cargo-llvm-cov
192-
193145
- name: Start D-Bus session for coverage
194146
run: |
195147
export DBUS_SESSION_BUS_ADDRESS=$(dbus-daemon --session --print-address --fork)
196148
echo "DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS" >> $GITHUB_ENV
197149
sleep 2
198-
199150
- name: Generate code coverage
200151
run: |
201152
cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
202-
203153
- name: Upload coverage to Codecov
204-
uses: codecov/codecov-action@v3
154+
uses: codecov/codecov-action@v4
205155
with:
206156
files: lcov.info
207157
fail_ci_if_error: false
158+
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/test.yml

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,13 @@ jobs:
1010
test:
1111
name: Run Tests
1212
runs-on: ubuntu-latest
13-
1413
steps:
1514
- name: Checkout
1615
uses: actions/checkout@v4
17-
1816
- name: Install Rust
19-
uses: actions-rs/toolchain@v1
17+
uses: dtolnay/rust-toolchain@stable
2018
with:
21-
toolchain: stable
22-
override: true
23-
19+
components: rustfmt, clippy
2420
- name: Install D-Bus and Python dependencies
2521
run: |
2622
sudo apt-get update
@@ -34,20 +30,16 @@ jobs:
3430
gir1.2-glib-2.0 \
3531
libdbus-1-dev \
3632
pkg-config
37-
3833
- name: Setup D-Bus session
3934
run: |
40-
# Start D-Bus daemon for testing
4135
export DBUS_SESSION_BUS_ADDRESS=$(dbus-daemon --session --print-address --fork)
4236
echo "DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS" >> $GITHUB_ENV
4337
sleep 1
44-
4538
dbus-send --session --dest=org.freedesktop.DBus --type=method_call \
4639
--print-reply /org/freedesktop/DBus org.freedesktop.DBus.ListNames > /dev/null
4740
echo "✅ D-Bus session ready"
48-
4941
- name: Cache dependencies
50-
uses: actions/cache@v3
42+
uses: actions/cache@v4
5143
with:
5244
path: |
5345
~/.cargo/registry
@@ -56,19 +48,16 @@ jobs:
5648
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
5749
restore-keys: |
5850
${{ runner.os }}-cargo-
59-
6051
- name: Run tests
6152
env:
6253
RUST_BACKTRACE: 1
6354
run: |
6455
echo "🧪 Running all tests..."
6556
cargo test --verbose
66-
6757
- name: Verify mock script works
6858
run: |
6959
echo "🎭 Testing mock media player script..."
7060
timeout 2s python3 tests/mock_media_player.py || echo "Mock script completed (expected timeout)"
71-
7261
- name: Build release
7362
run: |
7463
echo "🔨 Building release binary..."

0 commit comments

Comments
 (0)