Skip to content

Commit

Permalink
feat: add started time information to summary
Browse files Browse the repository at this point in the history
  • Loading branch information
jamacku committed Sep 24, 2024
1 parent ff5056c commit 835fb98
Show file tree
Hide file tree
Showing 10 changed files with 3,206 additions and 14 deletions.
3,151 changes: 3,149 additions & 2 deletions dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions dist/licenses.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions dist/summary.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/summary.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"@octokit/plugin-throttling": "9.3.1",
"@octokit/rest": "21.0.2",
"@octokit/types": "13.5.0",
"date-fns": "^4.1.0",
"issue-metadata": "0.2.3",
"testing-farm": "1.10.0",
"zod": "3.23.5"
Expand Down
3 changes: 3 additions & 0 deletions src/summary.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { summary } from '@actions/core';
import { format } from 'date-fns';

import { Data } from './schema/metadata';

Expand Down Expand Up @@ -38,6 +39,7 @@ export class Summary {
{ data: 'compose', header: true },
{ data: 'arch', header: true },
{ data: 'status', header: true },
{ data: 'started', header: true },
{ data: 'time', header: true },
{ data: 'logs', header: true },
];
Expand Down Expand Up @@ -91,6 +93,7 @@ export class Summary {
data.compose,
data.arch,
this.getStatusIcon(data.status, data.outcome, data.infrastructureFailure),
format(new Date(data.created), 'dd.MM.yyyy HH:mm:ss'),
this.getTime(data.runTime),
data.results.join(' '),
];
Expand Down
18 changes: 9 additions & 9 deletions tests/action.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ describe('Integration tests - action.ts', () => {

// Test summary
await assertSummary(`<h1>Testing Farm as a GitHub Action summary</h1>
<table><tr><th>name</th><th>compose</th><th>arch</th><th>status</th><th>time</th><th>logs</th></tr><tr><td>Fedora</td><td>${process.env['INPUT_COMPOSE']}</td><td>${process.env['INPUT_ARCH']}</td><td>✅ passed</td><td>1h 1min 31s</td><td><a href="https://artifacts.dev.testing-farm.io/1">test</a> <a href="https://artifacts.dev.testing-farm.io/1/pipeline.log">pipeline</a></td></tr></table>
<table><tr><th>name</th><th>compose</th><th>arch</th><th>status</th><th>started</th><th>time</th><th>logs</th></tr><tr><td>Fedora</td><td>${process.env['INPUT_COMPOSE']}</td><td>${process.env['INPUT_ARCH']}</td><td>✅ passed</td><td>24.08.2021 16:15:22</td><td>1h 1min 31s</td><td><a href="https://artifacts.dev.testing-farm.io/1">test</a> <a href="https://artifacts.dev.testing-farm.io/1/pipeline.log">pipeline</a></td></tr></table>
`);

expect(mocks.TFError).not.toHaveBeenCalled();
Expand Down Expand Up @@ -402,7 +402,7 @@ describe('Integration tests - action.ts', () => {

// Test summary
await assertSummary(`<h1>Testing Farm as a GitHub Action summary</h1>
<table><tr><th>name</th><th>compose</th><th>arch</th><th>status</th><th>time</th><th>logs</th></tr><tr><td>Fedora</td><td>${process.env['INPUT_COMPOSE']}</td><td>${process.env['INPUT_ARCH']}</td><td>✅ passed</td><td>1h 1min 31s</td><td><a href="https://artifacts.dev.testing-farm.io/1">test</a> <a href="https://artifacts.dev.testing-farm.io/1/pipeline.log">pipeline</a></td></tr></table>
<table><tr><th>name</th><th>compose</th><th>arch</th><th>status</th><th>started</th><th>time</th><th>logs</th></tr><tr><td>Fedora</td><td>${process.env['INPUT_COMPOSE']}</td><td>${process.env['INPUT_ARCH']}</td><td>✅ passed</td><td>24.08.2021 16:15:22</td><td>1h 1min 31s</td><td><a href="https://artifacts.dev.testing-farm.io/1">test</a> <a href="https://artifacts.dev.testing-farm.io/1/pipeline.log">pipeline</a></td></tr></table>
`);

expect(mocks.TFError).not.toHaveBeenCalled();
Expand Down Expand Up @@ -504,7 +504,7 @@ describe('Integration tests - action.ts', () => {

// Test summary
await assertSummary(`<h1>Testing Farm as a GitHub Action summary</h1>
<table><tr><th>name</th><th>compose</th><th>arch</th><th>status</th><th>time</th><th>logs</th></tr><tr><td>Fedora</td><td>${process.env['INPUT_COMPOSE']}</td><td>${process.env['INPUT_ARCH']}</td><td>✅ passed</td><td>1h 1min 31s</td><td><a href="https://artifacts.dev.testing-farm.io/1">test</a> <a href="https://artifacts.dev.testing-farm.io/1/pipeline.log">pipeline</a></td></tr></table>
<table><tr><th>name</th><th>compose</th><th>arch</th><th>status</th><th>started</th><th>time</th><th>logs</th></tr><tr><td>Fedora</td><td>${process.env['INPUT_COMPOSE']}</td><td>${process.env['INPUT_ARCH']}</td><td>✅ passed</td><td>24.08.2021 16:15:22</td><td>1h 1min 31s</td><td><a href="https://artifacts.dev.testing-farm.io/1">test</a> <a href="https://artifacts.dev.testing-farm.io/1/pipeline.log">pipeline</a></td></tr></table>
`);

expect(mocks.TFError).not.toHaveBeenCalled();
Expand Down Expand Up @@ -792,7 +792,7 @@ describe('Integration tests - action.ts', () => {

// Test summary
await assertSummary(`<h1>Testing Farm as a GitHub Action summary</h1>
<table><tr><th>name</th><th>compose</th><th>arch</th><th>status</th><th>time</th><th>logs</th></tr><tr><td>Fedora</td><td>${process.env['INPUT_COMPOSE']}</td><td>${process.env['INPUT_ARCH']}</td><td>❌ error</td><td>1h 1min 31s</td><td><a href="https://artifacts.dev.testing-farm.io/1">test</a> <a href="https://artifacts.dev.testing-farm.io/1/pipeline.log">pipeline</a></td></tr></table>
<table><tr><th>name</th><th>compose</th><th>arch</th><th>status</th><th>started</th><th>time</th><th>logs</th></tr><tr><td>Fedora</td><td>${process.env['INPUT_COMPOSE']}</td><td>${process.env['INPUT_ARCH']}</td><td>❌ error</td><td>24.08.2021 16:15:22</td><td>1h 1min 31s</td><td><a href="https://artifacts.dev.testing-farm.io/1">test</a> <a href="https://artifacts.dev.testing-farm.io/1/pipeline.log">pipeline</a></td></tr></table>
`);
});

Expand Down Expand Up @@ -914,7 +914,7 @@ describe('Integration tests - action.ts', () => {

// Test summary
await assertSummary(`<h1>Testing Farm as a GitHub Action summary</h1>
<table><tr><th>name</th><th>compose</th><th>arch</th><th>status</th><th>time</th><th>logs</th></tr><tr><td>Fedora</td><td>${process.env['INPUT_COMPOSE']}</td><td>${process.env['INPUT_ARCH']}</td><td>⛔ infra error</td><td>1h 1min 31s</td><td><a href="https://artifacts.dev.testing-farm.io/1">test</a> <a href="https://artifacts.dev.testing-farm.io/1/pipeline.log">pipeline</a></td></tr></table>
<table><tr><th>name</th><th>compose</th><th>arch</th><th>status</th><th>started</th><th>time</th><th>logs</th></tr><tr><td>Fedora</td><td>${process.env['INPUT_COMPOSE']}</td><td>${process.env['INPUT_ARCH']}</td><td>⛔ infra error</td><td>24.08.2021 16:15:22</td><td>1h 1min 31s</td><td><a href="https://artifacts.dev.testing-farm.io/1">test</a> <a href="https://artifacts.dev.testing-farm.io/1/pipeline.log">pipeline</a></td></tr></table>
`);
});

Expand Down Expand Up @@ -1134,7 +1134,7 @@ describe('Integration tests - action.ts', () => {

// Test summary
await assertSummary(`<h1>Testing Farm as a GitHub Action summary</h1>
<table><tr><th>name</th><th>compose</th><th>arch</th><th>status</th><th>time</th><th>logs</th></tr><tr><td>Fedora</td><td>${process.env['INPUT_COMPOSE']}</td><td>${process.env['INPUT_ARCH']}</td><td>✅ passed</td><td>1h 1min 31s</td><td><a href="https://artifacts.osci.redhat.com/testing-farm/1">test</a> <a href="https://artifacts.osci.redhat.com/testing-farm/1/pipeline.log">pipeline</a></td></tr></table>
<table><tr><th>name</th><th>compose</th><th>arch</th><th>status</th><th>started</th><th>time</th><th>logs</th></tr><tr><td>Fedora</td><td>${process.env['INPUT_COMPOSE']}</td><td>${process.env['INPUT_ARCH']}</td><td>✅ passed</td><td>24.08.2021 16:15:22</td><td>1h 1min 31s</td><td><a href="https://artifacts.osci.redhat.com/testing-farm/1">test</a> <a href="https://artifacts.osci.redhat.com/testing-farm/1/pipeline.log">pipeline</a></td></tr></table>
`);

expect(mocks.TFError).not.toHaveBeenCalled();
Expand Down Expand Up @@ -1241,7 +1241,7 @@ describe('Integration tests - action.ts', () => {
'POST /repos/{owner}/{repo}/issues/{issue_number}/comments',
{
body: `### Testing Farm results
<table><tr><th>name</th><th>compose</th><th>arch</th><th>status</th><th>time</th><th>logs</th></tr><tr><td>Fedora</td><td>Fedora-latest</td><td>x86_64</td><td>✅ passed</td><td>1h 1min 31s</td><td><a href=\"https://artifacts.dev.testing-farm.io/1\">test</a> <a href=\"https://artifacts.dev.testing-farm.io/1/pipeline.log\">pipeline</a></td></tr></table>
<table><tr><th>name</th><th>compose</th><th>arch</th><th>status</th><th>started</th><th>time</th><th>logs</th></tr><tr><td>Fedora</td><td>Fedora-latest</td><td>x86_64</td><td>✅ passed</td><td>24.08.2021 16:15:22</td><td>1h 1min 31s</td><td><a href=\"https://artifacts.dev.testing-farm.io/1\">test</a> <a href=\"https://artifacts.dev.testing-farm.io/1/pipeline.log\">pipeline</a></td></tr></table>
`,
issue_number: 1,
owner: 'sclorg',
Expand All @@ -1251,7 +1251,7 @@ describe('Integration tests - action.ts', () => {

// Test summary
await assertSummary(`<h1>Testing Farm as a GitHub Action summary</h1>
<table><tr><th>name</th><th>compose</th><th>arch</th><th>status</th><th>time</th><th>logs</th></tr><tr><td>Fedora</td><td>${process.env['INPUT_COMPOSE']}</td><td>${process.env['INPUT_ARCH']}</td><td>✅ passed</td><td>1h 1min 31s</td><td><a href="https://artifacts.dev.testing-farm.io/1">test</a> <a href="https://artifacts.dev.testing-farm.io/1/pipeline.log">pipeline</a></td></tr></table>
<table><tr><th>name</th><th>compose</th><th>arch</th><th>status</th><th>started</th><th>time</th><th>logs</th></tr><tr><td>Fedora</td><td>${process.env['INPUT_COMPOSE']}</td><td>${process.env['INPUT_ARCH']}</td><td>✅ passed</td><td>24.08.2021 16:15:22</td><td>1h 1min 31s</td><td><a href="https://artifacts.dev.testing-farm.io/1">test</a> <a href="https://artifacts.dev.testing-farm.io/1/pipeline.log">pipeline</a></td></tr></table>
`);

expect(mocks.TFError).not.toHaveBeenCalled();
Expand Down Expand Up @@ -1366,7 +1366,7 @@ describe('Integration tests - action.ts', () => {

// Test summary
await assertSummary(`<h1>Testing Farm as a GitHub Action summary</h1>
<table><tr><th>name</th><th>compose</th><th>arch</th><th>status</th><th>time</th><th>logs</th></tr><tr><td>Fedora</td><td>${process.env['INPUT_COMPOSE']}</td><td>${process.env['INPUT_ARCH']}</td><td>✅ passed</td><td>1h 1min 31s</td><td><a href="https://artifacts.dev.testing-farm.io/1">test</a> <a href="https://artifacts.dev.testing-farm.io/1/pipeline.log">pipeline</a></td></tr></table>
<table><tr><th>name</th><th>compose</th><th>arch</th><th>status</th><th>started</th><th>time</th><th>logs</th></tr><tr><td>Fedora</td><td>${process.env['INPUT_COMPOSE']}</td><td>${process.env['INPUT_ARCH']}</td><td>✅ passed</td><td>24.08.2021 16:15:22</td><td>1h 1min 31s</td><td><a href="https://artifacts.dev.testing-farm.io/1">test</a> <a href="https://artifacts.dev.testing-farm.io/1/pipeline.log">pipeline</a></td></tr></table>
`);

expect(mocks.TFError).not.toHaveBeenCalled();
Expand Down
Loading

0 comments on commit 835fb98

Please sign in to comment.