Repository navigation
202 lines (175 loc) · 7.75 KB
/
Copy pathnative-service.yml
File metadata and controls
202 lines (175 loc) · 7.75 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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
name: Native personal service
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
permissions:
contents: read
concurrency:
group: native-service-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
linux-systemd-user:
runs-on: ubuntu-latest
timeout-minutes: 30
env:
POWERCONTEXT_RUN_NATIVE_SERVICE_TESTS: "1"
POWERCONTEXT_NATIVE_SERVICE_IDENTIFIER: powercontext-native-${{ github.run_id }}-${{ github.run_attempt }}.service
steps:
- name: Check out
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- name: Set up the environment
uses: ./.github/actions/setup-python-env
- name: Start the disposable runner's user manager
shell: bash
run: |
sudo systemctl start "user@$(id -u).service"
echo "XDG_RUNTIME_DIR=/run/user/$(id -u)" >> "$GITHUB_ENV"
echo "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus" >> "$GITHUB_ENV"
- name: Install the built distribution in a fresh virtual environment
shell: bash
run: |
uv build --wheel
wheel=$(find dist -name '*.whl' -print -quit)
uv venv .native-venv
uv pip install --python .native-venv/bin/python "powercontext[cli,server] @ file://$PWD/$wheel" pytest
- name: Exercise the real systemd user lifecycle
run: >-
.native-venv/bin/python -m pytest -q
--junitxml "$RUNNER_TEMP/powercontext-native-linux.xml"
--basetemp "$RUNNER_TEMP/powercontext-native-tests"
tests/native/test_personal_service_lifecycle.py
- name: Report Linux lifecycle failures
if: failure()
run: >-
.native-venv/bin/python .github/scripts/report_pytest_failures.py
"$RUNNER_TEMP/powercontext-native-linux.xml"
- name: Capture systemd diagnostics after failure
if: failure()
shell: bash
run: |
systemctl --user status "$POWERCONTEXT_NATIVE_SERVICE_IDENTIFIER" || true
journalctl --user --unit "$POWERCONTEXT_NATIVE_SERVICE_IDENTIFIER" --no-pager || true
- name: Upload Linux native-service logs after failure
if: failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: linux-native-service-logs
path: ${{ runner.temp }}/powercontext-native-tests/**/logs/*
if-no-files-found: ignore
macos-launchagent:
runs-on: macos-latest
timeout-minutes: 30
env:
POWERCONTEXT_RUN_NATIVE_SERVICE_TESTS: "1"
POWERCONTEXT_NATIVE_SERVICE_IDENTIFIER: com.oceanbase.powercontext.native.${{ github.run_id }}.${{ github.run_attempt }}
steps:
- name: Check out
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- name: Set up the environment
uses: ./.github/actions/setup-python-env
- name: Install the built distribution in a fresh virtual environment
shell: bash
run: |
uv build --wheel
wheel=$(find dist -name '*.whl' -print -quit)
uv venv .native-venv
# Finish bytecode compilation during installation, before launchd
# runs the cold-start lifecycle under its bounded startup deadline.
uv pip install --compile-bytecode --python .native-venv/bin/python "powercontext[cli,server] @ file://$PWD/$wheel" pytest
- name: Exercise the real LaunchAgent lifecycle
run: >-
.native-venv/bin/python -m pytest -q
--junitxml "$RUNNER_TEMP/powercontext-native-macos.xml"
--basetemp "$RUNNER_TEMP/powercontext-native-tests"
tests/native/test_personal_service_lifecycle.py
- name: Report macOS lifecycle failures
if: failure()
run: >-
.native-venv/bin/python .github/scripts/report_pytest_failures.py
"$RUNNER_TEMP/powercontext-native-macos.xml"
- name: Capture launchd diagnostics after failure
if: failure()
shell: bash
run: launchctl print "gui/$(id -u)/$POWERCONTEXT_NATIVE_SERVICE_IDENTIFIER" || true
- name: Upload macOS native-service logs after failure
if: failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: macos-native-service-logs
path: ${{ runner.temp }}/powercontext-native-tests/**/logs/*
if-no-files-found: ignore
windows-task-scheduler:
runs-on: windows-latest
timeout-minutes: 30
env:
POWERCONTEXT_RUN_NATIVE_SERVICE_TESTS: "1"
POWERCONTEXT_NATIVE_SERVICE_IDENTIFIER: PowerContext-Native-${{ github.run_id }}-${{ github.run_attempt }}
steps:
- name: Check out
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- name: Set up the environment
uses: ./.github/actions/setup-python-env
- name: Install the built distribution in a fresh virtual environment
shell: pwsh
run: |
uv build --wheel
$wheel = (Get-ChildItem dist\*.whl | Select-Object -First 1).FullName
$wheelUri = "file:///" + $wheel.Replace('\', '/')
uv venv .native-venv
uv pip install --python .native-venv\Scripts\python.exe "powercontext[cli,server] @ $wheelUri" pytest
- name: Verify binary cursor persistence and restart compatibility
shell: pwsh
run: >-
.native-venv\Scripts\python.exe -m pytest -q
--junitxml "$env:RUNNER_TEMP\powercontext-native-windows-cursor.xml"
tests/test_cursor_secret.py
tests/test_server.py::test_server_reuses_file_backed_cursor_secret_across_restarts
- name: Report Windows cursor failures
if: failure()
shell: pwsh
run: >-
.native-venv\Scripts\python.exe .github\scripts\report_pytest_failures.py
"$env:RUNNER_TEMP\powercontext-native-windows-cursor.xml"
- name: Exercise the real Task Scheduler lifecycle
shell: pwsh
run: >-
.native-venv\Scripts\python.exe -m pytest -q
--junitxml "$env:RUNNER_TEMP\powercontext-native-windows-service.xml"
--basetemp "$env:RUNNER_TEMP\powercontext-native-tests"
tests/native/test_personal_service_lifecycle.py
- name: Report Windows lifecycle failures
if: failure()
shell: pwsh
run: >-
.native-venv\Scripts\python.exe .github\scripts\report_pytest_failures.py
"$env:RUNNER_TEMP\powercontext-native-windows-service.xml"
- name: Capture Task Scheduler diagnostics after failure
if: failure()
shell: pwsh
run: |
Get-ChildItem -LiteralPath "$env:RUNNER_TEMP\powercontext-native-tests" -Recurse -File -ErrorAction SilentlyContinue |
Where-Object { $_.Name -in @('server.stdout.log', 'server.stderr.log') } |
ForEach-Object {
Write-Output "::group::$($_.FullName)"
Get-Content -LiteralPath $_.FullName -Tail 100
Write-Output "::endgroup::"
}
schtasks.exe /Query /TN "$env:POWERCONTEXT_NATIVE_SERVICE_IDENTIFIER" /XML /HRESULT
if ($LASTEXITCODE -ne 0) { exit 0 }
schtasks.exe /Query /TN "$env:POWERCONTEXT_NATIVE_SERVICE_IDENTIFIER" /FO LIST /V /HRESULT
- name: Upload Windows native-service logs after failure
if: failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: windows-native-service-logs
path: ${{ runner.temp }}/powercontext-native-tests/**/logs/*
if-no-files-found: ignore