Skip to content

Commit

Permalink
move is_ci function to common
Browse files Browse the repository at this point in the history
  • Loading branch information
rkm committed Oct 11, 2024
1 parent 305b72e commit 0797988
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
6 changes: 6 additions & 0 deletions bin/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,9 @@ def start_containers(
)
run(cmd)
raise

def is_ci() -> bool:
ci = os.environ.get("CI", None)
if ci is None:
return False
return ci == "1" or ci.lower() == "true"
11 changes: 2 additions & 9 deletions bin/smi/writeDatabaseStrings.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,6 @@
assert _TEST_DBS_TXT.is_file()


def _is_ci() -> bool:
ci = os.environ.get("CI", None)
if ci is None:
return False
return ci == "1" or ci.lower() == "true"


def main() -> int:

parser = argparse.ArgumentParser()
Expand All @@ -41,7 +34,7 @@ def main() -> int:
f.write(f"SqlServer: 'Server={args.mssql_server};User Id=sa;Password={args.db_password};TrustServerCertificate=true;'\n")

# NOTE(rkm 2022-02-27) We don't run MySQL in Windows in GitHub actions
if not (os.name == "nt" and _is_ci()):
if not (os.name == "nt" and C.is_ci()):
f.write(f"MySql: 'server=127.0.0.1;Uid=root;Pwd={args.db_password};sslmode=None'\n")

with open(_RELATIONAL_YAML) as f:
Expand All @@ -53,7 +46,7 @@ def main() -> int:
f.write("Prefix: TEST_\n")
f.write("Username: sa\n")
f.write(f"Password: {args.db_password}\n")
if not (os.name == "nt" and _is_ci()):
if not (os.name == "nt" and C.is_ci()):
f.write(f"MySql: server=127.0.0.1;Uid=root;Pwd={args.db_password};sslmode=None\n")

with open(_TEST_DBS_TXT) as f:
Expand Down

0 comments on commit 0797988

Please sign in to comment.