Skip to content

Commit

Permalink
Add logging raw output to file
Browse files Browse the repository at this point in the history
Added logging the raw output from `act` into files under `workflow-tests/logs/<workflow_name>.log`. Raw output should have more information in case there are some errors instead of just returning an empty array like `act-js` does

See: Expensify#13604
  • Loading branch information
radoslawkrzemien committed Jun 30, 2023
1 parent c656216 commit 05c497b
Show file tree
Hide file tree
Showing 20 changed files with 138 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,6 @@ tests/e2e/results/

# Mock-github
/repo/

# Workflow test logs
/workflow_tests/logs/
6 changes: 6 additions & 0 deletions workflow_tests/authorChecklist.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ describe('test workflow authorChecklist', () => {
workflowFile: path.join(repoPath, '.github', 'workflows'),
mockSteps: testMockSteps,
actor,
logFile: utils.getLogFilePath('authorChecklist'),
});

assertions.assertChecklistJobExecuted(result);
Expand All @@ -85,6 +86,7 @@ describe('test workflow authorChecklist', () => {
workflowFile: path.join(repoPath, '.github', 'workflows'),
mockSteps: testMockSteps,
actor,
logFile: utils.getLogFilePath('authorChecklist'),
});

assertions.assertChecklistJobExecuted(result, false);
Expand Down Expand Up @@ -117,6 +119,7 @@ describe('test workflow authorChecklist', () => {
workflowFile: path.join(repoPath, '.github', 'workflows'),
mockSteps: testMockSteps,
actor,
logFile: utils.getLogFilePath('authorChecklist'),
});

assertions.assertChecklistJobExecuted(result);
Expand All @@ -143,6 +146,7 @@ describe('test workflow authorChecklist', () => {
workflowFile: path.join(repoPath, '.github', 'workflows'),
mockSteps: testMockSteps,
actor,
logFile: utils.getLogFilePath('authorChecklist'),
});

assertions.assertChecklistJobExecuted(result, false);
Expand Down Expand Up @@ -175,6 +179,7 @@ describe('test workflow authorChecklist', () => {
workflowFile: path.join(repoPath, '.github', 'workflows'),
mockSteps: testMockSteps,
actor,
logFile: utils.getLogFilePath('authorChecklist'),
});

assertions.assertChecklistJobExecuted(result);
Expand All @@ -201,6 +206,7 @@ describe('test workflow authorChecklist', () => {
workflowFile: path.join(repoPath, '.github', 'workflows'),
mockSteps: testMockSteps,
actor,
logFile: utils.getLogFilePath('authorChecklist'),
});

assertions.assertChecklistJobExecuted(result, false);
Expand Down
19 changes: 19 additions & 0 deletions workflow_tests/cherryPick.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ describe('test workflow cherryPick', () => {
workflowFile: path.join(repoPath, '.github', 'workflows'),
mockSteps: testMockSteps,
actor,
logFile: utils.getLogFilePath('cherryPick'),
});

assertions.assertValidateActorJobExecuted(result, actor);
Expand Down Expand Up @@ -109,6 +110,7 @@ describe('test workflow cherryPick', () => {
workflowFile: path.join(repoPath, '.github', 'workflows'),
mockSteps: testMockSteps,
actor,
logFile: utils.getLogFilePath('cherryPick'),
});

assertions.assertValidateActorJobExecuted(result, actor);
Expand Down Expand Up @@ -167,6 +169,7 @@ describe('test workflow cherryPick', () => {
workflowFile: path.join(repoPath, '.github', 'workflows'),
mockSteps: testMockSteps,
actor,
logFile: utils.getLogFilePath('cherryPick'),
});

assertions.assertValidateActorJobExecuted(result, actor);
Expand Down Expand Up @@ -217,6 +220,7 @@ describe('test workflow cherryPick', () => {
workflowFile: path.join(repoPath, '.github', 'workflows'),
mockSteps: testMockSteps,
actor,
logFile: utils.getLogFilePath('cherryPick'),
});

assertions.assertValidateActorJobExecuted(result, actor);
Expand Down Expand Up @@ -270,6 +274,7 @@ describe('test workflow cherryPick', () => {
workflowFile: path.join(repoPath, '.github', 'workflows'),
mockSteps: testMockSteps,
actor,
logFile: utils.getLogFilePath('cherryPick'),
});

