Skip to content

Commit

Permalink
fixup! Add new command /tests to run bci-tests on a test build
Browse files Browse the repository at this point in the history
  • Loading branch information
dcermak committed Oct 25, 2023
1 parent 5be39e9 commit 56c8096
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 19 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/tests-command.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ jobs:
run: exit 1

- name: run BCI-tests
run: echo "${{ steps.find_comment.outputs.comment-body }}" | poetry run scratch-build-bot -vvvv --from-stdin run_bci_tests
run: |
echo "${{ steps.find_comment.outputs.comment-body }}" | poetry run scratch-build-bot -vvvv --from-stdin run_bci_tests
./run_bci_tests.sh
shell: fish {0}
env:
OSC_PASSWORD: ${{ secrets.OSC_PASSWORD }}
Expand Down
40 changes: 22 additions & 18 deletions src/staging/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
from obs_package_update.util import CommandError
from obs_package_update.util import CommandResult
from obs_package_update.util import retry_async_run_cmd
from obs_package_update.util import run_cmd
from obs_package_update.util import RunCommand
from staging.build_result import Arch
from staging.build_result import PackageBuildResult
Expand Down Expand Up @@ -1504,6 +1503,7 @@ def main() -> None:
import logging
import os.path
import sys
import stat
from typing import Any

from bci_build.package import ALL_OS_VERSIONS
Expand Down Expand Up @@ -1863,24 +1863,28 @@ async def _pkgs_as_str() -> str:
async def _run_tests() -> str:
tox_env = os.getenv("TOX_ENV")
bci_tests_branch = os.getenv("BCI_TESTS_BRANCH")
await run_cmd(
f"git clone https://github.com/SUSE/BCI-tests", logger=LOGGER
)
runner = RunCommand(
cwd=os.path.join(os.getcwd(), "BCI-tests"), logger=LOGGER
)

script = fr"""#!/bin/bash
set -euxo pipefail
git clone https://github.com/SUSE/BCI-tests
pushd BCI-tests
export OS_VERSION="15.{bot.os_version}"
export TARGET="custom"
export BASEURL="{bot.staging_project_registry_base_url}"
export TOX_SKIP_ENV='py(\d+)-unit'
"""
if bci_tests_branch:
await runner(f"git checkout {bci_tests_branch}")

test_res = await runner(
f"tox {'-e ' + tox_env if tox_env else ''} -- -n auto",
env={
"OS_VERSION": f"15.{bot.os_version}",
"TARGET": "custom",
"BASEURL": bot.staging_project_registry_base_url,
},
)
return test_res.stdout
script += f"""git checkout {bci_tests_branch}
"""

script += f"tox{' -e ' + tox_env if tox_env else ''} -- -n auto"

with open("run_bci_tests.sh", "w") as bci_tests_sh:
bci_tests_sh.write(script)

os.chmod("run_bci_tests.sh", 0o755)
return ""

coro = _run_tests()

Expand Down

0 comments on commit 56c8096

Please sign in to comment.