|
1 | 1 | name: Package Manager Benchmarks
|
2 |
| -on: |
| 2 | +on: |
3 | 3 | push:
|
4 | 4 | workflow_dispatch:
|
| 5 | + inputs: |
| 6 | + fixtures: |
| 7 | + description: 'The fixture to run the benchmarks on' |
| 8 | + default: '["next", "astro", "svelte", "vue"]' |
| 9 | + variations: |
| 10 | + description: 'The benchmark variations to run' |
| 11 | + default: '["cache", "cache+lockfile", "cache+node_modules", "cache+lockfile+node_modules", "clean", "lockfile", "lockfile+node_modules", "node_modules"]' |
| 12 | + binaries: |
| 13 | + description: 'The binaries to run the benchmarks on' |
| 14 | + default: '"npm,yarn,berry,pnpm,vlt,bun,deno,nx,turbo,node"' |
| 15 | + warmup: |
| 16 | + description: 'The number of warmup runs on each benchmark' |
| 17 | + default: '2' |
| 18 | + runs: |
| 19 | + description: 'The number of runs on each benchmark' |
| 20 | + default: '10' |
5 | 21 | schedule:
|
6 |
| - - cron: "0 0 * * *" |
| 22 | + - cron: "5 23 * * *" |
7 | 23 |
|
8 | 24 | # Prevent multiple runs from interfering with each other
|
9 | 25 | concurrency:
|
10 | 26 | group: ${{ github.workflow }}-${{ github.ref }}
|
11 | 27 | cancel-in-progress: true
|
12 | 28 |
|
13 | 29 | jobs:
|
14 |
| - setup: |
15 |
| - name: 'Setup' |
16 |
| - runs-on: blacksmith-4vcpu-ubuntu-2404 |
17 |
| - timeout-minutes: 10 |
18 |
| - steps: |
19 |
| - - uses: actions/checkout@v4 |
20 |
| - - name: Cache Bins |
21 |
| - uses: useblacksmith/cache@v5 |
22 |
| - with: |
23 |
| - path: bins |
24 |
| - key: bins |
25 |
| - - name: Install Node |
26 |
| - uses: useblacksmith/setup-node@v5 |
27 |
| - with: |
28 |
| - node-version: '22' |
29 |
| - - name: Install & Setup Tools |
30 |
| - run: | |
31 |
| - bash ./scripts/setup.sh |
32 |
| -
|
33 | 30 | benchmark:
|
34 | 31 | name: 'Run Benchmarks'
|
35 |
| - runs-on: blacksmith-4vcpu-ubuntu-2404 |
36 |
| - needs: [setup] |
37 |
| - timeout-minutes: 30 |
| 32 | + runs-on: ubuntu-latest |
| 33 | + timeout-minutes: 60 |
38 | 34 | strategy:
|
39 | 35 | matrix:
|
40 |
| - project: [next, astro, svelte, vue] |
41 |
| - cache: [cold, warm] |
| 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"]') }} |
42 | 38 | include:
|
43 |
| - - project: next |
44 |
| - cache: cold |
45 |
| - - project: astro |
46 |
| - cache: cold |
47 |
| - - project: svelte |
48 |
| - cache: cold |
49 |
| - - project: vue |
50 |
| - cache: cold |
51 |
| - - project: next |
52 |
| - cache: warm |
53 |
| - - project: astro |
54 |
| - cache: warm |
55 |
| - - project: svelte |
56 |
| - cache: warm |
57 |
| - - project: vue |
58 |
| - cache: warm |
| 39 | + - variation: "run" |
| 40 | + fixture: "run" |
| 41 | + env: |
| 42 | + BENCH_INCLUDE: ${{ fromJson(inputs.binaries || '"npm,yarn,berry,pnpm,vlt,bun,deno,nx,turbo,node"') }} |
| 43 | + BENCH_WARMUP: ${{ inputs.warmup || '2' }} |
| 44 | + BENCH_RUNS: ${{ inputs.runs || '10' }} |
59 | 45 | steps:
|
60 | 46 | - uses: actions/checkout@v4
|
61 | 47 | - name: Install Node
|
62 |
| - uses: useblacksmith/setup-node@v5 |
| 48 | + uses: actions/setup-node@v4 |
63 | 49 | with:
|
64 |
| - node-version: '22' |
65 |
| - - name: Install System Dependencies |
| 50 | + node-version: '24' |
| 51 | + - name: Install & Setup Tools |
66 | 52 | run: |
|
67 |
| - sudo apt-get update |
68 |
| - sudo apt-get install -y jq hyperfine |
69 |
| - - name: Restore Bins |
70 |
| - uses: useblacksmith/cache/restore@v5 |
71 |
| - with: |
72 |
| - path: bins |
73 |
| - key: bins |
74 |
| - - name: Run Project Benchmarks |
| 53 | + bash ./scripts/setup.sh |
| 54 | + - name: Run Benchmarks variations |
75 | 55 | run: |
|
76 |
| - if [ "${{ matrix.cache }}" = "warm" ]; then |
77 |
| - bash ./scripts/install-warm.sh ${{ matrix.project }} |
| 56 | + if [ "${{ matrix.variation }}" = "run" ]; then |
| 57 | + bash ./scripts/benchmark.sh run run |
78 | 58 | else
|
79 |
| - bash ./scripts/install.sh ${{ matrix.project }} |
| 59 | + bash ./scripts/benchmark.sh ${{ matrix.fixture }} ${{ matrix.variation }} |
80 | 60 | fi
|
81 | 61 | - name: Upload Benchmark Results
|
82 | 62 | uses: actions/upload-artifact@v4
|
83 | 63 | with:
|
84 |
| - name: ${{ matrix.project }}-${{ matrix.cache }}-results |
85 |
| - path: ./results/${{ matrix.project }}/ |
86 |
| - retention-days: 7 |
87 |
| - |
88 |
| - task: |
89 |
| - name: 'Benchmark Running Tasks' |
90 |
| - runs-on: blacksmith-4vcpu-ubuntu-2404 |
91 |
| - needs: [setup] |
92 |
| - timeout-minutes: 15 |
93 |
| - steps: |
94 |
| - - uses: actions/checkout@v4 |
95 |
| - - name: Install Node |
96 |
| - uses: useblacksmith/setup-node@v5 |
97 |
| - with: |
98 |
| - node-version: '22' |
99 |
| - - name: Install System Dependencies |
100 |
| - run: | |
101 |
| - sudo apt-get update |
102 |
| - sudo apt-get install -y jq hyperfine |
103 |
| - - name: Restore Bins |
104 |
| - uses: useblacksmith/cache/restore@v5 |
105 |
| - with: |
106 |
| - path: bins |
107 |
| - key: bins |
108 |
| - - name: Run Task Execution Benchmarks |
109 |
| - run: | |
110 |
| - bash ./scripts/run.sh |
111 |
| - - name: Upload Benchmark Results |
112 |
| - uses: actions/upload-artifact@v4 |
113 |
| - with: |
114 |
| - name: task-benchmark-results |
115 |
| - path: ./results/run.json |
| 64 | + name: results-${{ matrix.fixture }}-${{ matrix.variation }} |
| 65 | + path: ./results/${{ matrix.fixture }}/${{ matrix.variation }}/ |
116 | 66 | retention-days: 7
|
117 |
| - |
118 | 67 | process:
|
119 | 68 | name: 'Process Results'
|
120 |
| - runs-on: blacksmith-4vcpu-ubuntu-2404 |
121 |
| - needs: [benchmark, task] |
| 69 | + runs-on: ubuntu-latest |
| 70 | + needs: [benchmark] |
122 | 71 | timeout-minutes: 5
|
123 | 72 | steps:
|
124 | 73 | - uses: actions/checkout@v4
|
125 | 74 | - name: Install Node
|
126 |
| - uses: useblacksmith/setup-node@v5 |
| 75 | + uses: actions/setup-node@v4 |
127 | 76 | with:
|
128 |
| - node-version: '22' |
| 77 | + node-version: '24' |
129 | 78 | - name: Download Results
|
130 | 79 | uses: actions/download-artifact@v4
|
131 | 80 | with:
|
132 | 81 | path: results
|
133 |
| - merge-multiple: true |
| 82 | + pattern: results-* |
134 | 83 | - name: Process Results
|
135 | 84 | run: |
|
136 | 85 | bash ./scripts/process-results.sh
|
137 | 86 | - name: Upload Processed Results
|
138 | 87 | uses: actions/upload-artifact@v4
|
139 | 88 | with:
|
140 |
| - name: processed-results |
141 |
| - path: chart/results/ |
| 89 | + name: charts |
| 90 | + path: charts |
142 | 91 | retention-days: 7
|
143 |
| - |
144 | 92 | deploy:
|
145 | 93 | name: 'Deploy Results'
|
146 |
| - runs-on: blacksmith-4vcpu-ubuntu-2404 |
| 94 | + runs-on: ubuntu-latest |
147 | 95 | needs: [process]
|
| 96 | + permissions: |
| 97 | + contents: write |
148 | 98 | if: github.ref == 'refs/heads/main'
|
149 | 99 | steps:
|
150 | 100 | - uses: actions/checkout@v4
|
151 | 101 | - name: Download Results
|
152 | 102 | uses: actions/download-artifact@v4
|
153 | 103 | with:
|
154 |
| - name: processed-results |
155 |
| - path: chart/results/ |
| 104 | + name: charts |
| 105 | + path: charts/ |
156 | 106 | - name: Deploy to GitHub Pages
|
157 | 107 | uses: peaceiris/actions-gh-pages@v3
|
158 | 108 | with:
|
159 | 109 | github_token: ${{ secrets.GITHUB_TOKEN }}
|
160 |
| - publish_dir: chart/results |
| 110 | + publish_dir: charts |
161 | 111 | force_orphan: true
|
162 | 112 |
|
163 |
| - cleanup: |
164 |
| - name: 'Cleanup' |
165 |
| - needs: [deploy] |
166 |
| - runs-on: blacksmith-4vcpu-ubuntu-2404 |
167 |
| - if: always() |
168 |
| - steps: |
169 |
| - - name: Delete old artifacts |
170 |
| - run: | |
171 |
| - gh api repos/${{ github.repository }}/actions/artifacts --paginate | jq -r '.artifacts[] | select(.expired) | .id' | xargs -I {} gh api repos/${{ github.repository }}/actions/artifacts/{} -X DELETE |
0 commit comments