assertions.assertValidateActorJobExecuted(result, actor);
Expand Down Expand Up @@ -320,6 +325,7 @@ describe('test workflow cherryPick', () => {
workflowFile: path.join(repoPath, '.github', 'workflows'),
mockSteps: testMockSteps,
actor,
logFile: utils.getLogFilePath('cherryPick'),
});

assertions.assertValidateActorJobExecuted(result, actor);
Expand Down Expand Up @@ -376,6 +382,7 @@ describe('test workflow cherryPick', () => {
workflowFile: path.join(repoPath, '.github', 'workflows'),
mockSteps: testMockSteps,
actor,
logFile: utils.getLogFilePath('cherryPick'),
});

assertions.assertValidateActorJobExecuted(result, actor);
Expand Down Expand Up @@ -426,6 +433,7 @@ describe('test workflow cherryPick', () => {
workflowFile: path.join(repoPath, '.github', 'workflows'),
mockSteps: testMockSteps,
actor,
logFile: utils.getLogFilePath('cherryPick'),
});

assertions.assertValidateActorJobExecuted(result, actor);
Expand Down Expand Up @@ -479,6 +487,7 @@ describe('test workflow cherryPick', () => {
workflowFile: path.join(repoPath, '.github', 'workflows'),
mockSteps: testMockSteps,
actor,
logFile: utils.getLogFilePath('cherryPick'),
});

assertions.assertValidateActorJobExecuted(result, actor);
Expand Down Expand Up @@ -529,6 +538,7 @@ describe('test workflow cherryPick', () => {
workflowFile: path.join(repoPath, '.github', 'workflows'),
mockSteps: testMockSteps,
actor,
logFile: utils.getLogFilePath('cherryPick'),
});

assertions.assertValidateActorJobExecuted(result, actor);
Expand Down Expand Up @@ -589,6 +599,7 @@ describe('test workflow cherryPick', () => {
workflowFile: path.join(repoPath, '.github', 'workflows'),
mockSteps: testMockSteps,
actor,
logFile: utils.getLogFilePath('cherryPick'),
});

assertions.assertValidateActorJobExecuted(result, actor);
Expand Down Expand Up @@ -639,6 +650,7 @@ describe('test workflow cherryPick', () => {
workflowFile: path.join(repoPath, '.github', 'workflows'),
mockSteps: testMockSteps,
actor,
logFile: utils.getLogFilePath('cherryPick'),
});

assertions.assertValidateActorJobExecuted(result, actor);
Expand Down Expand Up @@ -692,6 +704,7 @@ describe('test workflow cherryPick', () => {
workflowFile: path.join(repoPath, '.github', 'workflows'),
mockSteps: testMockSteps,
actor,
logFile: utils.getLogFilePath('cherryPick'),
});

assertions.assertValidateActorJobExecuted(result, actor);
Expand Down Expand Up @@ -742,6 +755,7 @@ describe('test workflow cherryPick', () => {
workflowFile: path.join(repoPath, '.github', 'workflows'),
mockSteps: testMockSteps,
actor,
logFile: utils.getLogFilePath('cherryPick'),
});

assertions.assertValidateActorJobExecuted(result, actor);
Expand Down Expand Up @@ -798,6 +812,7 @@ describe('test workflow cherryPick', () => {
workflowFile: path.join(repoPath, '.github', 'workflows'),
mockSteps: testMockSteps,
actor,
logFile: utils.getLogFilePath('cherryPick'),
});

assertions.assertValidateActorJobExecuted(result, actor);
Expand Down Expand Up @@ -848,6 +863,7 @@ describe('test workflow cherryPick', () => {
workflowFile: path.join(repoPath, '.github', 'workflows'),
mockSteps: testMockSteps,
actor,
logFile: utils.getLogFilePath('cherryPick'),
});

assertions.assertValidateActorJobExecuted(result, actor);
Expand Down Expand Up @@ -901,6 +917,7 @@ describe('test workflow cherryPick', () => {
workflowFile: path.join(repoPath, '.github', 'workflows'),
mockSteps: testMockSteps,
actor,
logFile: utils.getLogFilePath('cherryPick'),
});

