@@ -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 }}
0 commit comments