diff --git a/.github/workflows/super-linter.lock.yml b/.github/workflows/super-linter.lock.yml index 255d1dc1430..f9d8f5faec9 100644 --- a/.github/workflows/super-linter.lock.yml +++ b/.github/workflows/super-linter.lock.yml @@ -4569,7 +4569,7 @@ jobs: fi - name: Upload super-linter log if: always() - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 with: name: super-linter-log path: super-linter.log diff --git a/pkg/cli/compile_integration_test.go b/pkg/cli/compile_integration_test.go index ed0b63003f3..6b1cb4931a3 100644 --- a/pkg/cli/compile_integration_test.go +++ b/pkg/cli/compile_integration_test.go @@ -66,6 +66,13 @@ func TestMain(m *testing.M) { os.RemoveAll(filepath.Dir(globalBinaryPath)) } + // Clean up any action cache files created during tests + // Tests may create .github/aw/actions-lock.json in the pkg/cli directory + actionCacheDir := filepath.Join(wd, ".github") + if _, err := os.Stat(actionCacheDir); err == nil { + _ = os.RemoveAll(actionCacheDir) + } + os.Exit(code) } diff --git a/pkg/cli/test_main_test.go b/pkg/cli/test_main_test.go new file mode 100644 index 00000000000..c93b0fbb85c --- /dev/null +++ b/pkg/cli/test_main_test.go @@ -0,0 +1,31 @@ +//go:build !integration + +package cli + +import ( + "os" + "path/filepath" + "testing" +) + +// TestMain provides setup and teardown for unit tests in the cli package +// Note: Integration tests have their own TestMain in compile_integration_test.go +func TestMain(m *testing.M) { + // Get current working directory before tests run + wd, err := os.Getwd() + if err != nil { + panic("Failed to get current working directory: " + err.Error()) + } + + // Run all tests + code := m.Run() + + // Clean up any action cache files created during tests + // Tests may create .github/aw/actions-lock.json in the pkg/cli directory + actionCacheDir := filepath.Join(wd, ".github") + if _, err := os.Stat(actionCacheDir); err == nil { + _ = os.RemoveAll(actionCacheDir) + } + + os.Exit(code) +}