Files
concrete/.github/workflows/daily-benchmarks.yaml
Arthur Meyre 90fa06f80a chore: less notifications
- restructure the way we generate notifications
2021-09-21 16:34:09 +02:00

85 lines
3.5 KiB
YAML

name: Daily Benchmarks
on:
workflow_dispatch:
schedule:
- cron: '0 22 * * *' # Everyday @ 22:00
env:
ACTION_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
jobs:
perform:
name: Run Benchmarks on EC2 and Publish Results to Progress Tracker
runs-on: ubuntu-20.04
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@0d9a5be0dceea74e09396820e1e522ba4a110d2f
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-west-3 # Europe (Paris)
- name: Start EC2 Instance
run: |
aws ec2 start-instances --instance-ids ${{ secrets.BENCHMARKS_EC2_INSTANCE_ID }}
- name: Wait For The Instance To Get An IP Address
run: |
# shellcheck disable=SC2016,2026
timeout 180 bash -c 'until [[ $(aws ec2 describe-instances --instance-ids ${{ secrets.BENCHMARKS_EC2_INSTANCE_ID }} --query 'Reservations[].Instances[].PublicIpAddress' --output text) != "" ]]; do sleep 0.1; done'
- name: Get Public IP Address of EC2 Instance
id: public-ip
run: echo "::set-output name=value::$(aws ec2 describe-instances --region eu-west-3 --instance-ids ${{ secrets.BENCHMARKS_EC2_INSTANCE_ID }} --query 'Reservations[].Instances[].PublicIpAddress' --output text)"
- name: Hide Public IP Address From GitHub Logs
run: echo "::add-mask::${{ steps.public-ip.outputs.value }}"
- name: Wait For The Instance To Accept SSH Connections
run: timeout 180 bash -c 'until nc -z ${{ steps.public-ip.outputs.value }} 22; do sleep 0.1; done'
- name: Connect To EC2 Instance, Perform Benchmarks, Publish Results
uses: appleboy/ssh-action@1d1b21ca96111b1eb4c03c21c14ebb971d2200f6
with:
host: ${{ steps.public-ip.outputs.value }}
username: ${{ secrets.BENCHMARKS_EC2_USERNAME }}
key: ${{ secrets.BENCHMARKS_EC2_SSH_KEY }}
command_timeout: 60m
script: |
cd ~/concretefhe-internal
git pull
make docker_publish_measurements
docker system prune -f
- name: Write SSH Key To A File
run: echo "$SSH_KEY" > ~/ssh-key && chmod 400 ~/ssh-key
env:
SSH_KEY: ${{ secrets.BENCHMARKS_EC2_SSH_KEY }}
- name: Copy Logs
run: scp -o StrictHostKeyChecking=no -i ~/ssh-key ${{ secrets.BENCHMARKS_EC2_USERNAME }}@${{ steps.public-ip.outputs.value }}:~/concretefhe-internal/logs/latest.log ~/latest.log
- name: Stop EC2 Instance
if: ${{ always() }}
run: |
aws ec2 stop-instances --instance-ids ${{ secrets.BENCHMARKS_EC2_INSTANCE_ID }}
- name: Upload Logs
uses: actions/upload-artifact@27121b0bdffd731efa15d66772be8dc71245d074
with:
name: logs
path: ~/latest.log
- name: Send Slack Notification
if: ${{ always() }}
continue-on-error: true
uses: rtCamp/action-slack-notify@12e36fc18b0689399306c2e0b3e0f2978b7f1ee7
env:
SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL }}
SLACK_ICON: https://pbs.twimg.com/profile_images/1274014582265298945/OjBKP9kn_400x400.png
SLACK_COLOR: ${{ job.status }}
SLACK_MESSAGE: "Publishing benchmarks finished with status ${{ job.status }} \
(${{ env.ACTION_RUN_URL }})"
SLACK_USERNAME: ${{ secrets.BOT_USERNAME }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}