@@ -65,3 +65,181 @@ jobs:
65
65
BUILD_FLAGS : ' --locked'
66
66
TEST_FLAGS : ' --no-fail-fast'
67
67
run : ./test.sh --release
68
+
69
+ competing_benchmark :
70
+ name : Benchmark (Debug)
71
+
72
+ runs-on : ubuntu-latest
73
+
74
+ steps :
75
+ - uses : actions/checkout@v4
76
+
77
+ - name : Cache (rust)
78
+ uses : actions/cache@v4
79
+ timeout-minutes : 1
80
+ continue-on-error : true
81
+ if : matrix.os != 'macos-latest' # Cache causes errors on macOS
82
+ with :
83
+ path : |
84
+ ~/.cargo/registry
85
+ ~/.cargo/git
86
+ target
87
+ key : ${{ github.job }}-Linux-${{ hashFiles('rust-toolchain') }}-${{ hashFiles('**/Cargo.lock') }}
88
+ restore-keys : |
89
+ ${{ github.job }}-Linux-${{ hashFiles('rust-toolchain') }}-${{ hashFiles('**/Cargo.lock') }}
90
+ ${{ github.job }}-Linux-${{ hashFiles('rust-toolchain') }}-
91
+
92
+ -
uses :
actions-rs/[email protected]
93
+ with :
94
+ profile : minimal
95
+ components : clippy
96
+ override : ' true'
97
+ default : ' true'
98
+
99
+ - name : Build pdu
100
+ run : |
101
+ cargo build --release
102
+ echo "$(pwd)/target/release" >> "$GITHUB_PATH"
103
+
104
+ - name : Install dust
105
+ env :
106
+ REPO : https://github.com/bootandy/dust
107
+ VERSION : ' 0.8.1'
108
+ run : |
109
+ mkdir -p DUST.tmp
110
+ archive_name="dust-v${VERSION}-x86_64-unknown-linux-gnu"
111
+ curl -L "${REPO}/releases/download/v${VERSION}/${archive_name}.tar.gz" > tmp.dust.tar.gz
112
+ tar xf tmp.dust.tar.gz --directory=DUST.tmp
113
+ chmod +x "DUST.tmp/${archive_name}/dust"
114
+ echo "$(pwd)/DUST.tmp/${archive_name}" >> "$GITHUB_PATH"
115
+
116
+ - name : Install dutree
117
+ env :
118
+ REPO : https://github.com/nachoparker/dutree
119
+ VERSION : ' 0.2.18'
120
+ run : |
121
+ mkdir -p DUTREE.tmp
122
+ flags=(
123
+ --force
124
+ --root DUTREE.tmp
125
+ --version "$VERSION"
126
+ --profile release
127
+ --locked
128
+ )
129
+ cargo install "${flags[@]}" dutree
130
+ echo "$(pwd)/DUTREE.tmp/bin" >> "$GITHUB_PATH"
131
+
132
+ - name : Install dua
133
+ env :
134
+ REPO : https://github.com/Byron/dua-cli
135
+ VERSION : ' 2.19.2'
136
+ run : |
137
+ mkdir -p DUA.tmp
138
+ archive_name="dua-v${VERSION}-x86_64-unknown-linux-musl"
139
+ curl -L "${REPO}/releases/download/v${VERSION}/${archive_name}.tar.gz" > tmp.dua.tar.gz
140
+ tar xf tmp.dua.tar.gz --directory=DUA.tmp
141
+ chmod +x "DUA.tmp/${archive_name}/dua"
142
+ echo "$(pwd)/DUA.tmp/${archive_name}" >> "$GITHUB_PATH"
143
+
144
+ - name : Install ncdu
145
+ run : sudo apt install -y ncdu
146
+
147
+ - name : Install gdu
148
+ env :
149
+ REPO : https://github.com/dundee/gdu
150
+ VERSION : ' 5.15.0'
151
+ run : |
152
+ mkdir -p GDU.tmp
153
+ curl -L "${REPO}/releases/download/v${VERSION}/gdu_linux_amd64.tgz" > tmp.gdu.tar.gz
154
+ tar xf tmp.gdu.tar.gz --directory=GDU.tmp
155
+ mkdir -p GDU.tmp/bin
156
+ chmod +x GDU.tmp/gdu_linux_amd64
157
+ ln -s "$(pwd)/GDU.tmp/gdu_linux_amd64" GDU.tmp/bin/gdu
158
+ echo "$(pwd)/GDU.tmp/bin" >> "$GITHUB_PATH"
159
+
160
+ - name : Install hyperfine
161
+ env :
162
+ REPO : https://github.com/sharkdp/hyperfine
163
+ VERSION : ' 1.11.0'
164
+ run : |
165
+ mkdir -p HYPERFINE.tmp
166
+ archive_name="hyperfine-v${VERSION}-x86_64-unknown-linux-gnu"
167
+ curl -L "${REPO}/releases/download/v${VERSION}/${archive_name}.tar.gz" > tmp.hyperfine.tar.gz
168
+ tar xf tmp.hyperfine.tar.gz --directory=HYPERFINE.tmp
169
+ chmod +x "HYPERFINE.tmp/${archive_name}/hyperfine"
170
+ echo "$(pwd)/HYPERFINE.tmp/${archive_name}" >> "$GITHUB_PATH"
171
+
172
+ - name : Inspect command locations
173
+ run : |
174
+ which pdu
175
+ which dust
176
+ which dutree
177
+ which dua
178
+ which ncdu
179
+ which gdu
180
+ which du
181
+ which hyperfine
182
+
183
+ - name : Inspect versions of the other tools
184
+ run : |
185
+ dust --version
186
+ dutree --version
187
+ dua --version
188
+ ncdu --version
189
+ gdu --version
190
+ du --version
191
+ hyperfine --version
192
+
193
+ - name : Prepare directory to be measured
194
+ run : |
195
+ mkdir -p tmp.sample
196
+ curl -L https://github.com/torvalds/linux/archive/refs/tags/v5.12.zip > tmp.sample.zip
197
+ unzip tmp.sample.zip -d tmp.sample
198
+
199
+ - name : Install Node.js
200
+ uses : actions/setup-node@v4
201
+ with :
202
+ node-version : ' 16.1.0'
203
+
204
+ - name : Cache (pnpm)
205
+ uses : actions/cache@v4
206
+ timeout-minutes : 1
207
+ continue-on-error : true
208
+ with :
209
+ path : ~/.pnpm-store/v3
210
+ key : pnpm-${{ matrix.vars.id }}-${{ hashFiles('**/pnpm-lock.yaml') }}
211
+ restore-keys : |
212
+ pnpm-${{ matrix.vars.id }}-${{ hashFiles('**/pnpm-lock.yaml') }}
213
+ pnpm-${{ matrix.vars.id }}-
214
+ pnpm-
215
+
216
+ - name : Setup pnpm
217
+
218
+ with :
219
+ version : ' 7.9.0'
220
+ run_install : ' true'
221
+
222
+ - name : Compile TypeScript
223
+ run : |
224
+ cd ci/github-actions
225
+ pnpm exec tsc
226
+
227
+ - name : Compare benchmark of pdu against its competitors
228
+ run : node ci/github-actions/competing-benchmark.js
229
+
230
+ - name : Create chart for benchmark reports
231
+ run : node ci/github-actions/illustrate-benchmark-reports.js
232
+
233
+ - name : Create archive of benchmark reports
234
+ run : tar czf tmp.benchmark-reports.tar.gz tmp.benchmark-report.*
235
+
236
+ - name : Upload benchmark reports
237
+ if : false
238
+
239
+ env :
240
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
241
+ with :
242
+ upload_url : ${{ needs.create_release.outputs.upload_url }}
243
+ asset_path : ./tmp.benchmark-reports.tar.gz
244
+ asset_name : benchmark-reports.tar.gz
245
+ asset_content_type : application/x-compressed-tar
0 commit comments