@@ -20,9 +20,12 @@ function setupPath(testCase)
2020 methods (TestMethodSetup )
2121 function createPlugin(testCase )
2222 import matlab .unittest .fixtures .WorkingFolderFixture ;
23-
23+ import matlab .unittest .fixtures .EnvironmentVariableFixture ;
24+
2425 testCase .applyFixture(WorkingFolderFixture );
2526 testCase.TempFolder = pwd();
27+ testCase .applyFixture(EnvironmentVariableFixture(" MW_GENERATE_JOB_SUMMARY" , " true" ));
28+ testCase .applyFixture(EnvironmentVariableFixture(" GITHUB_ACTION" , " my-action" ));
2629
2730 testCase.Plugin = ParallelizableBuildSummaryPlugin(TempFolder = testCase .TempFolder);
2831 testCase.Runner = matlab .buildtool.BuildRunner.withNoPlugins();
@@ -38,8 +41,8 @@ function runningBuildCreatesSummaryArtifact(testCase)
3841
3942 testCase .Runner.run(plan , [" t1" , " t2" ]);
4043
41- name = " buildSummary " + getenv( " GITHUB_RUN_ID " ) + " .json " ;
42- testCase .verifyTrue(isfile(fullfile( testCase .TempFolder, name )) );
44+ f = findBuildSummaryFile( testCase .TempFolder) ;
45+ testCase .verifyNotEmpty( f );
4346 end
4447
4548 function runningBuildCreatesSummaryArtifactWithExpectedTasks(testCase )
@@ -49,9 +52,8 @@ function runningBuildCreatesSummaryArtifactWithExpectedTasks(testCase)
4952
5053 testCase .Runner.run(plan , [" t1" , " t2" ]);
5154
52- name = " buildSummary" + getenv(" GITHUB_RUN_ID" ) + " .json" ;
53- f = fullfile(testCase .TempFolder, name );
54- testCase .assertTrue(isfile(f ));
55+ f = findBuildSummaryFile(testCase .TempFolder);
56+ testCase .assertTrue(~isempty(f ));
5557
5658 s = readstruct(f );
5759
@@ -67,9 +69,8 @@ function summaryArtifactStatusesAreCorrect(testCase)
6769
6870 testCase .Runner.run(plan , [" t1" , " t2" ]);
6971
70- name = " buildSummary" + getenv(" GITHUB_RUN_ID" ) + " .json" ;
71- f = fullfile(testCase .TempFolder, name );
72- testCase .assertTrue(isfile(f ));
72+ f = findBuildSummaryFile(testCase .TempFolder);
73+ testCase .assertTrue(~isempty(f ));
7374
7475 s = readstruct(f );
7576
@@ -88,10 +89,8 @@ function runningBuildCreatesSummaryForTaskGroups(testCase)
8889
8990 testCase .Runner.run(plan , " g:t" );
9091
91- name = " buildSummary" + getenv(" GITHUB_RUN_ID" ) + " .json" ;
92- f = fullfile(testCase .TempFolder, name );
93-
94- testCase .assertTrue(isfile(f ));
92+ f = findBuildSummaryFile(testCase .TempFolder);
93+ testCase .assertTrue(~isempty(f ));
9594
9695 s = readstruct(f );
9796
@@ -109,3 +108,12 @@ function runningBuildCreatesSummaryForTaskGroups(testCase)
109108function task = Task(varargin )
110109task = matlab .buildtool.Task(varargin{: });
111110end
111+
112+ function f = findBuildSummaryFile(folder )
113+ files = dir(fullfile(folder , " buildSummary*.json" ));
114+ if isempty(files )
115+ f = " " ;
116+ else
117+ f = fullfile(folder , files(1 ).name);
118+ end
119+ end
0 commit comments