-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a3034f2
commit 06120da
Showing
2 changed files
with
95 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
#!/usr/bin/python3 | ||
|
||
import sys | ||
import subprocess | ||
|
||
POSTGRES_PARTS = [ | ||
"docker", | ||
"compose", | ||
"-f", | ||
"./.ci/docker-compose.test.yml", | ||
"-f", | ||
"./.ci/docker-compose.test.postgres.yml" | ||
] | ||
|
||
SQLSERVER_PARTS = [ | ||
"docker", | ||
"compose", | ||
"-f", | ||
"./.ci/docker-compose.test.yml", | ||
"-f", | ||
"./.ci/docker-compose.test.sqlserver.yml" | ||
] | ||
|
||
RESTORE_PARTS = [ | ||
"dotnet", | ||
"restore", | ||
"Backbone.sln" | ||
] | ||
|
||
BUILD_PARTS = [ | ||
"dotnet", | ||
"build", | ||
"--no-restore", | ||
"Backbone.sln" | ||
] | ||
|
||
TEST_PARTS = [ | ||
"dotnet", | ||
"test", | ||
"--no-restore", | ||
"--no-build", | ||
"--filter", | ||
"Category=Integration&TestCategory!~ignore", | ||
"--logger", | ||
"GitHubActions;summary.includePassedTests=true;summary.includeSkippedTests=true", | ||
"Backbone.sln" | ||
] | ||
|
||
def runCmd(args: list[str]) -> int: | ||
return subprocess.run(args).returncode | ||
|
||
def docker_compose_postgres(args: list[str]) -> int: | ||
parts = POSTGRES_PARTS.copy() | ||
|
||
for a in args: | ||
parts.append(a) | ||
|
||
return runCmd(parts) | ||
|
||
def docker_compose_sqlserver(args: list[str]) -> int: | ||
parts = SQLSERVER_PARTS.copy() | ||
|
||
for a in args: | ||
parts.append(a) | ||
|
||
return runCmd(parts) | ||
|
||
def build_and_run_tests() -> int: | ||
ret = runCmd(RESTORE_PARTS) | ||
|
||
if ret != 0: | ||
ret = runCmd(BUILD_PARTS) | ||
if ret != 0: | ||
ret = runCmd(TEST_PARTS) | ||
|
||
return ret | ||
|
||
|
||
if __name__ == "__main__": | ||
ret = 1 | ||
|
||
if len(sys.argv) < 2: | ||
print("No arguments", file=sys.stderr) | ||
elif sys.argv[1] == "postgres": | ||
ret = docker_compose_postgres(sys.argv[2:]) | ||
elif sys.argv[1] == "sqlserver": | ||
ret = docker_compose_sqlserver(sys.argv[2:]) | ||
elif sys.argv[1] == "build": | ||
ret = build_and_run_tests() | ||
|
||
exit(ret) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters