-
Notifications
You must be signed in to change notification settings - Fork 245
chores: Append Integration Test Results In Allure Reports #1887
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
WalkthroughAdds a Git ignore rule for Allure integration test results and a GitHub Actions job to run Go tests on main, convert test_results.json to Allure JSON, fetch Allure history, generate an Allure report, and upload it as an artifact. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Dev as Developer
participant GH as GitHub Actions
participant Job as generate-go-test-report
participant Go as Go Test Runner
participant GL as golurectl
participant Allure as Allure Server/CLI
participant Art as Artifact Store
Dev->>GH: Push to main
GH->>Job: Trigger workflow
rect rgba(220,235,255,0.6)
Job->>Go: Run `go test` (produce test_results.json)
note right of Go: Run Tests step (TODO placeholder)
Job->>GL: Convert test_results.json -> Allure JSON
Job->>Allure: Fetch history & generate report
Allure-->>Job: Report files
Job->>Art: Upload Allure report artifact
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (4)
packages/go/slicesext/slicesext_test.go (4)
35-35
: Fix typo in suite name.Change “Intergration” → “Integration”.
- r := runner.NewRunner(t, "BHCE: Intergration Tests") + r := runner.NewRunner(t, "BHCE: Integration Tests")If the goal is to get results into Allure in CI, ensure
ALLURE_OUTPUT_FOLDER
/ALLURE_OUTPUT_PATH
are set so results are written where your pipeline expects them. (github.com)
37-43
: Don’t pass a third arg to NewTest; tag inside the test with t.Tags().Project docs show
NewTest(name, func(t provider.T))
(no extra args); uset.Tags(...)
to add labels. (github.com)- r.NewTest("Test IsOdd function", func(t provider.T) { + r.NewTest("Test IsOdd function", func(t provider.T) { t.Title("Test isOdd function") t.Description("check odd nums") t.Severity(allure.CRITICAL) + t.Tags("isOdd") t.Require().Equal([]int{1, 3}, slicesext.Filter([]int{1, 2, 3, 4}, isOdd)) - }, "Tag @ Test Level: isOdd") + })
44-50
: Same here: move the tag into the body with t.Tags().- r.NewTest("Test isLong function", func(t provider.T) { + r.NewTest("Test isLong function", func(t provider.T) { t.Title("Test isLong function") t.Description("check for long chars") t.Severity(allure.CRITICAL) + t.Tags("isLong") t.Require().Equal([]string{"bbbbbb", "cccccccc"}, slicesext.Filter([]string{"aaaa", "bbbbbb", "cccccccc", "dd"}, isLong)) - }, "Tag @ Test Level: isLong") + })
51-51
: Optionally capture SuiteResult for future integrations.
r.RunTests()
returns aSuiteResult
; capturing it can help if you later need to aggregate/append metadata. (github.com)- r.RunTests() + _ = r.RunTests()
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
go.sum
is excluded by!**/*.sum
📒 Files selected for processing (2)
go.mod
(3 hunks)packages/go/slicesext/slicesext_test.go
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
- GitHub Check: Build BloodHound Container Image / Build and Package Container
- GitHub Check: build-ui
- GitHub Check: run-tests
- GitHub Check: run-tests
- GitHub Check: run-analysis
🔇 Additional comments (2)
go.mod (1)
142-142
: LGTM on indirect json dep.
github.com/goccy/go-json
is commonly pulled in transitively by Allure; safe to keep as indirect.packages/go/slicesext/slicesext_test.go (1)
27-29
: Imports for Allure runner/provider look correct.No issues with the added imports.
go.mod
Outdated
github.com/jedib0t/go-pretty/v6 v6.6.7 | ||
github.com/lib/pq v1.10.9 | ||
github.com/neo4j/neo4j-go-driver/v5 v5.28.1 | ||
github.com/ozontech/allure-go/pkg/framework v0.7.4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Align allure-go module versions; verify v0.7.4 exists.
The direct framework v0.7.4
and indirect allure v0.6.14
look mismatched. The upstream repo’s latest tagged release appears to be in the v0.6.x series; please confirm pkg/framework v0.7.4
is a valid tag and ensure compatible versions across submodules, otherwise go mod download
/tidy
may fail. (github.com)
You can also double‑check locally:
Also applies to: 214-214
🏁 Script executed:
#!/bin/bash
# Verify resolved versions and consistency
go mod graph | rg 'ozontech/allure-go'
go list -m -versions github.com/ozontech/allure-go/pkg/framework
go list -m -versions github.com/ozontech/allure-go/pkg/allure
Length of output: 1861
🌐 Web query:
Is github.com/ozontech/allure-go/pkg/[email protected] a published tag? What is the latest release of ozontech/allure-go?
💡 Result:
No — there is no published tag pkg/[email protected] for ozontech/allure-go. The repository's tags show the latest tag is v0.6.34 (pkg/framework/v0.6.34) dated May 20, 2025. [1][2]
Sources:
- Repository tags (shows v0.6.34, pkg/framework tags). [1]
- Releases page (latest release listed v0.6.32). [2]
Align allure-go versions — github.com/ozontech/allure-go/pkg/[email protected] is not a published tag.
go mod graph shows pkg/[email protected] in the dependency graph but the upstream repo has no pkg/framework v0.7.4 tag (latest pkg/framework tag v0.6.34). Pin the requirement to a published v0.6.x tag or add an explicit replace to the commit/fork that provides v0.7.4, then run go mod tidy. Location: go.mod (lines 42, 214).
🤖 Prompt for AI Agents
In go.mod around lines 42 and 214, the module requirement
github.com/ozontech/allure-go/pkg/framework v0.7.4 is not a published tag
upstream; replace it with a valid published v0.6.x tag (e.g., v0.6.34) or add an
explicit replace directive pointing to the exact commit or fork that provides
v0.7.4, then run "go mod tidy" (and commit the updated go.mod and go.sum) to
reconcile the dependency graph.
- Create a hook to support multiple assertions within single test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
🧹 Nitpick comments (4)
.gitignore (1)
463-464
: Make Allure ignores recursive; consider ignoring generated reports too.Use a recursive pattern so nested attachments are ignored, and optionally ignore
allure-report/
artifacts.-**/allure-results/* +**/allure-results/** +# (optional) ignore generated HTML reports as well +**/allure-report/**packages/go/allure.go/suite_manager.go (1)
1-1
: Add license header and doc comments for exported symbols.Keep headers consistent with the repo and add brief docs for
SuiteManager
to satisfy linters.+// Copyright 2025 Specter Ops, Inc. +// SPDX-License-Identifier: Apache-2.0 + package alluregotype SuiteManager struct { suite.Suite } + +// SuiteManager provides common Allure suite hooks shared by test suites.packages/go/slicesext/slicesext_test.go (2)
66-81
: Fix “not mutated” assertion; current check is ineffective.
NotSame(&in, &out)
always passes (different slice variables). Assert the input remains unchanged (and optionally that backing arrays differ).var ( in = []string{"a", "a", "b", "b"} out = slicesext.Unique(in) ) - t.Require().Equal([]string{"a", "b"}, out) - t.Require().NotSame(&in, &out) // ensure we didn't mutate the original slice + orig := slices.Clone(in) + t.Require().Equal([]string{"a", "b"}, out) + t.Require().Equal(orig, in) // ensure original slice contents unchanged t.Require().Equal([]string{"a", "b"}, slicesext.Unique([]string{"a", "b", "b", "a"})) t.Require().Equal([]string{"a"}, slicesext.Unique([]string{"a"})) t.Require().Equal([]int{1, 2, 3}, slicesext.Unique([]int{1, 1, 2, 2, 3})) - s.AfterAll(t) + // no manual hook invocationOptional: also assert different backing arrays using
unsafe.SliceData
if desired.
83-85
: Parallel suite runner: verify Allure writer is concurrency-safe.Running the suite in parallel is great for speed but can interleave writes to
allure-results
. Confirm the framework merges results safely or set distinctALLURE_RESULTS_DIR
per package in CI.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
.gitignore
(1 hunks)packages/go/allure.go/suite_manager.go
(1 hunks)packages/go/slicesext/slicesext_test.go
(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
packages/go/slicesext/slicesext_test.go (2)
packages/go/allure.go/suite_manager.go (1)
SuiteManager
(9-11)packages/go/slicesext/slicesext.go (1)
FlatMap
(79-85)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
- GitHub Check: Build BloodHound Container Image / Build and Package Container
- GitHub Check: run-tests
- GitHub Check: run-tests
- GitHub Check: run-analysis
- GitHub Check: build-ui
🔇 Additional comments (1)
packages/go/slicesext/slicesext_test.go (1)
27-29
: Allure imports look good.Alias and package path are consistent; no issues.
func (s *SuiteManager) AfterAll(t provider.T) { | ||
// Add support for multiple assertions within a single test | ||
if t.Failed() { | ||
t.Fail() | ||
} | ||
} No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Misuse of suite hook: this is an AfterEach concern, not AfterAll.
AfterAll
is meant to run once per suite; tests currently call it per test. Rename to AfterEach
and let the framework invoke it automatically (then remove manual calls in tests).
-func (s *SuiteManager) AfterAll(t provider.T) {
- // Add support for multiple assertions within a single test
- if t.Failed() {
- t.Fail()
- }
-}
+// AfterEach propagates soft-assert failures at the end of each test case.
+func (s *SuiteManager) AfterEach(t provider.T) {
+ if t.Failed() {
+ t.Fail()
+ }
+}
Please confirm suite.Suite
supports AfterEach(provider.T)
in the version pinned in go.mod.
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "PWD: $(pwd)"
echo "---- target file ----"
if [ -f packages/go/allure.go/suite_manager.go ]; then
sed -n '1,200p' packages/go/allure.go/suite_manager.go
else
echo "packages/go/allure.go/suite_manager.go not found"
fi
echo
echo "---- provider.T occurrences ----"
rg -n --hidden --no-ignore -S "provider\.T" || true
echo
echo "---- AfterEach / AfterAll occurrences ----"
rg -n --hidden --no-ignore -S "AfterEach|AfterAll" || true
echo
echo "---- find go.mod files (up to depth 5) ----"
find . -maxdepth 5 -name go.mod -print -exec sed -n '1,200p' {} \; || true
echo
echo "---- search for suite.Suite or testify suite import ----"
rg -n --hidden --no-ignore -S "suite\.Suite|github.com/stretchr/testify/suite" || true
echo
echo "---- search for provider package/type definitions ----"
rg -n --hidden --no-ignore -S "package\s+provider\b|type\s+T\b" || true
echo
echo "---- search for SuiteManager type ----"
rg -n --hidden --no-ignore -S "type\s+SuiteManager\b" -C3 || true
Length of output: 12427
Rename AfterAll → AfterEach and remove manual invocations
AfterAll is a suite-level hook but is being invoked per-test in your tests; rename the method to AfterEach and delete the manual s.AfterAll(t) calls so the framework runs it automatically.
- Change file: packages/go/allure.go/suite_manager.go — rename method.
- Update tests: remove s.AfterAll(t) calls in packages/go/slicesext/slicesext_test.go (calls at ~lines 44, 54, 63, 80).
-func (s *SuiteManager) AfterAll(t provider.T) {
- // Add support for multiple assertions within a single test
- if t.Failed() {
- t.Fail()
- }
-}
+// AfterEach propagates soft-assert failures at the end of each test case.
+func (s *SuiteManager) AfterEach(t provider.T) {
+ if t.Failed() {
+ t.Fail()
+ }
+}
Confirmed: the framework exposes AfterEach(provider.T) (see docs/examples). (github.com)
🤖 Prompt for AI Agents
packages/go/allure.go/suite_manager.go lines 13-18: rename the suite hook method
from AfterAll to AfterEach and change its signature to AfterEach(t provider.T)
so the test framework will run it per-test automatically; then update tests in
packages/go/slicesext/slicesext_test.go by removing the manual s.AfterAll(t)
invocations around lines ~44, ~54, ~63, and ~80 (no replacement calls needed
since the framework will invoke AfterEach), and run tests to ensure the renamed
method compiles with the existing provider.T type.
- Remove allure-go 3rd party pkg
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 7
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
.github/workflows/run-go-unit-tests.yml (1)
66-74
: Fix Allure paths mismatch and restrict publishing on PRs.
- You generate results into ./allure-results but configure the action to read houndstrike/allure-results. Align paths.
- Publishing to gh-pages on pull_request (especially from forks) usually fails due to token permissions. Gate publishing to push events (or main branch).
Apply this diff:
- - name: Build test report - uses: simple-elf/[email protected] - if: always() - with: - gh_pages: gh-pages - allure_history: houndstrike/allure-history - allure_results: houndstrike/allure-results - allure_report: houndstrike/allure-report + - name: Build test report + uses: simple-elf/[email protected] + if: github.event_name == 'push' + with: + gh_pages: gh-pages + allure_history: allure-history + allure_results: allure-results + allure_report: allure-reportOptionally set explicit token permissions at job or workflow level:
permissions: contents: write
🧹 Nitpick comments (6)
packages/go/stbernard/command/alluregen/internal/utils.go (1)
5-10
: Fix param typo and simplify SHA-256 hashing.Minor cleanup; Reset is redundant, and Sum256 is simpler.
Apply this diff:
-func hashString(testtCaseName string) []byte { - hash := sha256.New() - hash.Reset() - hash.Write([]byte(testtCaseName)) - return hash.Sum(nil) +func hashString(testCaseName string) []byte { + sum := sha256.Sum256([]byte(testCaseName)) + return sum[:] }packages/go/stbernard/command/alluregen/alluregen.go (3)
9-11
: Use a distinct import alias to avoid confusion with the current package name.Clearer to avoid same-name alias as the enclosing package.
Apply this diff:
- alluregen "github.com/specterops/bloodhound/packages/go/stbernard/command/alluregen/internal" + internalcmd "github.com/specterops/bloodhound/packages/go/stbernard/command/alluregen/internal"
22-27
: Fix copy/paste comment.Apply this diff:
-// Create a new instance of license command within the current environment +// Create a new instance of the alluregen command within the current environment
55-60
: Update call site to match the new alias.Apply this diff:
-func (c *command) Run() error { - if err := alluregen.Run(); err != nil { +func (c *command) Run() error { + if err := internalcmd.Run(); err != nil { return fmt.Errorf("Running alluregen cmd: %w", err) } return nil }packages/go/stbernard/command/alluregen/internal/types.go (1)
56-75
: Derive stable IDs and prefer uuid.NewString().Small cleanup; no behavior change.
Apply this diff:
// Create a hash from test case fullname to generate a stateful reporting calTestCaseHash := hashString(e.Test) testCaseUUID := fmt.Sprintf("%x", calTestCaseHash) calHashHistory := hashString(testCaseUUID) historyID := fmt.Sprintf("%x", calHashHistory) ts.FullName = e.Test ts.Name = e.Test - ts.UUID = uuid.New().String() + ts.UUID = uuid.NewString() ts.TestCaseId = testCaseUUID ts.HistoryId = historyID.github/workflows/run-go-unit-tests.yml (1)
50-57
: Pin golurectl to a fixed version and remove UUOC- - name: Install AllureCtl - run: | - go install github.com/robotomize/go-allure/cmd/golurectl@latest + - name: Install AllureCtl + run: | + go install github.com/robotomize/go-allure/cmd/[email protected] # pin to a specific release - - name: Building Allure JSON - run: | - cat test_results.json | golurectl -l -e --allure-suite "Go Test" --allure-tags "Unit" -o ./allure-results + - name: Building Allure JSON + run: | + golurectl -l -e --allure-suite "Go Test" --allure-tags "Unit" -o ./allure-results < test_results.json
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
.github/workflows/run-go-unit-tests.yml
(1 hunks)packages/go/stbernard/command/alluregen/alluregen.go
(1 hunks)packages/go/stbernard/command/alluregen/internal/cmd.go
(1 hunks)packages/go/stbernard/command/alluregen/internal/parser.go
(1 hunks)packages/go/stbernard/command/alluregen/internal/types.go
(1 hunks)packages/go/stbernard/command/alluregen/internal/utils.go
(1 hunks)packages/go/stbernard/command/command.go
(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (4)
packages/go/stbernard/command/alluregen/internal/parser.go (1)
packages/go/stbernard/command/alluregen/internal/types.go (1)
Event
(13-21)
packages/go/stbernard/command/command.go (1)
packages/go/stbernard/command/alluregen/alluregen.go (1)
Create
(23-27)
packages/go/stbernard/command/alluregen/internal/cmd.go (1)
packages/go/stbernard/command/alluregen/internal/types.go (3)
TestResults
(52-54)TestCase
(33-45)Package
(47-50)
packages/go/stbernard/command/alluregen/alluregen.go (1)
packages/go/stbernard/command/alluregen/internal/cmd.go (1)
Run
(3-31)
🪛 actionlint (1.7.7)
.github/workflows/run-go-unit-tests.yml
59-59: the runner of "actions/checkout@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
- GitHub Check: Build BloodHound Container Image / Build and Package Container
- GitHub Check: build-ui
- GitHub Check: run-tests
- GitHub Check: run-tests
- GitHub Check: run-analysis
🔇 Additional comments (1)
packages/go/stbernard/command/command.go (1)
27-29
: Allure command correctly wired into CLI.Import and registration look good.
Also applies to: 103-104
cat test_results.json | golurectl -l -e --allure-suite "Go Test" --allure-tags "Unit" -o ./allure-results | ||
- name: Get Allure history | ||
uses: actions/checkout@v2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bump actions/checkout to v4 (v2 is too old).
actionlint flags this and it will fail on modern runners.
Apply this diff:
- - name: Get Allure history
- uses: actions/checkout@v2
+ - name: Get Allure history
+ uses: actions/checkout@v4
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
uses: actions/checkout@v2 | |
- name: Get Allure history | |
uses: actions/checkout@v4 |
🧰 Tools
🪛 actionlint (1.7.7)
59-59: the runner of "actions/checkout@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
🤖 Prompt for AI Agents
.github/workflows/run-go-unit-tests.yml around line 59: the workflow uses an
outdated actions/checkout@v2 which actionlint flags and may fail on modern
runners; update the step to use actions/checkout@v4 by replacing the version
reference, ensure any inputs used are compatible with v4 (e.g., fetch-depth or
persist-credentials), and run workflow linting to confirm no other
incompatibilities.
package alluregen | ||
|
||
func Run() error { | ||
|
||
events, err := parseEvents("/Users/ykaiboussi/Documents/shared/bloodhound-enterprise/bhce/go_bhce_passed_sliceexttests.out") | ||
if err != nil { | ||
return err | ||
} | ||
|
||
// capture all Go packages and related test cases | ||
results := new(TestResults) | ||
|
||
eventOutput := parseEventsOuput(events) | ||
|
||
for _, event := range events { | ||
// instantiate new estCase and Package | ||
tstCase := new(TestCase) | ||
pkg := new(Package) | ||
|
||
// Create each test cases and append the results to TestResult struct | ||
if event.Test != "" && event.Action == "pass" || event.Action == "fail" { | ||
tstCase.create(event, eventOutput) | ||
pk := pkg.addTestCase(*tstCase) | ||
results.Pkgs = append(results.Pkgs, *pk) | ||
} | ||
} | ||
|
||
// Create JSON files at test case level | ||
results.generateTests("ALLURE_OUTPUT_PATH") | ||
return nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
Remove hardcoded local path; fix event filter precedence; propagate errors.
- Absolute path makes the command unusable elsewhere. Read input path from env (or flags) and fail fast if missing.
- Ensure event.Test is non-empty for both pass and fail cases.
- Align function name parseEventsOutput.
- Bubble up errors from generation.
Apply this diff:
package alluregen
-func Run() error {
+import (
+ "fmt"
+ "os"
+)
+
+func Run() error {
- events, err := parseEvents("/Users/ykaiboussi/Documents/shared/bloodhound-enterprise/bhce/go_bhce_passed_sliceexttests.out")
+ inPath := os.Getenv("ALLURE_INPUT_PATH")
+ if inPath == "" {
+ return fmt.Errorf("ALLURE_INPUT_PATH env var is required (path to go test -json output)")
+ }
+
+ events, err := parseEvents(inPath)
if err != nil {
return err
}
// capture all Go packages and related test cases
results := new(TestResults)
- eventOutput := parseEventsOuput(events)
+ eventOutput := parseEventsOutput(events)
for _, event := range events {
// instantiate new estCase and Package
tstCase := new(TestCase)
pkg := new(Package)
// Create each test cases and append the results to TestResult struct
- if event.Test != "" && event.Action == "pass" || event.Action == "fail" {
+ if event.Test != "" && (event.Action == "pass" || event.Action == "fail") {
tstCase.create(event, eventOutput)
- pk := pkg.addTestCase(*tstCase)
+ pk := pkg.addTestCase(event.Package, *tstCase)
results.Pkgs = append(results.Pkgs, *pk)
}
}
// Create JSON files at test case level
- results.generateTests("ALLURE_OUTPUT_PATH")
- return nil
+ if err := results.generateTests("ALLURE_OUTPUT_PATH"); err != nil {
+ return err
+ }
+ return nil
}
🏁 Script executed:
#!/bin/bash
# Verify no remaining references to the old name "parseEventsOuput"
rg -nP '\bparseEventsOuput\b' packages/go/stbernard/command/alluregen
Length of output: 333
🏁 Script executed:
#!/bin/bash
# Inspect addTestCase signature
rg -n 'addTestCase' packages/go/stbernard/command/alluregen/internal/types.go
# Inspect generateTests signature
rg -nP 'func\s+generateTests' packages/go/stbernard/command/alluregen/internal/types.go
Length of output: 59
🏁 Script executed:
#!/bin/bash
# Inspect parseEventsOuput definition
rg -nC1 'func parseEventsOuput' packages/go/stbernard/command/alluregen/internal/types.go
# Inspect generateTests signature
rg -nC1 'func .*generateTests' packages/go/stbernard/command/alluregen/internal/types.go
Length of output: 264
Fix naming, method signature, and error propagation
- Rename
parseEventsOuput
toparseEventsOutput
(and update its comment) inpackages/go/stbernard/command/alluregen/internal/types.go
, and update all calls. - Revert the call in
cmd.go
topkg.addTestCase(*tstCase)
(the current signature isfunc (pkg *Package) addTestCase(ts TestCase) *Package
), or updateaddTestCase
to accept a package name if intended. - Change
generateTests(envVariable string)
ininternal/types.go
to returnerror
, and handle its error inRun
. - Read the input path from
ALLURE_INPUT_PATH
(fail fast if unset) instead of a hardcoded value.
file, err := os.OpenFile(fileName, os.O_RDWR, 0) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
fileReader := bufio.NewReader(file) | ||
fileScanner := bufio.NewScanner(fileReader) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Open file read-only, close it, and increase Scanner buffer.
- Use os.Open for read-only.
- Close the file.
- Scanner default token limit (64K) can truncate large JSON lines; increase it.
Apply this diff:
-func parseEvents(fileName string) ([]Event, error) {
- file, err := os.OpenFile(fileName, os.O_RDWR, 0)
+func parseEvents(fileName string) ([]Event, error) {
+ file, err := os.Open(fileName)
if err != nil {
return nil, err
}
- fileReader := bufio.NewReader(file)
- fileScanner := bufio.NewScanner(fileReader)
+ defer file.Close()
+
+ fileScanner := bufio.NewScanner(file)
+ // allow up to 1MB per line to accommodate verbose outputs
+ fileScanner.Buffer(make([]byte, 0, 64*1024), 1024*1024)
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
file, err := os.OpenFile(fileName, os.O_RDWR, 0) | |
if err != nil { | |
return nil, err | |
} | |
fileReader := bufio.NewReader(file) | |
fileScanner := bufio.NewScanner(fileReader) | |
func parseEvents(fileName string) ([]Event, error) { | |
file, err := os.Open(fileName) | |
if err != nil { | |
return nil, err | |
} | |
defer file.Close() | |
fileScanner := bufio.NewScanner(file) | |
// allow up to 1MB per line to accommodate verbose outputs | |
fileScanner.Buffer(make([]byte, 0, 64*1024), 1024*1024) | |
// ...rest of parsing logic... | |
} |
🤖 Prompt for AI Agents
In packages/go/stbernard/command/alluregen/internal/parser.go around lines 11 to
18, the file is opened with os.OpenFile in read-write mode, is never closed, and
the bufio.Scanner uses the default 64KB token limit which can truncate large
JSON lines; change os.OpenFile to os.Open(fileName) to open read-only,
immediately defer file.Close() after a successful open, and increase the scanner
buffer by calling fileScanner.Buffer with a larger initial buffer and max token
size (e.g., several megabytes such as 10MB) so large lines aren't truncated.
for fileScanner.Scan() { | ||
if err := json.Unmarshal([]byte(fileScanner.Text()), &e); err != nil { | ||
return nil, err | ||
} | ||
events = append(events, e) | ||
} | ||
|
||
return events, nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Handle scanner errors after the loop.
Return scanner.Err() to surface truncated line or IO errors.
Apply this diff:
for fileScanner.Scan() {
if err := json.Unmarshal([]byte(fileScanner.Text()), &e); err != nil {
return nil, err
}
events = append(events, e)
}
- return events, nil
+ if err := fileScanner.Err(); err != nil {
+ return nil, err
+ }
+ return events, nil
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
for fileScanner.Scan() { | |
if err := json.Unmarshal([]byte(fileScanner.Text()), &e); err != nil { | |
return nil, err | |
} | |
events = append(events, e) | |
} | |
return events, nil | |
} | |
for fileScanner.Scan() { | |
if err := json.Unmarshal([]byte(fileScanner.Text()), &e); err != nil { | |
return nil, err | |
} | |
events = append(events, e) | |
} | |
if err := fileScanner.Err(); err != nil { | |
return nil, err | |
} | |
return events, nil | |
} |
🤖 Prompt for AI Agents
In packages/go/stbernard/command/alluregen/internal/parser.go around lines 21 to
29, the code reads lines with fileScanner.Scan() and unmarshals JSON into events
but does not check for scanner errors after the loop; add a check after the loop
to call fileScanner.Err() and return that error (or wrap/propagate it) if
non-nil so truncated lines or I/O errors are surfaced; keep the existing return
of events when scanner.Err() is nil.
// parseEventsOuput retruns an output per test case | ||
func parseEventsOuput(events []Event) map[string][]string { | ||
outputs := map[string][]string{} | ||
for _, e := range events { | ||
switch e.Action { | ||
case "output": | ||
if !strings.Contains(e.Output, "WARN") && !strings.Contains(e.Output, "ok") && !strings.Contains(e.Output, "?") { | ||
outputs[e.Test] = append(outputs[e.Test], strings.TrimSpace(e.Output)) | ||
} | ||
} | ||
} | ||
|
||
return outputs | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Fix function name typo and comment; keep only relevant outputs.
Correct spelling and export a consistent API used by cmd.go.
Apply this diff:
-// parseEventsOuput retruns an output per test case
-func parseEventsOuput(events []Event) map[string][]string {
+// parseEventsOutput returns output lines per test case
+func parseEventsOutput(events []Event) map[string][]string {
outputs := map[string][]string{}
for _, e := range events {
switch e.Action {
case "output":
if !strings.Contains(e.Output, "WARN") && !strings.Contains(e.Output, "ok") && !strings.Contains(e.Output, "?") {
outputs[e.Test] = append(outputs[e.Test], strings.TrimSpace(e.Output))
}
}
}
return outputs
}
func (pkg *Package) addTestCase(ts TestCase) *Package { | ||
pkg.Name = ts.Name | ||
pkg.Tests = append(pkg.Tests, ts) | ||
return pkg | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the package name, not the test name, and accept it as a parameter.
Current code sets package name to the test name, which is incorrect.
Apply this diff:
-func (pkg *Package) addTestCase(ts TestCase) *Package {
- pkg.Name = ts.Name
+func (pkg *Package) addTestCase(pkgName string, ts TestCase) *Package {
+ pkg.Name = pkgName
pkg.Tests = append(pkg.Tests, ts)
return pkg
}
Note: Update call sites (see internal/cmd.go patch).
🤖 Prompt for AI Agents
In packages/go/stbernard/command/alluregen/internal/types.go around lines 113 to
117, change the addTestCase method to accept the package name as a parameter and
set pkg.Name to that package name (not to ts.Name); update the signature to
something like addTestCase(pkgName string, ts TestCase) *Package, assign
pkg.Name = pkgName, append the test case as before, and return pkg; also update
all call sites (e.g., in internal/cmd.go) to pass the correct package name when
calling addTestCase.
func (r *TestResults) generateTests(envVariable string) { | ||
allurePath := os.Getenv(envVariable) | ||
for _, pkg := range r.Pkgs { | ||
for _, tstCase := range pkg.Tests { | ||
name := fmt.Sprintf(allurePath+"/allure-results/%v-result.json", tstCase.HistoryId) | ||
f, err := os.Create(name) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
|
||
defer f.Close() | ||
|
||
data, err := json.MarshalIndent(tstCase, "", "\t") | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
|
||
f.Write(data) | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
Return errors, ensure directory exists, and avoid defers in loop.
- Don’t log.Fatal in libraries; return errors.
- Create allure-results directory if missing.
- Handle write errors; close files explicitly per iteration.
Apply this diff:
-func (r *TestResults) generateTests(envVariable string) {
- allurePath := os.Getenv(envVariable)
- for _, pkg := range r.Pkgs {
- for _, tstCase := range pkg.Tests {
- name := fmt.Sprintf(allurePath+"/allure-results/%v-result.json", tstCase.HistoryId)
- f, err := os.Create(name)
- if err != nil {
- log.Fatal(err)
- }
-
- defer f.Close()
-
- data, err := json.MarshalIndent(tstCase, "", "\t")
- if err != nil {
- log.Fatal(err)
- }
-
- f.Write(data)
- }
- }
-}
+func (r *TestResults) generateTests(envVariable string) error {
+ allurePath := os.Getenv(envVariable)
+ if allurePath == "" {
+ return fmt.Errorf("%s env var is required (destination base path)", envVariable)
+ }
+ root := fmt.Sprintf("%s/allure-results", strings.TrimRight(allurePath, "/"))
+ if err := os.MkdirAll(root, 0o755); err != nil {
+ return err
+ }
+ for _, pkg := range r.Pkgs {
+ for _, tstCase := range pkg.Tests {
+ name := fmt.Sprintf("%s/%s-result.json", root, tstCase.HistoryId)
+ f, err := os.Create(name)
+ if err != nil {
+ return err
+ }
+ data, err := json.MarshalIndent(tstCase, "", "\t")
+ if err != nil {
+ _ = f.Close()
+ return err
+ }
+ if _, err := f.Write(data); err != nil {
+ _ = f.Close()
+ return err
+ }
+ if err := f.Close(); err != nil {
+ return err
+ }
+ }
+ }
+ return nil
+}
🏁 Script executed:
#!/bin/bash
# Find all references to generateTests to ensure callers handle the new error return
rg -nP '\.generateTests\(' packages/go/stbernard/command/alluregen
Length of output: 103
🏁 Script executed:
#!/bin/bash
rg -nP -C3 '\.generateTests\(' packages/go/stbernard/command/alluregen/internal/cmd.go
Length of output: 121
Handle error from generateTests in cmd.go
In packages/go/stbernard/command/alluregen/internal/cmd.go at line 29, update the call to capture and return the error, e.g.:
if err := results.generateTests("ALLURE_OUTPUT_PATH"); err != nil {
return err
}
🤖 Prompt for AI Agents
In packages/go/stbernard/command/alluregen/internal/types.go around lines 119 to
139, update generateTests to return an error (change signature to func (r
*TestResults) generateTests(envVariable string) error) and stop calling
log.Fatal; instead propagate errors: if os.Create fails return fmt.Errorf(...,
err), if json.MarshalIndent fails return fmt.Errorf(..., err), check the result
of f.Write (or use io.WriteString) and return any write error, and ensure defer
f.Close() checks and returns any Close error if needed. After this change,
update the caller in packages/go/stbernard/command/alluregen/internal/cmd.go at
line 29 to capture and return the error, e.g. if err :=
results.generateTests("ALLURE_OUTPUT_PATH"); err != nil { return err }.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
.github/workflows/run-go-unit-tests.yml (1)
66-74
: Ensure report publishing can push to gh-pages and avoid failing on PRs.
- Add GITHUB_TOKEN for push.
- Gate publishing to non-PR events; PRs from forks won’t have write perms.
- - name: Build test report - uses: simple-elf/[email protected] - if: always() + - name: Build test report + uses: simple-elf/[email protected] + if: ${{ github.event_name != 'pull_request' && always() }} with: gh_pages: gh-pages allure_history: allure-history allure_results: allure-results allure_report: allure-report + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
🧹 Nitpick comments (6)
.github/workflows/run-go-unit-tests.yml (6)
31-34
: Set minimal permissions and add concurrency to cancel superseded runs.This reduces token scope and avoids duplicate in‑flight runs on the same ref.
jobs: run-tests: runs-on: ubuntu-latest + permissions: + contents: write + concurrency: + group: run-go-tests-${{ github.event_name }}-${{ github.ref || github.head_ref }} + cancel-in-progress: true
46-49
: Harden tests: add -race and keep JSON even on failure.
- -race catches data races early.
- tee preserves JSON while keeping output visible.
- go test -json -cover ./... > test_results.json + go test -json -race -cover ./... | tee test_results.json
58-65
: Scope history checkout to non‑PR events and fetch full history.Avoids noisy failures on forks and ensures history is available for trends.
- name: Get Allure history - uses: actions/checkout@v4 - if: always() + uses: actions/checkout@v4 + if: ${{ github.event_name != 'pull_request' && always() }} continue-on-error: true with: ref: gh-pages path: gh-pages + fetch-depth: 0
19-30
: Consider handling more PR activity types.Add reopened and ready_for_review to avoid missing events.
pull_request: branches: - main - "stage/**" types: - opened - synchronize + - reopened + - ready_for_review
54-56
: Nit: avoid UUOC.You can redirect stdin directly for clarity.
- cat test_results.json | golurectl -l -e --allure-suite "Go Test" --allure-tags "Unit" -o ./allure-results + golurectl -l -e --allure-suite "Go Test" --allure-tags "Unit" -o ./allure-results < test_results.json
50-56
: Pin golurectl to v0.14.3 and make conversion resilient to test failures
- Add
if: always()
to install and conversion steps, and skip conversion iftest_results.json
is missing.- Pin installation to the latest stable tag (v0.14.3) for reproducibility.
- name: Install AllureCtl - run: | - go install github.com/robotomize/go-allure/cmd/golurectl@latest + if: always() + run: | + go install github.com/robotomize/go-allure/cmd/[email protected] - name: Building Allure JSON - run: | - cat test_results.json | golurectl -l -e --allure-suite "Go Test" --allure-tags "Unit" -o ./allure-results + if: always() + run: | + if [ -s test_results.json ]; then + golurectl -l -e --allure-suite "Go Test" --allure-tags "Unit" -o ./allure-results < test_results.json + else + echo "No test_results.json to convert" + fi
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/run-go-unit-tests.yml
(1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.7)
.github/workflows/run-go-unit-tests.yml
59-59: the runner of "actions/checkout@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: run-tests
🔇 Additional comments (2)
.github/workflows/run-go-unit-tests.yml (2)
59-59
: Update actions/checkout to v4 (actionlint failure).This v2 usage will fail on modern runners. Bump to v4.
- - name: Get Allure history - uses: actions/checkout@v2 + - name: Get Allure history + uses: actions/checkout@v4
66-74
: Inputs align with simple-elf/[email protected] defaults. gh_pages, allure_history, allure_results, and allure_report match the action README; no changes needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (9)
.github/workflows/run-go-unit-tests.yml (9)
54-57
: Avoid UUOC; read the file via stdin redirection.Minor cleanup, same behavior.
- cat test_results.json | golurectl -l -e --allure-suite "Go Test" --allure-tags "Unit" -o ./allure-results + golurectl -l -e --allure-suite "Go Test" --allure-tags "Unit" -o ./allure-results < test_results.json
46-49
: Preserve test logs in step output while saving JSON.Makes debugging easier in CI logs.
- go test -json -cover ./... > test_results.json + go test -json -cover ./... | tee test_results.json > /dev/null
19-30
: Broaden PR event types (optional).Consider handling reopened and ready_for_review.
pull_request: branches: - main - "stage/**" types: - - opened - - synchronize + - opened + - synchronize + - reopened + - ready_for_review
31-34
: Set explicit token permissions (principle of least privilege).Avoid unintended writes from actions that may push.
jobs: +permissions: + contents: read run-tests: runs-on: ubuntu-latest
75-79
: Make artifact upload resilient and include raw inputs (optional).Upload even on failures, and include allure-results and test_results.json for debugging.
- - name: Upload Test Report - uses: actions/upload-artifact@v4 - with: - name: allure-report - path: allure-report + - name: Upload Test Report + if: always() + uses: actions/upload-artifact@v4 + with: + name: allure-report + path: allure-report + + - name: Upload Allure Inputs + if: always() + uses: actions/upload-artifact@v4 + with: + name: allure-inputs + path: | + allure-results + test_results.json
39-45
: Consider removing check-latest for determinism.Pinning to go.mod is already deterministic; check-latest can drift CI behavior unexpectedly.
with: go-version-file: go.mod cache: true - check-latest: true
17-34
: Add workflow concurrency to auto-cancel superseded runs.Saves CI minutes and avoids racing artifact uploads.
name: Run Go Tests on: @@ -jobs: +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: run-tests: runs-on: ubuntu-latest
50-53
: Pin golurectl to v0.14.3 for reproducible builds- go install github.com/robotomize/go-allure/cmd/golurectl@latest + go install github.com/robotomize/go-allure/cmd/[email protected]
66-74
: Clarify that allure-report-action doesn’t auto-publish; add deploy step
simple-elf/[email protected] only generates the report and history; it does not push to gh-pages. To publish, add a deploy step (e.g. peaceiris/actions-gh-pages) or enable Pages “Deploy from a branch,” passinggithub_token: ${{ secrets.GITHUB_TOKEN }}
to that step. Optionally guard the deploy step withif: github.event_name == 'push'
to avoid publishing from PRs.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/run-go-unit-tests.yml
(1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.7)
.github/workflows/run-go-unit-tests.yml
59-59: the runner of "actions/checkout@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: run-tests
🔇 Additional comments (1)
.github/workflows/run-go-unit-tests.yml (1)
58-65
: Update actions/checkout to v4 (v2 runner is deprecated).Actionlint flags this; modern runners may fail.
- - name: Get Allure history - uses: actions/checkout@v2 + - name: Get Allure history + uses: actions/checkout@v4 if: always() continue-on-error: true with: ref: gh-pages path: gh-pages + fetch-depth: 0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (2)
.github/workflows/run-go-unit-tests.yml (2)
17-30
: Set explicit permissions for gh-pages writes.If simple-elf/allure-report-action pushes to gh-pages, you need contents: write. Defaults can be read-only.
name: Run Go Tests on: push: branches: - main pull_request: branches: - main - "stage/**" types: - opened - synchronize + +permissions: + contents: writePlease confirm whether the action commits/pushes; if not, ignore this.
35-41
: Pin action and tool versions for supply-chain stability.
- Pin GitHub Actions to commit SHAs (checkout, setup-go, upload-artifact, simple-elf/allure-report-action).
- Avoid go install @latest; pin golurectl to a tagged version or commit.
If you want, I can propose SHAs after you confirm the exact versions you’d like to target.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/run-go-unit-tests.yml
(1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.7)
.github/workflows/run-go-unit-tests.yml
60-60: the runner of "actions/checkout@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
- GitHub Check: Build BloodHound Container Image / Build and Package Container
- GitHub Check: run-analysis
- GitHub Check: run-tests
- GitHub Check: run-tests
- GitHub Check: build-ui
🔇 Additional comments (1)
.github/workflows/run-go-unit-tests.yml (1)
59-66
: Bump actions/checkout to v4 (v2 is too old).actionlint flags this; modern runners reject v2.
- - name: Get Allure history - uses: actions/checkout@v2 + - name: Get Allure history + uses: actions/checkout@v4
- Update event trigger workflow expression
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/run-go-tests.yml
(2 hunks)
🧰 Additional context used
🪛 actionlint (1.7.8)
.github/workflows/run-go-tests.yml
100-100: the runner of "actions/checkout@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: run-tests
- GitHub Check: build-ui
- GitHub Check: run-tests
- GitHub Check: run-analysis
- name: Checkout source code for this repository | ||
uses: actions/checkout@v4 | ||
if: ${{ github.event.ref == 'refs/heads/main' }} | ||
|
||
- name: Install Go | ||
uses: actions/setup-go@v5 | ||
if: ${{ github.event.ref == 'refs/heads/main' }} | ||
with: | ||
go-version-file: go.mod | ||
cache: true | ||
check-latest: true | ||
|
||
- name: Run Tests | ||
if: ${{ github.event.ref == 'refs/heads/main' }} | ||
run: | | ||
go test -json -cover ./... > test_results.json | ||
- name: Install AllureCtl | ||
if: ${{ github.event.ref == 'refs/heads/main' }} | ||
run: | | ||
go install github.com/robotomize/go-allure/cmd/golurectl@latest | ||
- name: Building Allure JSON | ||
if: ${{ github.event.ref == 'refs/heads/main' }} | ||
run: | | ||
cat test_results.json | golurectl -l -e --allure-suite "Go Test" --allure-tags "Unit" -o ./allure-results | ||
- name: Get Allure history | ||
uses: actions/checkout@v2 | ||
if: ${{ github.event.ref == 'refs/heads/main' }} | ||
continue-on-error: true | ||
with: | ||
ref: gh-pages | ||
path: gh-pages | ||
|
||
- name: Build test report | ||
uses: simple-elf/[email protected] | ||
if: ${{ github.event.ref == 'refs/heads/main' }} | ||
with: | ||
gh_pages: gh-pages | ||
allure_history: allure-history | ||
allure_results: allure-results | ||
allure_report: allure-report | ||
|
||
- name: Upload Test Report | ||
uses: actions/upload-artifact@v4 | ||
if: ${{ github.event.ref == 'refs/heads/main' }} | ||
with: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Allure job never runs on PRs
Every step is gated on github.event.ref == 'refs/heads/main'
, but for pull_request
events that field is always empty. As a result none of the commands execute, so no Allure report is ever produced. Move the condition to the job level and key off github.base_ref
(for PRs) or adjust the workflow trigger (e.g. run on push
to main
) so the report actually builds.
- generate-go-test-report:
- runs-on: ubuntu-latest
-
- steps:
- - name: Checkout source code for this repository
- uses: actions/checkout@v4
- if: ${{ github.event.ref == 'refs/heads/main' }}
+ generate-go-test-report:
+ if: ${{ github.base_ref == 'main' }}
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout source code for this repository
+ uses: actions/checkout@v4
(Remove the redundant per-step guards once the job-level condition is in place.)
Committable suggestion skipped: line range outside the PR's diff.
🧰 Tools
🪛 actionlint (1.7.8)
100-100: the runner of "actions/checkout@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
🤖 Prompt for AI Agents
.github/workflows/run-go-tests.yml around lines 72 to 119: the workflow
currently gates every step with if: github.event.ref == 'refs/heads/main', which
fails for pull_request events (github.event.ref is empty), so the Allure job
never runs; move the condition to the job level and change it to check PR base
or push to main (for example, use a job-level if that allows runs when
github.event_name == 'pull_request' and github.base_ref == 'main' or when
github.ref == 'refs/heads/main'), OR adjust the workflow triggers to include
push to main instead of relying on event.ref, then remove the redundant per-step
if guards so the job executes for PRs targeting main and for pushes to main.
Resolves: BED-6484
Description
Describe your changes in detail
Motivation and Context
Resolves <TICKET_OR_ISSUE_NUMBER>
Why is this change required? What problem does it solve?
How Has This Been Tested?
Yes -
ok github.com/specterops/bloodhound/packages/go/slicesext 0.265s
Please describe in detail how you tested your changes.
Include details of your testing environment, and the tests you ran to
see how your change affects other areas of the code, etc.
Screenshots (optional):
Types of changes
Checklist:
Summary by CodeRabbit
Chores
Tests