Skip to content

Commit

Permalink
[benchmarks] First working PR comment.
Browse files Browse the repository at this point in the history
  • Loading branch information
petervdonovan committed Jul 14, 2022
1 parent b7bff1c commit 1b92c88
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/continuous-benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
uses: actions/checkout@v2
with:
repository: lf-lang/benchmarks-lingua-franca
ref: continuous-benchmarking # FIXME: delete this line after merge
ref: automated-full-benchmark # FIXME: delete this line after merge

- name: Set up workspace
uses: ./.github/actions/set-up-workspace
Expand Down
54 changes: 32 additions & 22 deletions .github/workflows/user-requested-benchmark.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: User-requested benchmarks

on:
issue_comment:
types: [created]
Expand All @@ -8,6 +9,11 @@ on:
pr_number:
required: true
type: number

permissions:
contents: write
pull-requests: write

jobs:
run_benchmarks:
runs-on: ubuntu-latest
Expand All @@ -17,10 +23,21 @@ jobs:
uses: actions/checkout@v2
with:
repository: lf-lang/benchmarks-lingua-franca
ref: cb # FIXME: delete this line after merge
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 1
ref: automated-full-benchmark # FIXME: delete this line after merge

- name: Checkout reactor-c
uses: actions/checkout@v2
with:
repository: lf-lang/reactor-c
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0 # It will be necessary to push to this repo
ref: automated-full-benchmark # FIXME: delete this line after merge
path: reactor-c

- name: Set up workspace
uses: lf-lang/reactor-c/.github/actions/set-up-workspace@continuous-benchmarking
uses: lf-lang/reactor-c/.github/actions/set-up-workspace@automated-full-benchmark

- name: Run C Benchmarks
# run: |
Expand All @@ -38,43 +55,36 @@ jobs:
./runner/collect_results.py latest latest-benchmark-results.csv
shell: bash

- name: Checkout repository for saving graphics
uses: actions/checkout@v2
with:
repository: lf-lang/benchmarks-lingua-franca
ref: graphics
path: graphics-repo
fetch-depth: 0 # History is required for push

- name: Make figure
run: |
OUTPUT_DIR=runner/images/$(date -I)
OUTPUT_DIR=images/$(date -I)
SHA=${{ github.sha }}
OUTPUT_FILE=$OUTPUT_DIR/${SHA:0:7}.png
mkdir -p graphics-repo/$OUTPUT_DIR
./runner/make-graphics.py latest-benchmark-results.csv graphics-repo/$OUTPUT_FILE
mkdir -p reactor-c/$OUTPUT_DIR
./runner/make-graphics.py latest-benchmark-results.csv reactor-c/$OUTPUT_FILE
echo "::set-output name=output_file::$OUTPUT_FILE"
shell: bash
id: figure

- name: Commit figure
run: |
cd graphics-repo
cd reactor-c
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
git fetch
git switch graphics
git add ${{ steps.figure.outputs.OUTPUT_FILE }}
git commit -m "benchmark ${{ github.sha }}"
- name: Push figure
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: graphics
git config -l | grep 'http\..*\.extraheader' | cut -d= -f1 | \
xargs -L1 git config --unset-all
git push https://token:${{ secrets.GITHUB_TOKEN }}@github.com/lf-lang/reactor-c.git
cd ..
shell: bash

- name: Comment PR
uses: thollander/actions-comment-pull-request@v1
with:
message: |
![Visualization of the benchmark results.](https://raw.githubusercontent.com/lf-lang/benchmarks-lingua-franca/graphics/${{ steps.figure.outputs.OUTPUT_FILE }})
pr_number: 51 # ${{ inputs.pr_number }}
![Visualization of the benchmark results.](https://raw.githubusercontent.com/lf-lang/reactor-c/graphics/${{ steps.figure.outputs.OUTPUT_FILE }})
pr_number: 91 # ${{ inputs.pr_number }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 1b92c88

Please sign in to comment.