Skip to content

refactor(evaluation): organize suites with independent commands #1277

refactor(evaluation): organize suites with independent commands

refactor(evaluation): organize suites with independent commands #1277

Workflow file for this run

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