Skip to content

Commit

Permalink
Merge branch 'main' into 1568-parallelStep-repeat-mixin
Browse files Browse the repository at this point in the history
  • Loading branch information
alnlarsen committed Jun 13, 2024
2 parents 5141c05 + 224c2ba commit 0ab3d86
Show file tree
Hide file tree
Showing 32 changed files with 1,679 additions and 24,333 deletions.
35 changes: 20 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,22 +137,21 @@ jobs:
with:
name: doc-api-html
path: API
- name: Pages Cache
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- uses: actions/setup-node@v4
name: Setup NPM
with:
node-version: 14
- name: Install
run: npm install
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
cache-dependency-path: "doc/package-lock.json"
- name: Install dependencies
run: npm ci
working-directory: doc
- name: Build
run: npm run build
# This is needed because the router wants to serve index.html as the default page
- name: Rename Index
run: mv Readme.md index.md
working-directory: doc
- name: Build with VitePress
run: npm run docs:build
working-directory: doc
- name: Copy API
run: cp -r API public/api
Expand All @@ -164,6 +163,12 @@ jobs:
deploy_key: ${{ secrets.PAGES_DEPLOY_TOKEN }}
publish_branch: main
external_repository: opentap/opentap.github.io
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: pages
retention-days: 5
path: public

Build-Linux:
runs-on: ubuntu-latest
Expand Down
34 changes: 20 additions & 14 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,22 +85,21 @@ jobs:
with:
name: doc-api-html
path: API
- name: Pages Cache
uses: actions/cache@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- uses: actions/setup-node@v4
name: Setup NPM
with:
node-version: 14
- name: Install
run: npm install
node-version: 20
cache: npm
cache-dependency-path: "doc/package-lock.json"
- name: Install dependencies
run: npm ci
working-directory: doc
# This is needed because the router wants to serve index.html as the default page
- name: Rename Index
run: mv Readme.md index.md
working-directory: doc
- name: Build
run: npm run build
- name: Build with VitePress
run: npm run docs:build
working-directory: doc
- name: Copy API
run: cp -r API public/api
Expand All @@ -111,3 +110,10 @@ jobs:
deploy_key: ${{ secrets.PAGES_DEPLOY_TOKEN }}
publish_branch: main
external_repository: opentap/opentap.github.io
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: pages
retention-days: 5
path: public

5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ TestResults/
nuget/build/payload
node_modules/
/public/
doc/.vitepress/dist/
doc/.vitepress/cache/
.DS_Store

# Temp files from git merges:
*.orig
Expand All @@ -18,4 +21,4 @@ TestResult.xml
LinuxInstall/package

#ignore Rider files
*.idea/
*.idea/
43 changes: 42 additions & 1 deletion Engine.UnitTests/TestPlanCompositeRunTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,55 @@ public void ShortTimeSpanTest()
var s = new[] { "10 ms", "1 ms", "100 us", "10 μs", "1 μs", "1 ns", "0 s" };

for (int i = 0; i < v.Length; i++)
{
{
var s1 = ShortTimeSpan.FromSeconds(v[i]);
var s2 = ShortTimeSpan.FromString(s[i]);
StringAssert.AreEqualIgnoringCase(s1.ToString(), s2.ToString());

}
}

[Test]
public void LongTimeSpanTest()
{
var seconds = new TimeSpan[]
{
new TimeSpan(1, 0, 0, 0),
new TimeSpan(0, 23, 30, 0) ,
new TimeSpan(23, 12, 22, 0),
new TimeSpan(1, 0, 5, 0),
new TimeSpan(0, 5, 0, 3),
new TimeSpan(3, 0, 21, 10),
new TimeSpan(999, 23 ,59, 59),
new TimeSpan(1, 0,0, 59),
new TimeSpan(0, 0,0, 1),
new TimeSpan(0,0, 0,0),
new TimeSpan(0,0, 1,59),
new TimeSpan(0,0,0,59)
};
var expectedTimeSpan = new[]
{
"1 d",
"23 h 30 m",
"23 d 12 h 22 m",
"1 d 5 m",
"5 h 3 s" ,
"3 d 21 m 10 s",
"999 d 23 h 59 m 59 s",
"1 d 59 s",
"1.00 s",
"0.00 s",
"1 m 59 s",
"59.0 s"
};

for (int i = 0; i < seconds.Length; i++)
{
var actualTimeSpan = ShortTimeSpan.LongTimeSpanFormat(seconds[i]).Trim();
StringAssert.AreEqualIgnoringCase(expectedTimeSpan[i], actualTimeSpan);
}
}


