Skip to content

Commit 6f8e4d4

Browse files
committed
Try workflow
1 parent 21de162 commit 6f8e4d4

File tree

2 files changed

+155
-116
lines changed

2 files changed

+155
-116
lines changed

.github/workflows/benchmark.yml

Lines changed: 21 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -34,127 +34,32 @@ on:
3434
default: benchmarks-all
3535

3636
jobs:
37-
start-runner:
38-
name: Start self-hosted EC2 runner
39-
runs-on: ubuntu-latest
37+
run-all:
4038
strategy:
4139
matrix:
4240
include:
43-
# - architecture: x86_64
44-
# instance-type: r7i.xlarge
45-
# ami-id: ami-0ba430d4b7b64de57
46-
# region: eu-west-1
41+
# - architecture: arm64
42+
# instance-type: c6g.xlarge
43+
# ami-id: ami-0375de6ea0af17f87
44+
# region: us-west-2
45+
# subnet-id: subnet-880013ed
46+
# security-group-id: sg-8693a7fe
4747
- architecture: arm64
48-
instance-type: c6g.xlarge # Graviton2
48+
instance-type: i8g.xlarge
4949
ami-id: ami-0375de6ea0af17f87
5050
region: us-west-2
5151
subnet-id: subnet-880013ed
5252
security-group-id: sg-8693a7fe
53-
- architecture: arm64
54-
instance-type: i8g.xlarge # Graviton4
55-
ami-id: ami-0375de6ea0af17f87
56-
region: us-west-2
57-
subnet-id: subnet-880013ed
58-
security-group-id: sg-8693a7fe
59-
outputs:
60-
label: ${{ steps.start-ec2-runner.outputs.label }}
61-
ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }}
62-
steps:
63-
- name: Configure AWS credentials
64-
uses: aws-actions/configure-aws-credentials@v4
65-
with:
66-
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
67-
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
68-
aws-region: ${{ matrix.region }}
69-
- name: Start EC2 runner
70-
id: start-ec2-runner
71-
uses: machulav/ec2-github-runner@v2
72-
env:
73-
SUBNET_ID: ${{ matrix.subnet-id != '' && matrix.subnet-id || secrets.AWS_EC2_SUBNET_ID }}
74-
SECURITY_GROUP_ID: ${{ matrix.security-group-id != '' && matrix.security-group-id || secrets.AWS_EC2_SECURITY_GROUP_ID }}
75-
with:
76-
mode: start
77-
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
78-
# Ubuntu 22.04 128GB Storage AMI
79-
ec2-image-id: ${{ matrix.ami-id }}
80-
ec2-instance-type: ${{ matrix.instance-type }}
81-
subnet-id: ${{ env.SUBNET_ID }}
82-
security-group-id: ${{ env.SECURITY_GROUP_ID}}
83-
label: ${{ matrix.architecture }}-${{ matrix.instance-type }}-${{ github.run_id }}
84-
85-
benchmark:
86-
name: Run the benchmarks on the runner
87-
needs: start-runner # required to start the main job when the runner is ready
88-
runs-on: ${{ needs.start-runner.outputs.label }} # run the job on the newly created runner
89-
steps:
90-
- name: checkout
91-
uses: actions/checkout@v4
92-
with:
93-
ref: ${{ github.event.number && format('refs/pull/{0}/merge', github.event.number) || github.head_ref }}
94-
- name: Print runner info
95-
run: |
96-
printf "Runner lscpu:\n$(lscpu)\n"
97-
printf "Runner lsmem:\n$(lsmem)\n"
98-
printf "Runner nproc:\n$(nproc)\n"
99-
printf "Runner uname:\n$(uname -a)\n"
100-
printf "Runner arch:\n$(arch)\n"
101-
102-
- name: Install benchmark dependencies
103-
run: |
104-
sudo .install/install_script.sh
105-
sudo apt install python3-pip -y
106-
pip3 install --upgrade pip PyYAML setuptools redisbench-admin
107-
pip3 install -r requirements.txt
108-
109-
# TODO: remove "--no-check-certificate" when possible
110-
- name: Download pre-generated indices
111-
timeout-minutes: 20
112-
run: ./tests/benchmark/bm_files.sh ${{ inputs.setup }}
113-
114-
- name: Benchmark
115-
env:
116-
ARCH: ${{ matrix.architecture }}
117-
timeout-minutes: 120
118-
run: |
119-
if [[ $ARCH == "aarch64" ]]; then
120-
source /usr/share/modules/init/bash
121-
export MODULEPATH=$MODULEPATH:/opt/arm/modulefiles
122-
module load armpl/24.10.0_gcc
123-
fi
124-
make benchmark BM_FILTER=${{ inputs.setup }}
125-
126-
- name: Collect results
127-
run: |
128-
./tests/benchmark/benchmarks.sh ${{ inputs.setup }} | xargs -P 0 -I {} redisbench-admin export \
129-
--redistimeseries_host ${{ secrets.PERFORMANCE_RTS_HOST }} \
130-
--redistimeseries_port ${{ secrets.PERFORMANCE_RTS_PORT }} \
131-
--redistimeseries_user default \
132-
--redistimeseries_pass '${{ secrets.PERFORMANCE_RTS_AUTH }}' \
133-
--github_repo ${{ github.event.repository.name }} \
134-
--github_org ${{ github.repository_owner }} \
135-
--github_branch ${{ github.head_ref || github.ref_name }} \
136-
--github_actor ${{ github.triggering_actor }} \
137-
--results-format google.benchmark \
138-
--benchmark-result-file {}_results.json
139-
140-
stop-runner:
141-
name: Stop self-hosted EC2 runner
142-
needs:
143-
- start-runner # required to get output from the start-runner job
144-
- benchmark # required to wait when the main job is done
145-
runs-on: ubuntu-latest
146-
if: ${{ always() }} # required to stop the runner even if the error happened in the previous jobs
147-
steps:
148-
- name: Configure AWS credentials
149-
uses: aws-actions/configure-aws-credentials@v4
150-
with:
151-
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
152-
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
153-
aws-region: ${{ secrets.AWS_REGION }}
154-
- name: Stop EC2 runner
155-
uses: machulav/ec2-github-runner@v2
156-
with:
157-
mode: stop
158-
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
159-
label: ${{ needs.start-runner.outputs.label }}
160-
ec2-instance-id: ${{ needs.start-runner.outputs.ec2-instance-id }}
53+
uses: ./.github/workflows/runner-bench-stop.yml
54+
with:
55+
setup: ${{ inputs.setup }}
56+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
57+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
58+
aws-region: ${{ matrix.region }}
59+
architecture: ${{ matrix.architecture }}
60+
instance-type: ${{ matrix.instance-type }}
61+
ami-id: ${{ matrix.ami-id }}
62+
subnet-id: ${{ matrix.subnet-id }}
63+
security-group-id: ${{ matrix.security-group-id }}
64+
github-runner-label: ${{ matrix.architecture }}-${{ matrix.instance-type }}-${{ github.run_id }}
65+
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
on:
2+
workflow_call:
3+
inputs:
4+
setup:
5+
required: true
6+
type: string
7+
aws-access-key-id:
8+
required: true
9+
type: string
10+
aws-secret-access-key:
11+
required: true
12+
type: string
13+
aws-region:
14+
required: true
15+
type: string
16+
architecture:
17+
required: true
18+
type: string
19+
instance-type:
20+
required: true
21+
type: string
22+
ami-id:
23+
required: true
24+
type: string
25+
subnet-id:
26+
required: true
27+
type: string
28+
security-group-id:
29+
required: true
30+
type: string
31+
github-runner-label:
32+
required: true
33+
type: string
34+
github-token:
35+
required: true
36+
type: string
37+
38+
jobs:
39+
start-runner:
40+
name: Start self-hosted EC2 runner
41+
runs-on: ubuntu-latest
42+
outputs:
43+
runner_label: ${{ steps.start-ec2-runner.outputs.label }}
44+
ec2_instance_id: ${{ steps.start-ec2-runner.outputs.ec2_instance_id }}
45+
steps:
46+
- name: Configure AWS credentials
47+
uses: aws-actions/configure-aws-credentials@v4
48+
with:
49+
aws-access-key-id: ${{ inputs.aws-access-key-id }}
50+
aws-secret-access-key: ${{ inputs.aws-secret-access-key }}
51+
aws-region: ${{ inputs.aws-region }}
52+
- name: Start EC2 runner
53+
id: start-ec2-runner
54+
uses: machulav/ec2-github-runner@v2
55+
env:
56+
SUBNET_ID: ${{ inputs.subnet-id }}
57+
SECURITY_GROUP_ID: ${{ inputs.security-group-id }}
58+
with:
59+
mode: start
60+
github-token: ${{ inputs.github-token }}
61+
ec2-image-id: ${{ inputs.ami-id }}
62+
ec2-instance-type: ${{ inputs.instance-type }}
63+
subnet-id: ${{ inputs.subnet-id }}
64+
security-group-id: ${{ inputs.security-group-id }}
65+
label: ${{ inputs.github-runner-label }}
66+
67+
benchmark:
68+
name: Run benchmarks on runner
69+
needs: start-runner
70+
runs-on: ${{ needs.start-runner.outputs.runner_label }}
71+
steps:
72+
- name: Checkout code
73+
uses: actions/checkout@v4
74+
with:
75+
ref: ${{ github.event.number && format('refs/pull/{0}/merge', github.event.number) || github.head_ref }}
76+
- name: Print runner info
77+
run: |
78+
printf "Runner lscpu:\n$(lscpu)\n"
79+
printf "Runner lsmem:\n$(lsmem)\n"
80+
printf "Runner nproc:\n$(nproc)\n"
81+
printf "Runner uname:\n$(uname -a)\n"
82+
printf "Runner arch:\n$(arch)\n"
83+
- name: Install benchmark dependencies
84+
run: |
85+
sudo .install/install_script.sh
86+
sudo apt install python3-pip -y
87+
pip3 install --upgrade pip PyYAML setuptools redisbench-admin
88+
pip3 install -r requirements.txt
89+
- name: Download pre-generated indices
90+
timeout-minutes: 20
91+
run: ./tests/benchmark/bm_files.sh ${{ inputs.setup }}
92+
- name: Run Benchmark
93+
env:
94+
ARCH: ${{ inputs.architecture }}
95+
timeout-minutes: 120
96+
run: |
97+
if [[ $ARCH == "aarch64" ]]; then
98+
source /usr/share/modules/init/bash
99+
export MODULEPATH=$MODULEPATH:/opt/arm/modulefiles
100+
module load armpl/24.10.0_gcc
101+
fi
102+
make benchmark BM_FILTER=${{ inputs.setup }}
103+
- name: Collect results
104+
run: |
105+
./tests/benchmark/benchmarks.sh ${{ inputs.setup }} | xargs -P 0 -I {} redisbench-admin export \
106+
--redistimeseries_host ${{ secrets.PERFORMANCE_RTS_HOST }} \
107+
--redistimeseries_port ${{ secrets.PERFORMANCE_RTS_PORT }} \
108+
--redistimeseries_user default \
109+
--redistimeseries_pass '${{ secrets.PERFORMANCE_RTS_AUTH }}' \
110+
--github_repo ${{ github.event.repository.name }} \
111+
--github_org ${{ github.repository_owner }} \
112+
--github_branch ${{ github.head_ref || github.ref_name }} \
113+
--github_actor ${{ github.triggering_actor }} \
114+
--results-format google.benchmark \
115+
--benchmark-result-file {}_results.json
116+
117+
stop-runner:
118+
name: Stop self-hosted EC2 runner
119+
needs: benchmark
120+
runs-on: ubuntu-latest
121+
steps:
122+
- name: Configure AWS credentials
123+
uses: aws-actions/configure-aws-credentials@v4
124+
with:
125+
aws-access-key-id: ${{ inputs.aws-access-key-id }}
126+
aws-secret-access-key: ${{ inputs.aws-secret-access-key }}
127+
aws-region: ${{ inputs.aws-region }}
128+
- name: Stop EC2 runner
129+
uses: machulav/ec2-github-runner@v2
130+
with:
131+
mode: stop
132+
github-token: ${{ inputs.github-token }}
133+
label: ${{ inputs.github-runner-label }}
134+
ec2-instance-id: ${{ needs.start-runner.outputs.ec2_instance_id }}

0 commit comments

Comments
 (0)