-
Notifications
You must be signed in to change notification settings - Fork 25
155 lines (130 loc) · 4.45 KB
/
Copy pathservice-integration.yml
File metadata and controls
155 lines (130 loc) · 4.45 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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
name: Service Integration
on:
workflow_dispatch:
pull_request:
paths:
- "Cargo.toml"
- "Cargo.lock"
- "src/**"
- "tests/**"
- "resources/**"
- ".github/workflows/service-integration.yml"
- ".github/workflows/service-recovery.yml"
push:
branches:
- "**"
paths:
- "Cargo.toml"
- "Cargo.lock"
- "src/**"
- "tests/**"
- "resources/**"
- ".github/workflows/service-integration.yml"
- ".github/workflows/service-recovery.yml"
permissions:
contents: read
jobs:
cargo-tests:
name: Cargo Tests (${{ matrix.os }})
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: rustfmt, clippy
- name: Check formatting
run: cargo fmt --all --check
- name: Run Clippy
run: cargo clippy --all-features --all-targets -- -D warnings
- name: Run cargo test
run: cargo test --all-features
service-flow:
name: Service Integration (${{ matrix.os }})
needs: cargo-tests
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: rustfmt, clippy
- name: Build binaries
run: cargo build --release --features "standalone client test"
- name: Install service (Linux)
if: runner.os == 'Linux'
run: sudo target/release/clash-verge-service-install --debug
- name: Verify service (Linux)
if: runner.os == 'Linux'
run: sudo systemctl is-active clash-verge-service.service
- name: Run mock_binary (Linux)
if: runner.os == 'Linux'
run: |
target/release/service-integration-driver start
sleep 2
pgrep -f mock_binary
- name: Stop mock_binary (Linux)
if: runner.os == 'Linux'
run: target/release/service-integration-driver stop
- name: Uninstall service (Linux)
if: runner.os == 'Linux'
run: sudo target/release/clash-verge-service-uninstall --debug
- name: Install service (macOS)
if: runner.os == 'macOS'
run: sudo target/release/clash-verge-service-install --debug
- name: Verify service (macOS)
if: runner.os == 'macOS'
run: sudo launchctl list | grep io.github.clash-verge-rev.clash-verge-rev.service
- name: Run mock_binary (macOS)
if: runner.os == 'macOS'
run: |
sudo target/release/service-integration-driver start
sleep 2
# pgrep -f mock_binary
- name: Stop mock_binary (macOS)
if: runner.os == 'macOS'
run: sudo target/release/service-integration-driver stop
- name: Uninstall service (macOS)
if: runner.os == 'macOS'
run: sudo target/release/clash-verge-service-uninstall --debug
- name: Install service (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
& "$env:GITHUB_WORKSPACE\\target\\release\\clash-verge-service-install.exe"
Start-Sleep -Seconds 2
- name: Verify service (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$state = sc query clash_verge_service | Select-String "STATE"
if ($state -notmatch "RUNNING") { exit 1 }
- name: Run mock_binary (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
Start-Process "$env:GITHUB_WORKSPACE\\target\\release\\service-integration-driver.exe" -ArgumentList "start" -Wait
Start-Sleep -Seconds 2
Get-Process -Name mock_binary
- name: Stop mock_binary (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
Start-Process "$env:GITHUB_WORKSPACE\\target\\release\\service-integration-driver.exe" -ArgumentList "stop" -Wait
- name: Uninstall service (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
& "$env:GITHUB_WORKSPACE\\target\\release\\clash-verge-service-uninstall.exe"