full qa #65
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: QA | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- nenad/800-run-qa-from-git | |
jobs: | |
run-malachite-do: | |
runs-on: ubuntu-latest | |
env: | |
BINARY_NAME: informalsystems-malachitebft-starknet-app | |
NODE_COUNT: 3 | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Set up Terraform | |
uses: hashicorp/setup-terraform@v2 | |
with: | |
terraform_version: 1.6.0 | |
- name: Terraform Init | |
working-directory: terraform | |
run: terraform init | |
- name: Terraform Apply (Provision Nodes) | |
working-directory: terraform | |
run: | | |
terraform apply -auto-approve \ | |
-var="do_token=${{ secrets.DO_TOKEN }}" \ | |
-var="do_ssh_fingerprint=${{ secrets.DO_SSH_FINGERPRINT }}" \ | |
-var="node_count=${{ env.NODE_COUNT }}" | |
- name: Wait for Droplets Fully Initialize | |
run: | | |
sleep 10 | |
- name: Fetch Node IPs | |
working-directory: terraform | |
run: | | |
NODE_IPS=$(terraform output -json droplet_ips | sed -n 2p | jq -r 'join(" ")') | |
echo "NODE_IPS=$NODE_IPS" >> $GITHUB_ENV | |
echo "Node IPs: $NODE_IPS" | |
- name: Set up Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
- name: Install protoc | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y protobuf-compiler | |
protoc --version | |
- name: Build Rust Binary | |
working-directory: code | |
run: cargo build -p ${{ env.BINARY_NAME }} --release | |
- name: Write SSH Key | |
run: | | |
printf "%s" "${{ secrets.DO_SSH_KEY }}" | sed 's/\r//' > private_key | |
chmod 600 private_key | |
- name: Upload Binary to Nodes | |
run: | | |
for ip in $NODE_IPS; do | |
scp -i private_key -o StrictHostKeyChecking=no ./code/target/release/${{ env.BINARY_NAME }} root@$ip:/root/ & | |
done | |
wait | |
- name: Execute Binary on Nodes | |
run: | | |
for ip in $NODE_IPS; do | |
ssh -i private_key -o StrictHostKeyChecking=no root@$ip "/root/${{ env.BINARY_NAME }}" & | |
done | |
wait | |
- name: Terraform Destroy (Cleanup Nodes) | |
if: always() | |
working-directory: terraform | |
run: | | |
terraform destroy -auto-approve \ | |
-var="do_token=${{ secrets.DO_TOKEN }}" \ | |
-var="do_ssh_fingerprint=${{ secrets.DO_SSH_FINGERPRINT }}" |