mirror of
https://github.com/ddworken/hishtory.git
synced 2025-01-07 14:48:59 +01:00
Update golden checker to read all the golden artifacts
This commit is contained in:
parent
168d738b2d
commit
f4694bdd28
4
.github/workflows/go-test.yml
vendored
4
.github/workflows/go-test.yml
vendored
@ -98,7 +98,7 @@ jobs:
|
||||
uses: actions/upload-artifact@v4
|
||||
if: success() || failure()
|
||||
with:
|
||||
name: goldens-used-${{ matrix.os }}-${{ matrix.tests }}.txt
|
||||
name: goldens-used-${{ matrix.os }}-${{ matrix.tests }}
|
||||
path: /tmp/goldens-used.txt
|
||||
|
||||
# - name: Setup tmate session
|
||||
@ -117,8 +117,6 @@ jobs:
|
||||
go-version: 1.21
|
||||
- name: Download artifact
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: goldens-used-ubuntu-TUI.txt
|
||||
- name: Check all goldens were used
|
||||
run: |
|
||||
ls .
|
||||
|
@ -43,17 +43,24 @@ func checkGoldensUsed() {
|
||||
}
|
||||
// Read the goldens that were used
|
||||
usedGoldens := make([]string, 0)
|
||||
usedGoldensFile, err := os.Open("/tmp/goldens-used.txt")
|
||||
if err != nil {
|
||||
log.Fatalf("failed to open /tmp/goldens-used.txt: %v", err)
|
||||
filenames := []string{
|
||||
"goldens-used-macos-14-BASIC/goldens-used.txt", "goldens-used-macos-14-TUI/goldens-used.txt",
|
||||
"goldens-used-macos-latest-BASIC/goldens-used.txt", "goldens-used-macos-latest-TUI/goldens-used.txt",
|
||||
"goldens-used-ubuntu-latest-BASIC/goldens-used.txt", "goldens-used-ubuntu-latest-TUI/goldens-used.txt",
|
||||
}
|
||||
defer usedGoldensFile.Close()
|
||||
scanner := bufio.NewScanner(usedGoldensFile)
|
||||
for scanner.Scan() {
|
||||
usedGoldens = append(usedGoldens, strings.TrimSpace(scanner.Text()))
|
||||
}
|
||||
if err := scanner.Err(); err != nil {
|
||||
log.Fatalf("failed to read lines from /tmp/goldens-used.txt: %v", err)
|
||||
for _, filename := range filenames {
|
||||
usedGoldensFile, err := os.Open(filename)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to open /tmp/goldens-used.txt: %v", err)
|
||||
}
|
||||
defer usedGoldensFile.Close()
|
||||
scanner := bufio.NewScanner(usedGoldensFile)
|
||||
for scanner.Scan() {
|
||||
usedGoldens = append(usedGoldens, strings.TrimSpace(scanner.Text()))
|
||||
}
|
||||
if err := scanner.Err(); err != nil {
|
||||
log.Fatalf("failed to read lines from /tmp/goldens-used.txt: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// List all the goldens that exist
|
||||
@ -72,11 +79,6 @@ func checkGoldensUsed() {
|
||||
// It is allowlisted to not be used
|
||||
continue
|
||||
}
|
||||
if (runtime.GOOS == "darwin" && strings.Contains(goldenName, "-linux")) ||
|
||||
(runtime.GOOS == "linux" && strings.Contains(goldenName, "-darwin")) {
|
||||
// It is for another OS
|
||||
continue
|
||||
}
|
||||
unusedGoldenErr = fmt.Errorf("golden file %v was never used", goldenName)
|
||||
fmt.Println(unusedGoldenErr)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user