Skip to content

Commit 56c8096

Browse files
committed
fixup! Add new command /tests to run bci-tests on a test build
1 parent 5be39e9 commit 56c8096

File tree

2 files changed

+25
-19
lines changed

2 files changed

+25
-19
lines changed

.github/workflows/tests-command.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ jobs:
5454
run: exit 1
5555

5656
- name: run BCI-tests
57-
run: echo "${{ steps.find_comment.outputs.comment-body }}" | poetry run scratch-build-bot -vvvv --from-stdin run_bci_tests
57+
run: |
58+
echo "${{ steps.find_comment.outputs.comment-body }}" | poetry run scratch-build-bot -vvvv --from-stdin run_bci_tests
59+
./run_bci_tests.sh
5860
shell: fish {0}
5961
env:
6062
OSC_PASSWORD: ${{ secrets.OSC_PASSWORD }}

src/staging/bot.py

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
from obs_package_update.util import CommandError
3232
from obs_package_update.util import CommandResult
3333
from obs_package_update.util import retry_async_run_cmd
34-
from obs_package_update.util import run_cmd
3534
from obs_package_update.util import RunCommand
3635
from staging.build_result import Arch
3736
from staging.build_result import PackageBuildResult
@@ -1504,6 +1503,7 @@ def main() -> None:
15041503
import logging
15051504
import os.path
15061505
import sys
1506+
import stat
15071507
from typing import Any
15081508

15091509
from bci_build.package import ALL_OS_VERSIONS
@@ -1863,24 +1863,28 @@ async def _pkgs_as_str() -> str:
18631863
async def _run_tests() -> str:
18641864
tox_env = os.getenv("TOX_ENV")
18651865
bci_tests_branch = os.getenv("BCI_TESTS_BRANCH")
1866-
await run_cmd(
1867-
f"git clone https://github.com/SUSE/BCI-tests", logger=LOGGER
1868-
)
1869-
runner = RunCommand(
1870-
cwd=os.path.join(os.getcwd(), "BCI-tests"), logger=LOGGER
1871-
)
1866+
1867+
script = fr"""#!/bin/bash
1868+
set -euxo pipefail
1869+
1870+
git clone https://github.com/SUSE/BCI-tests
1871+
pushd BCI-tests
1872+
export OS_VERSION="15.{bot.os_version}"
1873+
export TARGET="custom"
1874+
export BASEURL="{bot.staging_project_registry_base_url}"
1875+
export TOX_SKIP_ENV='py(\d+)-unit'
1876+
"""
18721877
if bci_tests_branch:
1873-
await runner(f"git checkout {bci_tests_branch}")
1874-
1875-
test_res = await runner(
1876-
f"tox {'-e ' + tox_env if tox_env else ''} -- -n auto",
1877-
env={
1878-
"OS_VERSION": f"15.{bot.os_version}",
1879-
"TARGET": "custom",
1880-
"BASEURL": bot.staging_project_registry_base_url,
1881-
},
1882-
)
1883-
return test_res.stdout
1878+
script += f"""git checkout {bci_tests_branch}
1879+
"""
1880+
1881+
script += f"tox{' -e ' + tox_env if tox_env else ''} -- -n auto"
1882+
1883+
with open("run_bci_tests.sh", "w") as bci_tests_sh:
1884+
bci_tests_sh.write(script)
1885+
1886+
os.chmod("run_bci_tests.sh", 0o755)
1887+
return ""
18841888

18851889
coro = _run_tests()
18861890

0 commit comments

Comments
 (0)