Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,9 @@ jobs:
dotnet-version: ['8.x', '9.x', '10.x']

steps:
- name: Checkout
uses: actions/checkout@v6

- name: Download package
uses: actions/download-artifact@v7
with:
Expand Down Expand Up @@ -253,13 +256,30 @@ jobs:
|| { echo "✗ Self-validation failed"; exit 1; }
echo "✓ Self-validation succeeded"

- name: Capture tool versions
shell: bash
run: |
echo "Capturing tool versions..."
# Create short job ID: int-win-8, int-win-9, int-ubuntu-8, etc.
OS_SHORT=$(echo "${{ matrix.os }}" | sed 's/windows-latest/win/;s/ubuntu-latest/ubuntu/')
DOTNET_SHORT=$(echo "${{ matrix.dotnet-version }}" | sed 's/\.x$//')
JOB_ID="int-${OS_SHORT}-${DOTNET_SHORT}"
versionmark --capture --job-id "${JOB_ID}" -- dotnet git
echo "✓ Tool versions captured"

- name: Upload validation test results
if: always()
uses: actions/upload-artifact@v6
with:
name: validation-test-results-${{ matrix.os }}-dotnet${{ matrix.dotnet-version }}
path: validation-${{ matrix.os }}-dotnet${{ matrix.dotnet-version }}.trx

- name: Upload version capture
uses: actions/upload-artifact@v6
with:
name: version-capture-${{ matrix.os }}-dotnet${{ matrix.dotnet-version }}
path: versionmark-int-*.json

# Builds the supporting documentation including user guides, requirements,
# trace matrices, code quality reports, and build notes.
build-docs:
Expand Down Expand Up @@ -297,6 +317,13 @@ jobs:
name: codeql-sarif
path: codeql-results

- name: Download all version captures
uses: actions/download-artifact@v7
with:
path: version-captures
pattern: 'version-capture-*'
continue-on-error: true

- name: Setup dotnet
uses: actions/setup-dotnet@v5
with:
Expand All @@ -317,6 +344,14 @@ jobs:
- name: Restore Tools
run: dotnet tool restore

- name: Capture tool versions for build-docs
shell: bash
run: |
echo "Capturing tool versions..."
versionmark --capture --job-id "build-docs" -- \
dotnet git node npm pandoc weasyprint sarifmark sonarmark reqstream buildmark
echo "✓ Tool versions captured"

- name: Generate Requirements Report, Justifications, and Trace Matrix
run: >
dotnet reqstream
Expand Down Expand Up @@ -370,6 +405,20 @@ jobs:
--report docs/buildnotes.md
--report-depth 1

- name: Publish Tool Versions
shell: bash
run: |
echo "Publishing tool versions..."
versionmark --publish --report docs/buildnotes/versions.md --report-depth 2 \
-- "versionmark-*.json" "version-captures/**/versionmark-*.json"
echo "✓ Tool versions published"

- name: Display Tool Versions Report
shell: bash
run: |
echo "=== Tool Versions Report ==="
cat docs/buildnotes/versions.md

- name: Generate Build Notes HTML with Pandoc
Comment thread
Malcolmnixon marked this conversation as resolved.
shell: bash
run: >
Expand Down
1 change: 1 addition & 0 deletions docs/buildnotes/definition.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ resource-path:
input-files:
- docs/buildnotes/title.txt
- docs/buildnotes/introduction.md
- docs/buildnotes/versions.md
- docs/buildnotes.md
template: template.html
table-of-contents: true
Expand Down
24 changes: 13 additions & 11 deletions src/DemaConsulting.VersionMark/VersionMarkConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -336,27 +336,22 @@ public VersionInfo FindVersions(IEnumerable<string> toolNames, string jobId)
/// </remarks>
private static string RunCommand(string command)
{
// Split command into executable and arguments
var parts = command.Split(' ', 2, StringSplitOptions.RemoveEmptyEntries);
if (parts.Length == 0)
{
throw new InvalidOperationException("Command is empty");
}

var fileName = parts[0];
var arguments = parts.Length > 1 ? parts[1] : string.Empty;
// To support .cmd/.bat files on Windows and shell features on all platforms,
// we run commands through the appropriate shell using ArgumentList to avoid escaping issues
var isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);

try
{
var processStartInfo = new ProcessStartInfo
{
FileName = fileName,
Arguments = arguments,
FileName = isWindows ? "cmd.exe" : "/bin/sh",
RedirectStandardOutput = true,
RedirectStandardError = true,
UseShellExecute = false,
CreateNoWindow = true
};
processStartInfo.ArgumentList.Add(isWindows ? "/c" : "-c");
processStartInfo.ArgumentList.Add(command);

using var process = Process.Start(processStartInfo);
if (process == null)
Expand All @@ -371,6 +366,13 @@ private static string RunCommand(string command)
var output = outputTask.Result;
var error = errorTask.Result;

// Check exit code - if non-zero, command failed
if (process.ExitCode != 0)
{
var errorMessage = string.IsNullOrEmpty(error) ? output : error;
throw new InvalidOperationException($"Failed to run command '{command}': {errorMessage}");
}

// Combine stdout and stderr with newline separator for better debuggability
if (string.IsNullOrEmpty(error))
{
Expand Down
Loading
Loading