[Test, Retry(3)]
public void RunCompositeFollowedByRun()
Expand Down
9 changes: 4 additions & 5 deletions Engine/TestPlanRunSummaryListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,11 @@ static void printSummary(IDictionary<Guid, TestStepRunData> stepRuns, TestStepRu
int indentcnt = stepRunIndent(stepRuns, run);
string indent = new String(' ', indentcnt * 2);
string inverseIndent = new String(' ', maxIndent * 2 - indentcnt * 2);

var (timeString, unit) = ShortTimeSpan.FromSeconds(run.Duration.TotalSeconds).ToStringParts();

string v = run.Verdict == Verdict.NotSet ? "" : run.Verdict.ToString();
var name = run.TestStepName;
// this prints something like this: '12:42:16.302 Summary Delay 106 ms'
summaryLog.Info($"{indent} {name,-43} {inverseIndent}{timeString,5:0} {unit,-4}{v,-7}");
summaryLog.Info($"{indent} {name,-43} {inverseIndent}{ShortTimeSpan.LongTimeSpanFormat(run.Duration)} {v,-7}");

int idx2 = 0;
foreach (TestStepRunData run2 in lookup[run.Id])
Expand Down Expand Up @@ -245,11 +244,11 @@ public void PrintSummary()

if (!hasOtherVerdict)
{
summaryLog.Info(formatSummary($" Test plan completed successfully in {ShortTimeSpan.FromSeconds(planRun.Duration.TotalSeconds).ToString(),6} "));
summaryLog.Info(formatSummary($" Test plan completed successfully in {ShortTimeSpan.LongTimeSpanFormat(planRun.Duration)} "));
}
else
{
summaryLog.Info(formatSummary(string.Format(" Test plan completed with verdict {1} in {0,6} ", ShortTimeSpan.FromSeconds(planRun.Duration.TotalSeconds).ToString(), planRun.Verdict)));
summaryLog.Info(formatSummary(string.Format(" Test plan completed with verdict {1} in {0,6} ", ShortTimeSpan.LongTimeSpanFormat(planRun.Duration), planRun.Verdict)));
}
}

Expand Down
45 changes: 45 additions & 0 deletions Shared/ShortTimeSpan.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// file, you can obtain one at http://mozilla.org/MPL/2.0/.
using System.Globalization;
using System;
using System.Xml.Linq;