assertions.assertValidateActorJobExecuted(result, actor);
Expand Down Expand Up @@ -951,6 +968,7 @@ describe('test workflow cherryPick', () => {
workflowFile: path.join(repoPath, '.github', 'workflows'),
mockSteps: testMockSteps,
actor,
logFile: utils.getLogFilePath('cherryPick'),
});

assertions.assertValidateActorJobExecuted(result, actor);
Expand Down Expand Up @@ -1006,6 +1024,7 @@ describe('test workflow cherryPick', () => {
workflowFile: path.join(repoPath, '.github', 'workflows'),
mockSteps: testMockSteps,
actor: 'Dummy Author',
logFile: utils.getLogFilePath('cherryPick'),
});

assertions.assertValidateActorJobExecuted(result, 'Dummy Author', false);
Expand Down
5 changes: 5 additions & 0 deletions workflow_tests/cla.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ describe('test workflow cla', () => {
workflowFile: path.join(repoPath, '.github', 'workflows'),
mockSteps: testMockSteps,
actor,
logFile: utils.getLogFilePath('cla'),
});

assertions.assertCLAJobExecuted(result, commentBody, `${repoPath}/remote/origin`, true, false);
Expand Down Expand Up @@ -109,6 +110,7 @@ describe('test workflow cla', () => {
workflowFile: path.join(repoPath, '.github', 'workflows'),
mockSteps: testMockSteps,
actor,
logFile: utils.getLogFilePath('cla'),
});

assertions.assertCLAJobExecuted(result, commentBody, `${repoPath}/remote/origin`, true, true);
Expand Down Expand Up @@ -146,6 +148,7 @@ describe('test workflow cla', () => {
workflowFile: path.join(repoPath, '.github', 'workflows'),
mockSteps: testMockSteps,
actor,
logFile: utils.getLogFilePath('cla'),
});

assertions.assertCLAJobExecuted(result, commentBody, `${repoPath}/remote/origin`, true, true);
Expand Down Expand Up @@ -182,6 +185,7 @@ describe('test workflow cla', () => {
workflowFile: path.join(repoPath, '.github', 'workflows'),
mockSteps: testMockSteps,
actor,
logFile: utils.getLogFilePath('cla'),
});

assertions.assertCLAJobExecuted(result, '', `${repoPath}/remote/origin`, true, true);
Expand Down Expand Up @@ -212,6 +216,7 @@ describe('test workflow cla', () => {
workflowFile: path.join(repoPath, '.github', 'workflows'),
mockSteps: testMockSteps,
actor,
logFile: utils.getLogFilePath('cla'),
});

