-
Notifications
You must be signed in to change notification settings - Fork 0
130 lines (102 loc) · 3.46 KB
/
ci.yml
File metadata and controls
130 lines (102 loc) · 3.46 KB
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
name: CI
on:
push:
branches: [ main, master ]
tags:
- 'v*'
pull_request:
branches: [ main, master ]
env:
CARGO_TERM_COLOR: always
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v4
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build
uses: actions/cache@v4
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- name: Install D-Bus
run: |
sudo apt-get update
sudo apt-get install -y dbus libdbus-1-dev
- name: Build workspace
run: cargo build --verbose --all
- name: Run library tests
run: cargo test --verbose -p portal_setting
- name: Start D-Bus session
run: |
# Start a D-Bus session for testing
dbus-run-session -- bash -c "
# Start the service in the background
cargo run --bin portal-setting-service &
SERVICE_PID=\$!
# Wait for service to be ready
sleep 2
# Run the client tests
cargo run --bin portal-setting-client
TEST_RESULT=\$?
# Cleanup
kill \$SERVICE_PID 2>/dev/null || true
exit \$TEST_RESULT
"
- name: Build release binary
if: startsWith(github.ref, 'refs/tags/')
run: cargo build --release --bin portal-setting-service
- name: Prepare release artifact
if: startsWith(github.ref, 'refs/tags/')
run: |
mkdir -p release
cp target/release/portal-setting-service release/
cd release
tar czf portal-setting-service-linux-x64.tar.gz portal-setting-service
- name: Upload release artifact
if: startsWith(github.ref, 'refs/tags/')
uses: actions/upload-artifact@v4
with:
name: portal-setting-service-linux-x64
path: release/portal-setting-service-linux-x64.tar.gz
release:
needs: build-and-test
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: portal-setting-service-linux-x64
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: portal-setting-service-linux-x64.tar.gz
body: |
XDG Portal Settings Service Release
This release contains the portal-setting-service binary for Linux x64.
## Installation
```bash
tar xzf portal-setting-service-linux-x64.tar.gz
chmod +x portal-setting-service
./portal-setting-service
```
## Usage
The service implements the `org.freedesktop.impl.portal.Settings` D-Bus interface.
See the [README](https://github.com/${{ github.repository }}) for more details.
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}