namespace OpenTap
{
Expand All @@ -12,6 +13,7 @@ namespace OpenTap
/// </summary>
struct ShortTimeSpan
{

public enum UnitKind{
Seconds,
Milliseconds,
Expand Down Expand Up @@ -58,6 +60,49 @@ public static ShortTimeSpan FromSeconds(double seconds)
return new ShortTimeSpan { unit = unit, Value = Math.Round(s, 3) };
}

/// <summary>
/// For formating of timespans longer than 1 minute like "1 d 1 h 14m" instead of "90840 s"
/// </summary>
/// <param name="timeSpan"></param>
/// <returns></returns>
public static string LongTimeSpanFormat(TimeSpan timeSpan)
{
string result = "";
if (timeSpan.TotalMinutes < 1)
{
var (timeString, unit) = FromSeconds(timeSpan.TotalSeconds).ToStringParts();

return FormatTimeStringParts(timeString, unit);
}
if (timeSpan.Days > 0)
{
result += $"{timeSpan.Days} d ";

}
if (timeSpan.Hours > 0)
{
result += $"{timeSpan.Hours} h ";
}

if (timeSpan.Minutes > 0)
{
result += $"{timeSpan.Minutes} m ";
}

if (timeSpan.Seconds > 0)
{
result += $"{timeSpan.Seconds} s ";
}

return result.Trim();
}

private static string FormatTimeStringParts(string timeString, string unit)
{
var formattedString = $"{timeString,5:0} {unit,-4}";
return formattedString;
}

public static ShortTimeSpan FromString(string str)
{
str = str.Trim();
Expand Down
104 changes: 104 additions & 0 deletions doc/.vitepress/config.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
import { defineConfig } from 'vitepress'

export default defineConfig({
title: "OpenTAP",
description: "OpenTAP Documentation",
markdown: {
lineNumbers: true
},
outDir: '../public',
themeConfig: {
socialLinks: [
{ icon: 'github', link: 'https://github.com/opentap/opentap' }
],
search: {
provider: 'local'
},
editLink: {
pattern: 'https://github.com/opentap/opentap/edit/main/doc/:path'
},
docFooter: {
prev: false,
next: false
},
logo: '/opentap.svg',
siteTitle: false,

nav: [
{ text: 'Homepage', link: 'https://opentap.io' }
],

sidebar: [
{
text: "Getting Started",
link: "/"
},
{
text: 'User Guide',
collapsed: false,
items: [
{ text: 'Overview', link: 'User Guide/Introduction/Readme.md' },
{ text: 'CLI Usage', link: 'User Guide/CLI Usage/Readme.md' },
{ text: 'Editors', link: 'User Guide/Editors/Readme.md' }
]
},
{
text: 'Developer Guide',
collapsed: false,
items: [
{ link: "Developer Guide/Introduction/Readme.md", text: "Introduction" },
{ link: "Developer Guide/What is OpenTAP/Readme.md", text: "OpenTAP Overview" },
{ link: "Developer Guide/Getting Started in Visual Studio/Readme.md", text: "Getting Started" },
{ link: "Developer Guide/Development Essentials/Readme.md", text: "Development Essentials" },
{ link: "Developer Guide/Test Step/Readme.md", text: "Test Step" },
{ link: "Developer Guide/Resources/Readme.md", text: "Resources" },
{ link: "Developer Guide/Result Listener/Readme.md", text: "Result Listener" },
{ link: "Developer Guide/Component Setting/Readme.md", text: "Component Setting" },
{ link: "Developer Guide/Annotations/Readme.md", text: "Annotations" },
{ link: "Developer Guide/Plugin Packaging and Versioning/Readme.md", text: "Plugin Packaging and Versioning" },
{ link: "Developer Guide/Package Publishing/Readme.md", text: "Package Publishing" },
{ link: "Developer Guide/Continuous Integration/Readme.md", text: "Continuous Integration (CI/CD)" },
{ link: "Developer Guide/Attributes/Readme.md", text: "Attributes" },
{ link: "Developer Guide/Known Issues/Readme.md", text: "Known Issues" },
{ link: "Developer Guide/Appendix A/Readme.md", text: "Appendix A: Macro Strings" }
]
},
{
text: 'API Reference',
link: '/api/index.html',
target: '_blank'
},
{
text: 'Release Notes',
collapsed: true,
items: [
{ link: '/Release Notes/ReleaseNote_OpenTAP9.23.md', text: "Release Notes - OpenTAP 9.23"},
{ link: '/Release Notes/ReleaseNote_OpenTAP9.22.md', text: "Release Notes - OpenTAP 9.22"},
{ link: '/Release Notes/ReleaseNote_OpenTAP9.21.md', text: "Release Notes - OpenTAP 9.21"},
{ link: '/Release Notes/ReleaseNote_OpenTAP9.20.md', text: "Release Notes - OpenTAP 9.20"},
{ link: '/Release Notes/ReleaseNote_OpenTAP9.19.md', text: "Release Notes - OpenTAP 9.19"},
{ link: '/Release Notes/ReleaseNote_OpenTAP9.18.md', text: "Release Notes - OpenTAP 9.18"},
{ link: '/Release Notes/ReleaseNote_OpenTAP9.17.md', text: "Release Notes - OpenTAP 9.17"},
{ link: '/Release Notes/ReleaseNote_OpenTAP9.16.md', text: "Release Notes - OpenTAP 9.16"},
{ link: '/Release Notes/ReleaseNote_OpenTAP9.15.md', text: "Release Notes - OpenTAP 9.15"},
{ link: '/Release Notes/ReleaseNote_OpenTAP9.14.md', text: "Release Notes - OpenTAP 9.14"},
{ link: '/Release Notes/ReleaseNote_OpenTAP9.13.md', text: "Release Notes - OpenTAP 9.13"},
{ link: '/Release Notes/ReleaseNote_OpenTAP9.12.md', text: "Release Notes - OpenTAP 9.12"},
{ link: '/Release Notes/ReleaseNote_OpenTAP9.11.md', text: "Release Notes - OpenTAP 9.11"},
{ link: '/Release Notes/ReleaseNote_OpenTAP9.10.md', text: "Release Notes - OpenTAP 9.10"},
{ link: '/Release Notes/ReleaseNote_OpenTAP9.9.md', text: "Release Notes - OpenTAP 9.9"},
{ link: '/Release Notes/ReleaseNote_OpenTAP9.8.md', text: "Release Notes - OpenTAP 9.8"},
{ link: '/Release Notes/ReleaseNote_OpenTAP9.7.md', text: "Release Notes - OpenTAP 9.7"},
{ link: '/Release Notes/ReleaseNote_OpenTAP9.6.md', text: "Release Notes - OpenTAP 9.6"},
{ link: '/Release Notes/ReleaseNote_OpenTAP9.5.md', text: "Release Notes - OpenTAP 9.5"},
{ link: '/Release Notes/ReleaseNote_OpenTAP9.4.md', text: "Release Notes - OpenTAP 9.4"},
{ link: '/Release Notes/ReleaseNote_OpenTAP9.3.md', text: "Release Notes - OpenTAP 9.3"}
]
},
{
text: 'FAQ',
link: 'FAQ/Readme.md'
}
]
}
})
23 changes: 23 additions & 0 deletions doc/.vitepress/theme/NotFound.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<template>
<Layout/>
</template>

<script setup lang="ts">
import { useData } from 'vitepress'
import DefaultTheme from 'vitepress/theme'
import { useRouter } from 'vitepress'
const { Layout } = DefaultTheme
const { route, go } = useRouter()
const { hash } = useData()
if (route.path.toLowerCase().endsWith(".html") == false) {
let fixedPathname = route.path;
if (route.path.endsWith('/') == false)
fixedPathname += '/';
fixedPathname += 'Readme.html' + hash.value;
go(fixedPathname);
}
</script>
Loading

0 comments on commit 0ab3d86

Please sign in to comment.