image file cleanup
All checks were successful
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Successful in 4m22s

This commit is contained in:
2025-12-03 23:13:34 -08:00
parent 07c147b369
commit 31fb2d06a9
3 changed files with 16 additions and 4 deletions

View File

@@ -180,6 +180,18 @@ jobs:
continue-on-error: true # Allows the workflow to proceed even if coverage merge fails.
- name: Clean Up Test Artifacts
if: always() # This step runs even if the previous test or coverage steps failed.
run: |
APP_PATH="/var/www/flyer-crawler.projectium.com"
echo "--- Cleaning up test-generated flyer assets ---"
# Use find to delete files within the directories, but not the directories themselves.
# Target only the specific test files by name pattern.
find "$APP_PATH/flyer-images" -type f -name '*-test-flyer-image.jpg' -delete
find "$APP_PATH/flyer-images/icons" -type f -name '*test-flyer-image.webp' -delete
find "$APP_PATH/flyer-images/archive" -mindepth 1 -maxdepth 1 -type f -delete || echo "Archive directory not found, skipping."
echo "✅ Test artifacts cleared from asset directories."
- name: Archive Code Coverage Report
# This action saves the generated HTML coverage report as a downloadable artifact.
uses: actions/upload-artifact@v3

View File

@@ -141,8 +141,8 @@ jobs:
APP_PATH="/var/www/flyer-crawler.projectium.com"
echo "Clearing contents of flyer asset directories..."
# Use find to delete files within the directories, but not the directories themselves.
# This is safer than `rm -rf` as it won't fail if a directory doesn't exist.
find "$APP_PATH/flyer-images" -mindepth 1 -maxdepth 1 -type f -delete
find "$APP_PATH/flyer-images/icons" -mindepth 1 -maxdepth 1 -type f -delete
# Target only the specific test files by name pattern.
find "$APP_PATH/flyer-images" -type f -name '*-test-flyer-image.jpg' -delete
find "$APP_PATH/flyer-images/icons" -type f -name '*test-flyer-image.webp' -delete
find "$APP_PATH/flyer-images/archive" -mindepth 1 -maxdepth 1 -type f -delete || echo "Archive directory not found, skipping."
echo "✅ Flyer asset directories cleared."

View File

@@ -71,7 +71,7 @@ describe('Flyer Processing Background Job Integration Test', () => {
// Arrange: Load a mock flyer PDF.
const imagePath = path.resolve(__dirname, '../assets/test-flyer-image.jpg');
const imageBuffer = await fs.readFile(imagePath);
const mockImageFile = new File([imageBuffer], 'test-flyer-image.jpg', { type: 'image/jpeg' });
const mockImageFile = new File([imageBuffer], 'flyer-test-flyer-image.jpg', { type: 'image/jpeg' });
const checksum = await generateFileChecksum(mockImageFile);
// Act 1: Upload the file to start the background job.