-
Notifications
You must be signed in to change notification settings - Fork 5
84 lines (79 loc) · 2.51 KB
/
run.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: Benchmark
on:
workflow_dispatch:
inputs:
aws_access_key:
required: true
aws_secret_access_key:
required: true
ref:
required: false
scenario:
required: false
default: default
duration:
required: false
default: 30
permissions:
contents: read
jobs:
scenario:
runs-on: ubuntu-latest
steps:
- name: Mask AWS Credentials
uses: actions/github-script@v7
with:
script: |
core.setSecret(context.payload.inputs.aws_access_key)
core.setSecret(context.payload.inputs.aws_secret_access_key)
- name: Configure AWS Credentials
run: |
mkdir -p ~/.aws
cat <<EOF > ~/.aws/credentials
[default]
aws_access_key_id = ${{ github.event.inputs.aws_access_key }}
aws_secret_access_key = ${{ github.event.inputs.aws_secret_access_key }}
EOF
cat <<EOF > ~/.aws/config
[default]
region = us-west-2
EOF
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
ref: ${{ github.event.inputs.ref }}
- name: Setup Terraform
uses: hashicorp/setup-terraform@651471c36a6092792c552e8b1bef71e592b462d8 # v3.1.1
with:
terraform_version: 1.6.4
terraform_wrapper: false
- name: Create infrastructure
id: create_infra
timeout-minutes: 30
run: |
terraform init
terraform apply -var spec_file=tests/${{ github.event.inputs.scenario }}.yaml -auto-approve -lock=false
echo "ssh_key_path=$(terraform output -raw ssh_key_path)" >> $GITHUB_OUTPUT
- uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
if: success()
with:
name: ssh_private_key
path: |
${{ steps.create_infra.outputs.ssh_key_path }}
- name: Run benchmark
timeout-minutes: 60
run: |
ansible loadgen -m command -a 'systemctl start loadgen' --become
sleep $((${{ github.event.inputs.duration }} * 60))
ansible loadgen -m command -a 'systemctl stop loadgen' --become
scripts/summary.sh >> $GITHUB_STEP_SUMMARY
- name: terraform destroy
if: always()
run: |
terraform destroy -var spec_file=tests/${{ github.event.inputs.scenario }}.yaml -auto-approve
- uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
if: failure()
with:
name: terraform
path: |
.terraform
*.tfstate