assertions.assertCLAJobExecuted(result, '', `${repoPath}/remote/origin`, false);
Expand Down
5 changes: 5 additions & 0 deletions workflow_tests/createNewVersion.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ describe('test workflow createNewVersion', () => {
workflowFile: path.join(repoPath, '.github', 'workflows'),
mockSteps: testMockSteps,
actor: 'Dummy Author',
logFile: utils.getLogFilePath('createNewVersion'),
});
assertions.assertValidateActorJobExecuted(result);
assertions.assertCreateNewVersionJobExecuted(result);
Expand Down Expand Up @@ -101,6 +102,7 @@ describe('test workflow createNewVersion', () => {
workflowFile: path.join(repoPath, '.github', 'workflows'),
mockSteps: testMockSteps,
actor: 'Dummy Author',
logFile: utils.getLogFilePath('createNewVersion'),
});
assertions.assertValidateActorJobExecuted(result);
assertions.assertCreateNewVersionJobExecuted(result);
Expand Down Expand Up @@ -132,6 +134,7 @@ describe('test workflow createNewVersion', () => {
workflowFile: path.join(repoPath, '.github', 'workflows'),
mockSteps: testMockSteps,
actor: 'Dummy Author',
logFile: utils.getLogFilePath('createNewVersion'),
});
assertions.assertValidateActorJobExecuted(result);
assertions.assertCreateNewVersionJobExecuted(result, 'BUILD', false);
Expand Down Expand Up @@ -172,6 +175,7 @@ describe('test workflow createNewVersion', () => {
workflowFile: path.join(repoPath, '.github', 'workflows'),
mockSteps: testMockSteps,
actor: 'Dummy Author',
logFile: utils.getLogFilePath('createNewVersion'),
});
assertions.assertValidateActorJobExecuted(result);
assertions.assertCreateNewVersionJobExecuted(result, 'BUILD', true, false);
Expand Down Expand Up @@ -201,6 +205,7 @@ describe('test workflow createNewVersion', () => {
workflowFile: path.join(repoPath, '.github', 'workflows'),
mockSteps: testMockSteps,
actor: 'Dummy Author',
logFile: utils.getLogFilePath('createNewVersion'),
});
assertions.assertValidateActorJobExecuted(result);
assertions.assertCreateNewVersionJobExecuted(result, 'MAJOR');
Expand Down
8 changes: 8 additions & 0 deletions workflow_tests/deploy.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ describe('test workflow deploy', () => {
workflowFile: path.join(repoPath, '.github', 'workflows'),
mockSteps: testMockSteps,
actor: 'OSBotify',
logFile: utils.getLogFilePath('deploy'),
});
assertions.assertValidateJobExecuted(result);
assertions.assertDeployStagingJobExecuted(result, false);
Expand Down Expand Up @@ -92,6 +93,7 @@ describe('test workflow deploy', () => {
workflowFile: path.join(repoPath, '.github', 'workflows'),
mockSteps: testMockSteps,
actor: 'OSBotify',
logFile: utils.getLogFilePath('deploy'),
});
assertions.assertValidateJobExecuted(result);
assertions.assertDeployStagingJobExecuted(result);
Expand Down Expand Up @@ -124,6 +126,7 @@ describe('test workflow deploy', () => {
workflowFile: path.join(repoPath, '.github', 'workflows'),
mockSteps: testMockSteps,
actor: 'OSBotify',
logFile: utils.getLogFilePath('deploy'),
});
assertions.assertValidateJobExecuted(result);
assertions.assertDeployStagingJobExecuted(result, false);
Expand Down Expand Up @@ -157,6 +160,7 @@ describe('test workflow deploy', () => {
workflowFile: path.join(repoPath, '.github', 'workflows'),
mockSteps: testMockSteps,
actor: 'Dummy Author',
logFile: utils.getLogFilePath('deploy'),
});
assertions.assertValidateJobExecuted(result);
assertions.assertDeployStagingJobExecuted(result, false);
Expand Down Expand Up @@ -189,6 +193,7 @@ describe('test workflow deploy', () => {
workflowFile: path.join(repoPath, '.github', 'workflows'),
mockSteps: testMockSteps,
actor: 'Dummy Author',
logFile: utils.getLogFilePath('deploy'),
});
assertions.assertValidateJobExecuted(result);
assertions.assertDeployStagingJobExecuted(result, false);
Expand Down Expand Up @@ -221,6 +226,7 @@ describe('test workflow deploy', () => {
workflowFile: path.join(repoPath, '.github', 'workflows'),
mockSteps: testMockSteps,
actor: 'Dummy Author',
logFile: utils.getLogFilePath('deploy'),
});
assertions.assertValidateJobExecuted(result);
assertions.assertDeployStagingJobExecuted(result, false);
Expand Down Expand Up @@ -254,6 +260,7 @@ describe('test workflow deploy', () => {
workflowFile: path.join(repoPath, '.github', 'workflows'),
mockSteps: testMockSteps,
actor: 'Dummy Author',
logFile: utils.getLogFilePath('deploy'),
});
assertions.assertValidateJobExecuted(result, false);
assertions.assertDeployStagingJobExecuted(result, false);
Expand All @@ -275,6 +282,7 @@ describe('test workflow deploy', () => {
workflowFile: path.join(repoPath, '.github', 'workflows'),
mockSteps: testMockSteps,
actor: 'Dummy Author',
logFile: utils.getLogFilePath('deploy'),
});
assertions.assertValidateJobExecuted(result, false);
assertions.assertDeployStagingJobExecuted(result, false);
Expand Down
Loading

0 comments on commit 05c497b

Please sign in to comment.