|
| 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/sccache-action@v0.0.9 |
| 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