Skip to content

Add performance benchmarking logic to time_expr! macro #53

Add performance benchmarking logic to time_expr! macro

Add performance benchmarking logic to time_expr! macro #53

Workflow file for this run

name: Run dyno on PR open
on:
pull_request:
types:
- opened
jobs:
run-dyno:
if: ${{ github.event.pull_request.merged == false }}
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
TARGET_REPO: ${{ secrets.TARGET_REPO }}
TARGET_NAME: ${{ secrets.TARGET_NAME }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Modify sysctl settings
run: |
echo "kernel.perf_event_paranoid=-1" | sudo tee -a /etc/sysctl.conf
echo "kernel.kptr_restrict=0" | sudo tee -a /etc/sysctl.conf
sudo sysctl -p /etc/sysctl.conf
- name: Extract PR number
id: extract_pr_number
run: |
echo "PR_NUMBER=$(echo "${{ github.event.pull_request.url }}" | grep -o '[0-9]*$')" >> $GITHUB_ENV
- name: Fetch PR reference
run: |
git fetch origin pull/${{ env.PR_NUMBER }}/head:pr-${{ env.PR_NUMBER }}
- name: Check out PR branch
run: |
git checkout pr-${{ env.PR_NUMBER }}
- name: Extract PR hash
id: extract_pr_hash
run: |
PR_HASH=$(git rev-parse HEAD)
echo "PR_HASH=$PR_HASH" >> $GITHUB_ENV
- name: Get PR title and URL
id: get_pr_details
run: |
PR_DETAILS=$(curl -s -H "Authorization: token ${{ env.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository_owner }}/${{ github.event.pull_request.head.repo.name }}/pulls/${{ env.PR_NUMBER }}")
PR_TITLE=$(echo "$PR_DETAILS" | jq -r '.title')
PR_URL=$(echo "$PR_DETAILS" | jq -r '.html_url')
echo "PR_TITLE=$PR_TITLE" >> $GITHUB_ENV
echo "PR_URL=$PR_URL" >> $GITHUB_ENV
- name: Clone target repository
run: |
cd /home/runner/work/
git clone https://github.com/${{ env.TARGET_REPO }} ${{ env.TARGET_NAME }}
cd ${{ env.TARGET_NAME }}
git config user.name "github-actions"
git config user.email "github-actions@github.com"
- name: Get folder name inside site/data
id: get_folder_name
run: |
FOLDER_NAME=$(ls -d /home/runner/work/${{ env.TARGET_NAME }}/site/data/*/ | head -n 1 | xargs -n 1 basename)
echo "FOLDER_NAME=$FOLDER_NAME" >> $GITHUB_ENV
- name: Move benchmarks data to dyno folder
id: move_benchmarks_data_to_dyno_folder
run: |
mkdir -p /home/runner/work/benchmarks
mkdir -p /home/runner/work/benchmarks/stats
mkdir -p /home/runner/work/benchmarks/runs
cp -r /home/runner/work/${{ env.TARGET_NAME }}/site/data/* /home/runner/work/benchmarks/
cp -r /home/runner/work/${{ env.TARGET_NAME }}/site/data/${{ env.FOLDER_NAME }}/stats/* /home/runner/work/benchmarks/stats
cp -r /home/runner/work/${{ env.TARGET_NAME }}/site/data/${{ env.FOLDER_NAME }}/runs/* /home/runner/work/benchmarks/runs
- name: Build sway
run: |
cargo build --release
- name: Install dyno tool
run: |
cd /home/runner/work/
mkdir profiler
cd profiler
git clone https://github.com/ourovoros-io/dyno.git
cd dyno
cargo build --release
cp target/release/dyno /home/runner/work/
sudo rm -rf /home/runner/work/profiler
- name: Run dyno tool
run: |
cd /home/runner/work/
./dyno -t dynotest/dynotest/test/src/sdk-harness/test_projects/ -f dynotest/dynotest/target/release/forc
- name: Install Dyno Site
run: |
cd /home/runner/work/
mkdir sitebuilder
cd sitebuilder
git clone https://github.com/ourovoros-io/dynosite.git
cd dynosite
cargo build --release
cp target/release/dynosite /home/runner/work/
sudo rm -rf /home/runner/work/sitebuilder
- name: Run Dyno Site
run: |
cd /home/runner/work/
./dynosite -b /home/runner/work/benchmarks -p "${{ env.PR_HASH }}" -t "${{ env.PR_TITLE }}" -l "${{ env.PR_URL }}" --data-only
- name: Copy generated files
run: |
cp -r /home/runner/work/site/data /home/runner/work/${{ env.TARGET_NAME }}/site/
cp /home/runner/work/site/error.html /home/runner/work/${{ env.TARGET_NAME }}/site
cp /home/runner/work/site/index.html /home/runner/work/${{ env.TARGET_NAME }}/site
- name: Update README
run: |
cd /home/runner/work/${{ env.TARGET_NAME }}
echo "[View the generated index.html](./site/index.html)" > README.md
- name: Commit and push changes
run: |
cd /home/runner/work/${{ env.TARGET_NAME }}
git add .
git commit -m "Update benchmarks and data for PR #${{ env.PR_NUMBER }}"
git push https://x-access-token:${{ env.GITHUB_TOKEN }}@github.com/${{ env.TARGET_REPO }}.git main