ril 0.10.3

Rust Imaging Library: A performant and high-level image processing crate for Rust
Documentation
name: Benchmark

on:
  push:
    branches: [ "main" ]
  pull_request:
    branches: [ "main" ]

env:
  CARGO_TERM_COLOR: always

jobs:
  build:
    runs-on: ubuntu-latest

    environment:
      name: benchmarks
      url: "https://jay3332.github.io/ril/benchmark/index.html"

    steps:
    - uses: actions/checkout@v4

    - name: Install latest stable Rust toolchain
      uses: dtolnay/rust-toolchain@stable

    - name: Setup cache
      uses: Swatinem/rust-cache@v2
    
    - name: Install gnuplot and neofetch
      run: sudo apt update && sudo apt install gnuplot neofetch
    
    - name: Show system specs
      run: neofetch --stdout

    - name: Install cargo-criterion
      uses: Cryptex-github/cached-cargo-install@main
      with:
        crate-name: cargo-criterion

    - name: Install criterion-table
      uses: Cryptex-github/cached-cargo-install@main
      with:
        crate-name: criterion-table
    
    - name: Pull benchmarks data
      run: git clone -b benchmarks https://github.com/jay3332/ril target/criterion

    - name: Run benchmark
      run: cargo criterion --all-features --message-format=json | criterion-table > BENCHMARKS.md
    
    - name: Upload artifact
      uses: actions/upload-artifact@v3
      with:
        name: BENCHMARKS.md
        path: BENCHMARKS.md
    
    - name: Add output markdown to job summary
      run: cat BENCHMARKS.md >> $GITHUB_STEP_SUMMARY
    
    - name: Append benchmark webpage to job summary
      run: echo "For more details, visit [https://jay3332.github.io/ril/benchmark/index.html](https://jay3332.github.io/ril/benchmark/index.html)" >> $GITHUB_STEP_SUMMARY
    
    - name: Deploy
      uses: peaceiris/actions-gh-pages@v3
      if: ${{ github.ref == 'refs/heads/main' }}
      with:
        github_token: ${{ secrets.GITHUB_TOKEN }}
        publish_dir: ./target/criterion/reports
        keep_files: true
        destination_dir: benchmark

    - name: Save data
      uses: peaceiris/actions-gh-pages@v3
      if: ${{ github.ref == 'refs/heads/main' }}
      with:
        github_token: ${{ secrets.GITHUB_TOKEN }}
        publish_dir: ./target/criterion
        keep_files: true
        publish_branch: benchmarks
    
    - name: Set output URL
      run: echo "env_url=https://jay3332.github.io/ril/benchmark/index.html" >> $GITHUB_OUTPUT