Add SSH Key to SSH Agent #179
Workflow file for this run
This file contains 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: Run Benchmarks | |
on: | |
push: | |
branches: | |
- push-deploy-key | |
workflow_dispatch: # Allows the workflow to be triggered manually | |
inputs: # Optional inputs to customize the workflow when triggered manually | |
branch: | |
description: 'Branch to run benchmarks on' | |
required: false | |
default: 'push-deploy-key' | |
jobs: | |
run-benchmarks: | |
runs-on: ucc-benchmarks-8-core-U22.04 | |
steps: | |
- name: Setup SSH Key | |
run: | | |
mkdir -p ~/.ssh | |
echo "${{ secrets.DEPLOY_KEY }}" > ~/.ssh/id_ed25519 | |
chmod 600 ~/.ssh/id_ed25519 | |
ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts | |
# Test SSH connection with a Git command (non-interactive) | |
git ls-remote git@github.com:unitaryfund/ucc.git | |
- name: Add SSH Key to SSH Agent | |
run: | | |
eval $(ssh-agent -s) | |
ssh-add ~/.ssh/id_ed25519 | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
ssh-key: ~/.ssh/id_ed25519 | |
# Build the Docker image | |
- name: Build Docker image | |
run: docker build -t ucc-benchmark . | |
# Run the benchmarks in the Docker container | |
- name: Run benchmarks | |
run: | | |
docker run --rm \ | |
-v "/home/runner/work/ucc/ucc:/ucc" \ | |
ucc-benchmark bash -c " | |
source /venv/bin/activate && \ | |
./benchmarks/scripts/run_benchmarks.sh 8 && \ | |
python ./benchmarks/scripts/plot_avg_benchmarks_over_time.py && \ | |
python ./benchmarks/scripts/plot_latest_benchmarks.py | |
" | |
# Commit and push benchmark results | |
- name: Configure Git for commit | |
run: | | |
git config --global user.email "actions@github.com" | |
git config --global user.name "GitHub Actions" | |
- name: Commit and push results | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git switch ${{ github.head_ref || github.ref_name }} | |
git add benchmarks/* | |
git status | |
git commit -m "Update benchmark results" || echo "No changes to commit" | |
git push origin HEAD:${{ github.head_ref || github.ref_name }} --force | |