Skip to content

Commit d654868

Browse files
committed
fixup! Add new command /tests to run bci-tests on a test build
1 parent 30e1f68 commit d654868

2 files changed

Lines changed: 25 additions & 19 deletions

File tree

.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
@@ -32,7 +32,6 @@
3232
from obs_package_update.util import CommandError
3333
from obs_package_update.util import CommandResult
3434
from obs_package_update.util import retry_async_run_cmd
35-
from obs_package_update.util import run_cmd
3635
from obs_package_update.util import RunCommand
3736
from staging.build_result import Arch
3837
from staging.build_result import PackageBuildResult
@@ -1441,6 +1440,7 @@ def main() -> None:
14411440
import logging
14421441
import os.path
14431442
import sys
1443+
import stat
14441444
from typing import Any
14451445

14461446
from bci_build.package import ALL_OS_VERSIONS
@@ -1798,24 +1798,28 @@ async def _pkgs_as_str() -> str:
17981798
async def _run_tests() -> str:
17991799
tox_env = os.getenv("TOX_ENV")
18001800
bci_tests_branch = os.getenv("BCI_TESTS_BRANCH")
1801-
await run_cmd(
1802-
f"git clone https://github.com/SUSE/BCI-tests", logger=LOGGER
1803-
)
1804-
runner = RunCommand(
1805-
cwd=os.path.join(os.getcwd(), "BCI-tests"), logger=LOGGER
1806-
)
1801+
1802+
script = fr"""#!/bin/bash
1803+
set -euxo pipefail
1804+
1805+
git clone https://github.com/SUSE/BCI-tests
1806+
pushd BCI-tests
1807+
export OS_VERSION="15.{bot.os_version}"
1808+
export TARGET="custom"
1809+
export BASEURL="{bot.staging_project_registry_base_url}"
1810+
export TOX_SKIP_ENV='py(\d+)-unit'
1811+
"""
18071812
if bci_tests_branch:
1808-
await runner(f"git checkout {bci_tests_branch}")
1809-
1810-
test_res = await runner(
1811-
f"tox {'-e ' + tox_env if tox_env else ''} -- -n auto",
1812-
env={
1813-
"OS_VERSION": f"15.{bot.os_version}",
1814-
"TARGET": "custom",
1815-
"BASEURL": bot.staging_project_registry_base_url,
1816-
},
1817-
)
1818-
return test_res.stdout
1813+
script += f"""git checkout {bci_tests_branch}
1814+
"""
1815+
1816+
script += f"tox{' -e ' + tox_env if tox_env else ''} -- -n auto"
1817+
1818+
with open("run_bci_tests.sh", "w") as bci_tests_sh:
1819+
bci_tests_sh.write(script)
1820+
1821+
os.chmod("run_bci_tests.sh", 0o755)
1822+
return ""
18191823

18201824
coro = _run_tests()
18211825

0 commit comments

Comments
 (0)