|
| 1 | +name: Benchmarks |
| 2 | + |
| 3 | +# spell-checker:ignore codspeed dtolnay Swatinem |
| 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 performance benchmarks (CodSpeed) |
| 22 | + runs-on: ubuntu-latest |
| 23 | + steps: |
| 24 | + - uses: actions/checkout@v6 |
| 25 | + with: |
| 26 | + persist-credentials: false |
| 27 | + |
| 28 | + - uses: dtolnay/rust-toolchain@stable |
| 29 | + |
| 30 | + - uses: Swatinem/rust-cache@v2 |
| 31 | + |
| 32 | + - name: Install cargo-codspeed |
| 33 | + shell: bash |
| 34 | + run: cargo install cargo-codspeed --locked |
| 35 | + |
| 36 | + - name: Build benchmarks |
| 37 | + shell: bash |
| 38 | + run: cargo codspeed build |
| 39 | + |
| 40 | + - name: Run performance benchmarks |
| 41 | + uses: CodSpeedHQ/action@v4 |
| 42 | + env: |
| 43 | + CODSPEED_LOG: debug |
| 44 | + with: |
| 45 | + mode: simulation |
| 46 | + run: cargo codspeed run > /dev/null |
| 47 | + token: ${{ secrets.CODSPEED_TOKEN }} |
| 48 | + |
| 49 | + memory-benchmarks: |
| 50 | + name: Run memory benchmarks (CodSpeed) |
| 51 | + runs-on: ubuntu-latest |
| 52 | + steps: |
| 53 | + - uses: actions/checkout@v6 |
| 54 | + with: |
| 55 | + persist-credentials: false |
| 56 | + |
| 57 | + - uses: dtolnay/rust-toolchain@stable |
| 58 | + |
| 59 | + - uses: Swatinem/rust-cache@v2 |
| 60 | + |
| 61 | + - name: Install cargo-codspeed |
| 62 | + shell: bash |
| 63 | + run: cargo install cargo-codspeed --locked |
| 64 | + |
| 65 | + - name: Build benchmarks for memory analysis |
| 66 | + shell: bash |
| 67 | + run: cargo codspeed build -m analysis |
| 68 | + |
| 69 | + - name: Run memory benchmarks |
| 70 | + uses: CodSpeedHQ/action@v4 |
| 71 | + env: |
| 72 | + CODSPEED_LOG: debug |
| 73 | + with: |
| 74 | + mode: memory |
| 75 | + run: cargo codspeed run > /dev/null |
| 76 | + token: ${{ secrets.CODSPEED_TOKEN }} |
0 commit comments