Skip to content

Commit

Permalink
Merge pull request #1087 from SMI/fix/ci-forward-return-codes
Browse files Browse the repository at this point in the history
CI fixes
  • Loading branch information
rkm committed Mar 15, 2022
2 parents 587e38e + 13bdfe8 commit 999647c
Show file tree
Hide file tree
Showing 13 changed files with 50 additions and 34 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ jobs:
run: ./bin/smi/downloadRdmpCli.py ${{ env.rdmp_cli_ver }}
- name: install RDMP databases
run: ${{ env.rdmp-cli-dir }}/rdmp install --createdatabasetimeout 180 ${{ env.rdmp_conn_str }} TEST_
- name: show dotnet info
run: dotnet --info
- name: build, test, and package dotnet
run: |
set -euxo pipefail
Expand Down
2 changes: 2 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
Expand All @@ -9,6 +10,7 @@
<LangVersion>9.0</LangVersion>
<OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
<Platforms>x64</Platforms>
<RuntimeIdentifiers>linux-x64;win-x64</RuntimeIdentifiers>
<SatelliteResourceLanguages>none</SatelliteResourceLanguages>
<TargetFramework>net6</TargetFramework>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
Expand Down
4 changes: 3 additions & 1 deletion bin/ctp/buildTestPackage.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ def main() -> int:
dist_tag_dir.mkdir(parents=True, exist_ok=True)

if args.install_libs:
L.main()
rc = L.main()
if rc:
return rc

mvn = "mvn" if os.name == "posix" else "mvn.cmd"
cmd = (
Expand Down
4 changes: 3 additions & 1 deletion bin/smi-py/testPackage.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ def main() -> int:
)
C.run(cmd)

T.main(("-p", str(python_exe)))
rc = T.main(("-p", str(python_exe)))
if rc:
return rc

cmd = (
python_exe,
Expand Down
2 changes: 1 addition & 1 deletion bin/smi/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def main(argv: Optional[Sequence[str]] = None) -> int:
cmd = (
"dotnet",
"build",
"-p:Platform=x64",
"--use-current-runtime",
"--configuration", args.configuration,
"--verbosity", "quiet",
"--nologo",
Expand Down
20 changes: 16 additions & 4 deletions bin/smi/buildTestPackage.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import common as C

import dotnetCommon as DC
import build as DB
import package as DP
import test as DT

Expand All @@ -26,17 +27,28 @@ def main() -> int:
)
args, _ = parser.parse_known_args()

# TODO(rkm 2022-02-26) Add --no-build here
cfg_args = ("-c", args.configuration)

# Clean and Build
rc = DB.main((*cfg_args, "--clean"))
if rc:
return rc

# Test
test_cmd = ("--test", args.test[0]) if args.test else ()
DT.main((
rc = DT.main((
*cfg_args,
"--no-coverage" if args.no_coverage else "",
"--no-build",
*test_cmd
))
DP.main((*cfg_args, args.tag))
if rc:
return rc

# Package
rc = DP.main((*cfg_args, args.tag))

return 0
return rc


if __name__ == "__main__":
Expand Down
4 changes: 2 additions & 2 deletions bin/smi/dotnetCommon.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def add_args(
parser.add_argument(
"-c",
"--configuration",
type=str.lower,
choices=("debug", "release"),
type=str.title,
choices=("Debug", "Release"),
default=configuration,
)
8 changes: 6 additions & 2 deletions bin/smi/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ def main(argv: Optional[Sequence[str]] = None) -> int:

parser = C.get_parser()
DC.add_args(parser)
parser.add_argument(
"--no-build",
action="store_true",
)
args = parser.parse_args(argv)

dist_tag_dir = C.DIST_DIR / args.tag
Expand All @@ -42,10 +46,10 @@ def main(argv: Optional[Sequence[str]] = None) -> int:
cmd = (
"dotnet",
"publish",
"--use-current-runtime",
"--configuration", args.configuration,
"-p:Platform=x64",
"--no-build" if args.no_build else "",
"-p:PublishTrimmed=false",
"--runtime", rid,
"--self-contained",
"--output", dist_tag_dir / smi_services_output_dir,
"--verbosity", "quiet",
Expand Down
10 changes: 7 additions & 3 deletions bin/smi/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ def _run_csproj_tests(
cmd = (
"dotnet",
"test",
"-p:Platform=x64",
"--configuration", configuration,
"--verbosity", "quiet",
"-p:Platform=x64",
"--settings", (C.PROJ_ROOT / "data/nunit.runsettings").resolve(),
"--no-build" if no_build else "",
csproj,
Expand Down Expand Up @@ -75,10 +75,14 @@ def main(argv: Optional[Sequence[str]] = None) -> int:
)
args, _ = parser.parse_known_args(argv)

downloadTessdata.main([])
rc = downloadTessdata.main([])
if rc:
return rc

if not args.no_build:
DB.main(("--configuration", args.configuration))
rc = DB.main(("--configuration", args.configuration))
if rc:
return rc

with open(C.PROJ_ROOT / "global.json") as f:
global_json = json.load(f)
Expand Down
6 changes: 6 additions & 0 deletions news/1087-bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[CI] Misc. CI fixes
- Fixes the build scripts to respect any intermediate non-zero return codes
- Fixes the build scripts to only build `linux-x64` and `win-x64`
- Fixes the build scripts to select the correct build configuration
- Removes a bogus test leftover from #1089
- Temporarily disables a few tests requiring a fix for the `leptonica` libs
Original file line number Diff line number Diff line change
Expand Up @@ -50,26 +50,6 @@ private class TestExtractJobStore : ExtractJobStore

#region Test Methods

[Test]
public void TestPersistMessageToStore_ExtractionRequestInfoMessage()
{
var testExtractJobStore = new TestExtractJobStore();
var message = new ExtractionRequestInfoMessage();
var mockHeader = new MessageHeader();

message.KeyTag = "SeriesInstanceUID";
message.ExtractionModality = null;
testExtractJobStore.PersistMessageToStore(message, mockHeader);

message.KeyTag = "StudyInstanceUID";
message.ExtractionModality = "MR";
testExtractJobStore.PersistMessageToStore(message, mockHeader);

message.KeyTag = "StudyInstanceUID";
message.ExtractionModality = null;
Assert.Throws<ApplicationException>(() => testExtractJobStore.PersistMessageToStore(message, mockHeader));
}

[Test]
public void TestPersistMessageToStore_ExtractFileStatusMessage()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public void OneTimeSetUp()

#region Tests

[Ignore("Requires leptonica fix")]
[TestCase(true)]
[TestCase(false)]
public void IgnorePixelDataLessThan(bool ignoreShortText)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public void TestClassifierName_ValidClassifier()
}
}

[Ignore("Requires leptonica fix")]
[Test]
public void TestIsIdentifiable_TesseractStanfordDicomFileClassifier()
{
Expand Down

0 comments on commit 999647c

Please sign in to comment.