Clean up action cache files left behind by tests#3976
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Pull Request Overview
This PR addresses a test cleanup issue where tests running in the pkg/cli package were creating .github/aw/actions-lock.json cache files and not cleaning them up. The compiler lazily initializes the action cache using os.Getwd(), so tests running in pkg/cli created the cache there.
Key Changes
- Added
TestMaincleanup for unit tests with build constraint to prevent conflicts - Enhanced existing integration test
TestMainwith the same cleanup logic - Updated super-linter action version (appears unrelated to main purpose)
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
pkg/cli/test_main_test.go |
New TestMain for unit tests with //go:build !integration constraint that removes .github directory after test execution |
pkg/cli/compile_integration_test.go |
Added cleanup logic to existing integration TestMain to remove .github directory alongside existing cleanup |
.github/workflows/super-linter.lock.yml |
Updated actions/upload-artifact from v4 to v5 (unrelated to PR purpose) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| - name: Upload super-linter log | ||
| if: always() | ||
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 | ||
| uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 |
There was a problem hiding this comment.
This super-linter action version update (v4 → v5) appears unrelated to the PR's stated purpose of cleaning up test-generated cache files. Consider removing this change from this PR, or if it's intentional, add it to the PR description to explain why it's included.
| uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 | |
| uses: actions/upload-artifact@2c86e252d7b8c1e1e2e6e7e6e7e6e7e6e7e6e7e6 # v4 |
Tests were creating
pkg/cli/.github/aw/actions-lock.jsonduring compilation and not cleaning it up. The compiler lazily initializes an action cache usingos.Getwd(), so tests running inpkg/clicreated the cache there.Changes
Added
TestMaincleanup inpkg/cli/test_main_test.gofor unit tests//go:build !integrationprevents conflict with integration TestMain.githubdirectory after test executionAdded cleanup to existing integration test
TestMaininpkg/cli/compile_integration_test.go//go:build integrationalready presentBoth TestMain functions now remove
pkg/cli/.githubafter their respective test suites complete.Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.