add workflow to test comment action #14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Test Comment Action | |
| on: | |
| merge_group: | |
| pull_request: | |
| branches: ["main", "dev"] | |
| workflow_dispatch: | |
| push: | |
| branches: ["main"] | |
| jobs: | |
| benchmark: | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| bits: [32, 64] | |
| os: | |
| - macos-latest | |
| - ubuntu-latest | |
| - windows-latest | |
| exclude: | |
| # There's no such thing as 32-bit macOS | |
| - bits: 32 | |
| os: "macos-latest" | |
| - bits: 32 | |
| os: "macos-13" | |
| runs-on: ${{ matrix.os }} | |
| defaults: | |
| run: | |
| shell: bash | |
| working-directory: libcrux-ml-kem | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| repository: 'cryspen/libcrux' | |
| # set up rust env | |
| - name: Update dependencies | |
| run: cargo update | |
| - run: echo "RUST_TARGET_FLAG=" > $GITHUB_ENV | |
| if: ${{ matrix.bits == 64 }} | |
| - name: 🛠️ Setup Ubuntu x86 | |
| if: ${{ matrix.bits == 32 && matrix.os == 'ubuntu-latest' }} | |
| run: | | |
| rustup target add i686-unknown-linux-gnu | |
| sudo apt-get update | |
| sudo apt-get install -y gcc-multilib g++-multilib | |
| - name: 🛠️ Setup macOS | |
| if: ${{ matrix.os == 'macos-latest' }} | |
| run: | | |
| rustup target add aarch64-apple-darwin | |
| # Set up 32 bit systems | |
| - name: 🛠️ Config Windows x86 | |
| run: echo "RUST_TARGET_FLAG=--target=i686-pc-windows-msvc" > $GITHUB_ENV | |
| if: ${{ matrix.bits == 32 && matrix.os == 'windows-latest' }} | |
| - name: 🛠️ Config Linux x86 | |
| run: | | |
| echo "RUST_TARGET_FLAG=--target=i686-unknown-linux-gnu" > $GITHUB_ENV | |
| if: ${{ matrix.bits == 32 && matrix.os == 'ubuntu-latest' }} | |
| # run benchmarks | |
| - name: 🏃🏻♀️ Benchmarks | |
| run: cargo bench --verbose $RUST_TARGET_FLAG -- --output-format bencher | tee bench.txt | |
| # extract benchmark json | |
| - name: Extract benchmarks | |
| uses: cryspen/benchmark-data-extract-transform@v2 | |
| with: | |
| name: ML-KEM Benchmark | |
| tool: 'cargo' | |
| os: ${{ matrix.os }}_${{ matrix.bits }} | |
| output-file-path: libcrux-ml-kem/bench.txt | |
| data-out-path: libcrux-ml-kem/bench-processed.json | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: benchdata-${{matrix.os}}-${{matrix.bits}}.json | |
| path: libcrux-ml-kem/bench-processed.json | |
| merge: | |
| runs-on: ubuntu-latest | |
| needs: benchmark | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| repository: 'cryspen/libcrux' | |
| - run: mkdir benchdata | |
| - uses: actions/download-artifact@v5 | |
| with: | |
| pattern: benchdata-*.json | |
| path: benchdata/ | |
| merge-multiple: true | |
| - run: ls -lR | |
| - run: jq -s add benchdata/* > benchdata-all.json | |
| - uses: cryspen/benchmark-comment-and-plot-action@main | |
| with: | |
| group-by: os,keySize | |
| schema: category,keySize,name,platform,api,os | |
| input-data-path: benchdata-all.json | |
| name: ML-KEM Benchmarks | |