-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #85 from hpi-swa-teaching/issue/76-smalltalk-ci-logs
Simplify SmalltalkCI Log
- Loading branch information
Showing
6 changed files
with
79 additions
and
1 deletion.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
packages/AutoTDD-GUI.package/ATDDGitHubActionResults.class/class/ansiCodeDictonary.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
constants | ||
ansiCodeDictonary | ||
|
||
^ Dictionary newFrom: { | ||
'[31m' -> (Dictionary newFrom: { 'prefix' -> 'FAIL'. 'color' -> (ATDDTestingEntity colorDictionary at: #error) }). | ||
'[32m' -> (Dictionary newFrom: { 'prefix' -> 'PASS'. 'color' -> (ATDDTestingEntity colorDictionary at: #successful) }) | ||
} |
4 changes: 4 additions & 0 deletions
4
packages/AutoTDD-GUI.package/ATDDGitHubActionResults.class/instance/isSmalltalkCILog..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
updating | ||
isSmalltalkCILog: aString | ||
|
||
^ aString includesSubstring: 'Run hpi-swa/setup-smalltalkCI' |
29 changes: 29 additions & 0 deletions
29
packages/AutoTDD-GUI.package/ATDDGitHubActionResults.class/instance/parseAnsiCodeOf..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
updating | ||
parseAnsiCodeOf: aString | ||
|
||
| parsedLine prefixColorDictonary match | | ||
|
||
"Set default values" | ||
parsedLine := aString. | ||
match := (parsedLine allRegexMatches: '#\w* \(\d*ms\)') at: 1 ifAbsent: [ nil ]. | ||
|
||
self class ansiCodeDictonary keysAndValuesDo: [ :aKey :aDictionary | | ||
match ifNotNil: [ | ||
(parsedLine includesSubstring: aKey) ifTrue: [ prefixColorDictonary := aDictionary ] | ||
] | ||
]. | ||
|
||
"Remove all Ansi Codes" | ||
parsedLine := parsedLine copyWithRegex: '\[\d+m' matchesReplacedWith: ''. | ||
parsedLine := match ifNil: [ parsedLine ]. | ||
|
||
prefixColorDictonary ifNotNil: [ | ||
parsedLine := | ||
' [' asText, | ||
((prefixColorDictonary at: 'prefix') asText addAttribute: (TextColor color: (prefixColorDictonary at: 'color'))), | ||
'] ' asText, | ||
parsedLine asText | ||
] | ||
ifNil: [ parsedLine := parsedLine asText ]. | ||
|
||
^ parsedLine |
31 changes: 31 additions & 0 deletions
31
packages/AutoTDD-GUI.package/ATDDGitHubActionResults.class/instance/parseSmalltalkCILog..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
updating | ||
parseSmalltalkCILog: aString | ||
|
||
| log shouldIncludeLine parsedLine | | ||
|
||
log := Text new. | ||
shouldIncludeLine := false. | ||
parsedLine := ''. | ||
|
||
aString linesDo: [ :line | | ||
"start of logging" | ||
(line includesSubstring: 'Running suite "Squeak') | ||
ifTrue: [ shouldIncludeLine := true ]. | ||
|
||
"Remove timestamp" | ||
(line isEmpty) | ||
ifTrue: [ parsedLine := line ] | ||
ifFalse: [ parsedLine := line allButFirst: 28 ]. | ||
|
||
"Parse Ansi Codes + Add new line (CR)" | ||
parsedLine := self parseAnsiCodeOf: parsedLine. | ||
parsedLine := parsedLine, Character cr asText. | ||
|
||
(shouldIncludeLine) ifTrue: [log append: parsedLine]. | ||
|
||
"end of logging" | ||
(line matchesRegex: '.*Executed \d* Tests with \d* Failures and \d* Errors.*') | ||
ifTrue: [shouldIncludeLine := false]. | ||
]. | ||
|
||
^ log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters