Skip to content

Commit 15ba6aa

Browse files
authored
Merge pull request #8891 from sylvestre/gh-bench
github: compile & run benchmarks in parallel
2 parents 7866727 + f19d7ec commit 15ba6aa

File tree

2 files changed

+82
-64
lines changed

2 files changed

+82
-64
lines changed

.github/workflows/CICD.yml

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1326,67 +1326,3 @@ jobs:
13261326
run: cargo build --release -p uu_rm -p uu_chmod -p uu_chown -p uu_chgrp -p uu_mv -p uu_du
13271327
- name: Run safe traversal verification
13281328
run: ./util/check-safe-traversal.sh
1329-
1330-
benchmarks:
1331-
name: Run benchmarks (CodSpeed)
1332-
runs-on: ubuntu-latest
1333-
needs: min_version
1334-
steps:
1335-
- uses: actions/checkout@v5
1336-
with:
1337-
persist-credentials: false
1338-
1339-
- name: Install system dependencies
1340-
shell: bash
1341-
run: |
1342-
sudo apt-get -y update
1343-
sudo apt-get -y install libselinux1-dev
1344-
1345-
- uses: dtolnay/rust-toolchain@stable
1346-
1347-
- uses: Swatinem/rust-cache@v2
1348-
1349-
- name: Run sccache-cache
1350-
uses: mozilla-actions/[email protected]
1351-
1352-
- name: Install cargo-codspeed
1353-
shell: bash
1354-
run: cargo install cargo-codspeed --locked
1355-
1356-
- name: Get benchmark list
1357-
id: benchmark_list
1358-
shell: bash
1359-
run: |
1360-
echo "Finding all utilities with benchmarks..."
1361-
benchmark_packages=""
1362-
for bench_dir in $(ls -d src/uu/*/benches 2>/dev/null); do
1363-
prog_dir=$(dirname "$bench_dir")
1364-
prog_name=$(basename "$prog_dir")
1365-
echo "Found benchmarks for uu_$prog_name"
1366-
benchmark_packages="$benchmark_packages uu_$prog_name"
1367-
done
1368-
echo "benchmark_packages=${benchmark_packages}" >> $GITHUB_OUTPUT
1369-
echo "Found benchmark packages:${benchmark_packages}"
1370-
1371-
- name: Build benchmarks
1372-
shell: bash
1373-
run: |
1374-
echo "Building benchmarks for packages: ${{ steps.benchmark_list.outputs.benchmark_packages }}"
1375-
for package in ${{ steps.benchmark_list.outputs.benchmark_packages }}; do
1376-
echo "Building benchmarks for $package"
1377-
cargo codspeed build -p $package
1378-
done
1379-
1380-
- name: Run benchmarks
1381-
uses: CodSpeedHQ/action@v4
1382-
env:
1383-
CODSPEED_LOG: debug
1384-
with:
1385-
mode: instrumentation
1386-
run: |
1387-
echo "Running benchmarks for packages: ${{ steps.benchmark_list.outputs.benchmark_packages }}"
1388-
for package in ${{ steps.benchmark_list.outputs.benchmark_packages }}; do
1389-
echo "Running benchmarks for $package"
1390-
cargo codspeed run -p $package > /dev/null
1391-
done
1392-
token: ${{ secrets.CODSPEED_TOKEN }}

.github/workflows/benchmarks.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Benchmarks
2+
3+
# spell-checker:ignore codspeed dtolnay Swatinem sccache
4+
5+
on:
6+
pull_request:
7+
push:
8+
branches:
9+
- '*'
10+
11+
permissions:
12+
contents: read # to fetch code (actions/checkout)
13+
14+
# End the current execution if there is a new changeset in the PR.
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.ref }}
17+
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
18+
19+
jobs:
20+
benchmarks:
21+
name: Run benchmarks (CodSpeed)
22+
runs-on: ubuntu-latest
23+
strategy:
24+
matrix:
25+
benchmark-target:
26+
- { package: uu_base64 }
27+
- { package: uu_cp }
28+
- { package: uu_cut }
29+
- { package: uu_du }
30+
- { package: uu_expand }
31+
- { package: uu_fold }
32+
- { package: uu_hashsum }
33+
- { package: uu_ls }
34+
- { package: uu_mv }
35+
- { package: uu_nl }
36+
- { package: uu_numfmt }
37+
- { package: uu_rm }
38+
- { package: uu_seq }
39+
- { package: uu_sort }
40+
- { package: uu_split }
41+
- { package: uu_tsort }
42+
- { package: uu_unexpand }
43+
- { package: uu_uniq }
44+
- { package: uu_wc }
45+
steps:
46+
- uses: actions/checkout@v5
47+
with:
48+
persist-credentials: false
49+
50+
- name: Install system dependencies
51+
shell: bash
52+
run: |
53+
sudo apt-get -y update
54+
sudo apt-get -y install libselinux1-dev
55+
56+
- uses: dtolnay/rust-toolchain@stable
57+
58+
- uses: Swatinem/rust-cache@v2
59+
60+
- name: Run sccache-cache
61+
uses: mozilla-actions/[email protected]
62+
63+
- name: Install cargo-codspeed
64+
shell: bash
65+
run: cargo install cargo-codspeed --locked
66+
67+
- name: Build benchmarks for ${{ matrix.benchmark-target.package }}
68+
shell: bash
69+
run: |
70+
echo "Building benchmarks for ${{ matrix.benchmark-target.package }}"
71+
cargo codspeed build -p ${{ matrix.benchmark-target.package }}
72+
73+
- name: Run benchmarks for ${{ matrix.benchmark-target.package }}
74+
uses: CodSpeedHQ/action@v4
75+
env:
76+
CODSPEED_LOG: debug
77+
with:
78+
mode: instrumentation
79+
run: |
80+
echo "Running benchmarks for ${{ matrix.benchmark-target.package }}"
81+
cargo codspeed run -p ${{ matrix.benchmark-target.package }} > /dev/null
82+
token: ${{ secrets.CODSPEED_TOKEN }}

0 commit comments

Comments
 (0)