Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
m1iktea committed Jul 17, 2024
1 parent 9535ed5 commit 5f500a4
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions .github/workflows/benchmark-machine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,13 @@ jobs:
with:
fetch-depth: 0

- name: Set up AWS CLI
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Set up AWS CLI
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1

# TODO: maybe use GHA to start/stop remote instance
- name: Start remote instance
timeout-minutes: 10
id: start_instance
Expand All @@ -49,27 +48,26 @@ jobs:
fi
done
echo "Remote instance reachable now after $SECONDS seconds"
remote_ip=`aws ec2 describe-instances --filters 'Name=instance-state-name,Values=running' 'Name=instance-id,Values=${{ env.INSTANCE_ID }}' --query 'Reservations[*].Instances[*].[PublicIpAddress]' --output text`
echo "Running instances ip address: $remote_ip"
remote_ip=$(aws ec2 describe-instances --filters 'Name=instance-state-name,Values=running' 'Name=instance-id,Values=${{ env.INSTANCE_ID }}' --query 'Reservations[*].Instances[*].[PublicIpAddress]' --output text)
echo "Running instances IP address: $remote_ip"
echo "remote_ip=$remote_ip" >> $GITHUB_OUTPUT
# exit status should propagate through ssh
- name: Remotely benchmark machine
timeout-minutes: 10
run: |
echo "Running instances ip address: ${{ steps.start_instance.outputs.remote_ip }}"
echo "Running instance's IP address: ${{ steps.start_instance.outputs.remote_ip }}"
cat << EOF > ./benchmark-server-key.pem
${{ env.BENCHMARK_SSH_KEY }}
EOF
chmod 600 ./benchmark-server-key.pem
ssh -x -o StrictHostKeychecking=no "${{ steps.start_instance.outputs.remote_ip }}" -l ${{ env.BENCHMARK_SSH_USER }} -i ./benchmark-server-key.pem \
docker pull litentry/litentry-parachain:${{ github.event.inputs.docker_tag }} && \
docker run --rm litentry/litentry-parachain:${{ github.event.inputs.docker_tag }} benchmark machine --allow-fail --chain=litmus-dev
ssh -o StrictHostKeyChecking=no -i ./benchmark-server-key.pem "${{ env.BENCHMARK_SSH_USER }}@${{ steps.start_instance.outputs.remote_ip }}" \
"docker pull litentry/litentry-parachain:${{ github.event.inputs.docker_tag }} && \
docker run --rm litentry/litentry-parachain:${{ github.event.inputs.docker_tag }} benchmark machine --allow-fail --chain=litmus-dev"
- name: Stop remote instance
if: always()
run: |
aws ec2 stop-instances --instance-ids ${{ env.INSTANCE_ID }}
sleep 5
ret=`aws ec2 describe-instance-status --instance-ids ${{ env.INSTANCE_ID }} | jq '.InstanceStatuses[0].InstanceState.Name'`
ret=$(aws ec2 describe-instance-status --instance-ids ${{ env.INSTANCE_ID }} --query 'InstanceStatuses[0].InstanceState.Name' --output text)
echo "Remote instance running state: $ret"

0 comments on commit 5f500a4

Please sign in to comment.