Skip to content

Commit 3f0d8bc

Browse files
authored
Merge pull request #1 from meta-flutter/copilot/implement-dbus-settings-workspace
Implement XDG Desktop Portal Settings D-Bus service in Rust
2 parents 2719dec + 9cd6697 commit 3f0d8bc

File tree

1,132 files changed

+25800
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,132 files changed

+25800
-1
lines changed

.github/workflows/ci.yml

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
tags:
7+
- 'v*'
8+
pull_request:
9+
branches: [ main, master ]
10+
11+
env:
12+
CARGO_TERM_COLOR: always
13+
14+
jobs:
15+
build-and-test:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Install Rust
22+
uses: dtolnay/rust-toolchain@stable
23+
24+
- name: Cache cargo registry
25+
uses: actions/cache@v4
26+
with:
27+
path: ~/.cargo/registry
28+
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
29+
30+
- name: Cache cargo index
31+
uses: actions/cache@v4
32+
with:
33+
path: ~/.cargo/git
34+
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
35+
36+
- name: Cache cargo build
37+
uses: actions/cache@v4
38+
with:
39+
path: target
40+
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
41+
42+
- name: Install D-Bus
43+
run: |
44+
sudo apt-get update
45+
sudo apt-get install -y dbus libdbus-1-dev
46+
47+
- name: Build workspace
48+
run: cargo build --verbose --all
49+
50+
- name: Run library tests
51+
run: cargo test --verbose -p portal_setting
52+
53+
- name: Start D-Bus session
54+
run: |
55+
# Start a D-Bus session for testing
56+
dbus-run-session -- bash -c "
57+
# Start the service in the background
58+
cargo run --bin portal-setting-service &
59+
SERVICE_PID=\$!
60+
61+
# Wait for service to be ready
62+
sleep 2
63+
64+
# Run the client tests
65+
cargo run --bin portal-setting-client
66+
TEST_RESULT=\$?
67+
68+
# Cleanup
69+
kill \$SERVICE_PID 2>/dev/null || true
70+
71+
exit \$TEST_RESULT
72+
"
73+
74+
- name: Build release binary
75+
if: startsWith(github.ref, 'refs/tags/')
76+
run: cargo build --release --bin portal-setting-service
77+
78+
- name: Prepare release artifact
79+
if: startsWith(github.ref, 'refs/tags/')
80+
run: |
81+
mkdir -p release
82+
cp target/release/portal-setting-service release/
83+
cd release
84+
tar czf portal-setting-service-linux-x64.tar.gz portal-setting-service
85+
86+
- name: Upload release artifact
87+
if: startsWith(github.ref, 'refs/tags/')
88+
uses: actions/upload-artifact@v4
89+
with:
90+
name: portal-setting-service-linux-x64
91+
path: release/portal-setting-service-linux-x64.tar.gz
92+
93+
release:
94+
needs: build-and-test
95+
runs-on: ubuntu-latest
96+
if: startsWith(github.ref, 'refs/tags/')
97+
permissions:
98+
contents: write
99+
100+
steps:
101+
- uses: actions/checkout@v4
102+
103+
- name: Download artifact
104+
uses: actions/download-artifact@v4
105+
with:
106+
name: portal-setting-service-linux-x64
107+
108+
- name: Create Release
109+
uses: softprops/action-gh-release@v1
110+
with:
111+
files: portal-setting-service-linux-x64.tar.gz
112+
body: |
113+
XDG Portal Settings Service Release
114+
115+
This release contains the portal-setting-service binary for Linux x64.
116+
117+
## Installation
118+
119+
```bash
120+
tar xzf portal-setting-service-linux-x64.tar.gz
121+
chmod +x portal-setting-service
122+
./portal-setting-service
123+
```
124+
125+
## Usage
126+
127+
The service implements the `org.freedesktop.impl.portal.Settings` D-Bus interface.
128+
See the [README](https://github.com/${{ github.repository }}) for more details.
129+
env:
130+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Rust build artifacts
2+
/target/
3+
Cargo.lock
4+
5+
# IDE files
6+
.vscode/
7+
.idea/
8+
*.swp
9+
*.swo
10+
*~
11+
12+
# OS files
13+
.DS_Store
14+
Thumbs.db

0 commit comments

Comments
 (0)