Skip to content

Commit 5831c32

Browse files
committed
debug
1 parent 531b05c commit 5831c32

File tree

4 files changed

+35
-54
lines changed

4 files changed

+35
-54
lines changed

.github/workflows/benchmark.yaml

Lines changed: 5 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: Package Manager Benchmarks
2-
on:
2+
on:
33
push:
44
workflow_dispatch:
55
inputs:
@@ -33,15 +33,15 @@ jobs:
3333
timeout-minutes: 60
3434
strategy:
3535
matrix:
36-
fixture: ${{ fromJson(inputs.fixtures || '["next", "astro", "vue", "svelte"]') }}
37-
variation: ${{ fromJson(inputs.variations || '["cache", "cache+lockfile", "cache+node_modules", "cache+lockfile+node_modules", "clean", "lockfile", "lockfile+node_modules", "node_modules"]') }}
36+
fixture: ${{ fromJson(inputs.fixtures || '["next"]') }}
37+
variation: ${{ fromJson(inputs.variations || '["cache+lockfile+node_modules"]') }}
3838
include:
3939
- variation: "run"
4040
fixture: "run"
4141
env:
42-
BENCH_INCLUDE: ${{ fromJson(inputs.binaries || '"npm,yarn,berry,pnpm,vlt,bun,deno,nx,turbo,node"') }}
42+
BENCH_INCLUDE: ${{ fromJson(inputs.binaries || '"pnpm"') }}
4343
BENCH_WARMUP: ${{ inputs.warmup || '2' }}
44-
BENCH_RUNS: ${{ inputs.runs || '10' }}
44+
BENCH_RUNS: ${{ inputs.runs || '12' }}
4545
steps:
4646
- uses: actions/checkout@v4
4747
- name: Install Node
@@ -64,48 +64,3 @@ jobs:
6464
name: results-${{ matrix.fixture }}-${{ matrix.variation }}
6565
path: ./results/${{ matrix.fixture }}/${{ matrix.variation }}/
6666
retention-days: 7
67-
process:
68-
name: 'Process Results'
69-
runs-on: ubuntu-latest
70-
needs: [benchmark]
71-
timeout-minutes: 5
72-
steps:
73-
- uses: actions/checkout@v4
74-
- name: Install Node
75-
uses: actions/setup-node@v4
76-
with:
77-
node-version: '24'
78-
- name: Download Results
79-
uses: actions/download-artifact@v4
80-
with:
81-
path: results
82-
pattern: results-*
83-
- name: Process Results
84-
run: |
85-
bash ./scripts/process-results.sh
86-
- name: Upload Processed Results
87-
uses: actions/upload-artifact@v4
88-
with:
89-
name: charts
90-
path: charts
91-
retention-days: 7
92-
deploy:
93-
name: 'Deploy Results'
94-
runs-on: ubuntu-latest
95-
needs: [process]
96-
permissions:
97-
contents: write
98-
# if: github.ref == 'refs/heads/main'
99-
steps:
100-
- uses: actions/checkout@v4
101-
- name: Download Results
102-
uses: actions/download-artifact@v4
103-
with:
104-
name: charts
105-
path: charts/
106-
- name: Deploy to GitHub Pages
107-
uses: peaceiris/actions-gh-pages@v3
108-
with:
109-
github_token: ${{ secrets.GITHUB_TOKEN }}
110-
publish_dir: charts
111-
force_orphan: true

scripts/package-count.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,24 +39,32 @@ if [ -d "node_modules" ]; then
3939
| sort -u \
4040
| wc -l \
4141
| xargs
42-
)
42+
) || true
4343
else
4444
# if there is no node_modules directory, the install failed
4545
# and we can't infer the package manager, so we'll skip this run
46+
echo "Warning: node_modules directory does not exist"
4647
exit 0
4748
fi
4849

49-
# If the package count is not set, set it to 0
50-
if [ -z "${BENCH_PACKAGE_COUNT:-}" ]; then
50+
# if we couldn't determine the package count, then just exit, no count file will be created
51+
if [ -z "${BENCH_PACKAGE_COUNT+x}" ] || [ "$BENCH_PACKAGE_COUNT" = "0" ]; then
5152
# if the package count couldn't be determined, the install likely failed
5253
# and we can't infer the package manager, so we'll skip this run
54+
echo "Warning: Could not determine the package count"
5355
exit 0
5456
fi
5557

5658
BENCH_PACKAGE_MANAGER=$(
5759
infer_package_manager
5860
)
5961

62+
# if we couldn't determine the package manager, then just exit, no count file will be created
63+
if [ -z "${BENCH_PACKAGE_MANAGER+x}" ] || [ "$BENCH_PACKAGE_MANAGER" = "none" ]; then
64+
echo "Warning: Could not determine the package manager"
65+
exit 0
66+
fi
67+
6068
# Create the results directory if it doesn't exist
6169
if [ -n "$BENCH_PACKAGE_MANAGER" ] && [ "$BENCH_PACKAGE_MANAGER" != "none" ]; then
6270
mkdir -p "$BENCH_PACKAGE_COUNT_FOLDER"

scripts/variations/cache+lockfile+node_modules.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ source "$1/variations/common.sh"
88
# When running a cache benchmark, we want to clean up only the node_modules
99
# directory and the lockfiles between each run.
1010
hyperfine --ignore-failure \
11+
--show-output \
1112
--time-unit=millisecond \
1213
--export-json="$BENCH_OUTPUT_FOLDER/benchmarks.json" \
1314
--warmup="$BENCH_WARMUP" \

scripts/variations/common.sh

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,5 +73,22 @@ mkdir -p "$BENCH_OUTPUT_FOLDER"
7373
# Function to collect package count into a package-count.json file
7474
collect_package_count() {
7575
ls -la "$BENCH_OUTPUT_FOLDER"
76+
77+
# Prints the output of each install
78+
for pm in npm yarn berry pnpm vlt bun deno nx turbo node; do
79+
if echo "$BENCH_INCLUDE" | grep -qw "$pm"; then
80+
for i in {0..9}; do
81+
echo "-- Reading output of $pm install $i ---"
82+
log_file="$BENCH_OUTPUT_FOLDER/${pm}-output-$i.log"
83+
if [ -f "$log_file" ]; then
84+
echo "---"
85+
cat "$log_file"
86+
echo "---"
87+
fi
88+
echo "--------------------------------"
89+
done
90+
fi
91+
done
92+
7693
node "$BENCH_SCRIPTS/collect-package-count.js" "$BENCH_OUTPUT_FOLDER"
77-
}
94+
}

0 commit comments

Comments
 (0)