better deploys
All checks were successful
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Successful in 2m44s

This commit is contained in:
2025-11-24 19:18:39 -08:00
parent bc1dcd2d0e
commit fa240b040f

View File

@@ -113,26 +113,36 @@ jobs:
ls -l .coverage/unit/coverage-final.json
ls -l .coverage/integration/coverage-final.json
# Step 1: Create a temporary directory to hold all coverage files for merging.
MERGE_DIR=".coverage/temp-for-merge"
mkdir -p "$MERGE_DIR"
echo "Created temporary merge directory: $MERGE_DIR"
# Step 2: Copy the individual coverage reports into the temporary directory.
cp .coverage/unit/coverage-final.json "$MERGE_DIR/unit-coverage.json"
cp .coverage/integration/coverage-final.json "$MERGE_DIR/integration-coverage.json"
echo "Copied coverage files to merge directory. Contents:"
ls -l "$MERGE_DIR"
# nyc's `report` command can merge multiple coverage files automatically.
# The standard way to do this is to place all `coverage-final.json` files
# into a single directory and point `nyc report` to it.
# Step 1: Define a directory for nyc to use as its source for merging.
# We use a path relative to the workspace to avoid issues with the runner's CWD.
NYC_SOURCE_DIR=".coverage/nyc-source-for-report"
mkdir -p "$NYC_SOURCE_DIR"
echo "Created temporary directory for nyc reporting source: $NYC_SOURCE_DIR"
# Step 2: Copy the individual coverage reports into the source directory.
# We give them unique names to be safe, though it's not strictly necessary.
cp .coverage/unit/coverage-final.json "$NYC_SOURCE_DIR/unit-coverage.json"
cp .coverage/integration/coverage-final.json "$NYC_SOURCE_DIR/integration-coverage.json"
echo "Copied coverage files to source directory. Contents:"
ls -l "$NYC_SOURCE_DIR"
# Step 3: Generate the reports directly from the source directory.
# We explicitly tell nyc where to find the source coverage files (`--temp-dir`)
# and where to output the final reports (`--report-dir`).
# This avoids the ENOENT error by preventing `nyc` from looking in a default
# cache location (`.nyc_output`) which was causing the failure.
echo "Generating reports from coverage data..."
npx nyc report \
--reporter=text \
--reporter=html \
--report-dir .coverage/ \
--temp-dir "$NYC_SOURCE_DIR"
# Step 3: Merge all .json files from the temporary directory into a single output file.
echo "Merging coverage data..."
npx nyc merge "$MERGE_DIR" .coverage/coverage.json
# Step 4: Generate the text summary and HTML report from the single, merged coverage file.
# We no longer need --temp-dir, as nyc report will automatically use the merged .coverage/coverage.json
# We add --check-coverage=false to prevent nyc from re-processing and force it to use the merged file.
echo "Generating reports from merged data..."
npx nyc report --reporter=text --reporter=html --report-dir .coverage/ --check-coverage=false
echo "✅ Coverage reports generated successfully."
- name: Archive Code Coverage Report