Skip to content

Commit 3f54ab0

Browse files
committed
update make.pas
1 parent 33d7a7d commit 3f54ab0

1 file changed

Lines changed: 33 additions & 3 deletions

File tree

.github/workflows/make.pas

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
Process;
1515

1616
const
17-
Target: string = '.';
17+
Target: string = 'SimpleBaseLib.Tests';
1818

1919
// ANSI color codes
2020
CSI_Reset = #27'[0m';
@@ -304,6 +304,36 @@ procedure RunTestProject(const APath: string);
304304
end;
305305
end;
306306

307+
// ---------------------------------------------------------------------------
308+
// Build and run a sample (non-test) project
309+
// ---------------------------------------------------------------------------
310+
311+
procedure RunSampleProject(const APath: string);
312+
var
313+
BinaryPath, SampleOutput: string;
314+
begin
315+
BinaryPath := BuildProject(APath);
316+
if BinaryPath = '' then
317+
Exit;
318+
try
319+
Log(CSI_Yellow, 'run ' + BinaryPath);
320+
if RunCommand(BinaryPath, [], SampleOutput) then
321+
WriteLn(SampleOutput)
322+
else
323+
begin
324+
Inc(ErrorCount);
325+
Log(CSI_Red, 'sample execution failed: ' + BinaryPath);
326+
WriteLn(stderr, SampleOutput);
327+
end;
328+
except
329+
on E: Exception do
330+
begin
331+
Inc(ErrorCount);
332+
Log(CSI_Red, E.ClassName + ': ' + E.Message);
333+
end;
334+
end;
335+
end;
336+
307337
// ---------------------------------------------------------------------------
308338
// Shared download + extract
309339
// ---------------------------------------------------------------------------
@@ -437,7 +467,7 @@ procedure RegisterAllPackages(const ASearchDir: string);
437467
end;
438468

439469
// ---------------------------------------------------------------------------
440-
// Build (and optionally test) all .lpi projects found under Target
470+
// Build (and optionally test/run) all .lpi projects found under Target
441471
// ---------------------------------------------------------------------------
442472

443473
procedure BuildAllProjects;
@@ -451,7 +481,7 @@ procedure BuildAllProjects;
451481
if IsTestProject(Each) then
452482
RunTestProject(Each)
453483
else
454-
BuildProject(Each);
484+
RunSampleProject(Each);
455485
finally
456486
List.Free;
457487
end;

0 commit comments

Comments
 (0)