-
Notifications
You must be signed in to change notification settings - Fork 235
69 lines (66 loc) · 2.56 KB
/
benchmark.yml
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
name: Benchmark
on:
# Submit your review with a comment body containing "#benchmark"
pull_request_review:
types: [ submitted ]
push:
branches:
- 'pkg/*'
schedule:
- cron: '0 0 * * *'
# Manurally trigger
workflow_dispatch:
jobs:
benchmark:
name: Benchmark
runs-on: ubuntu-20.04
if: |
(
github.event_name == 'pull_request_review' &&
contains(github.event.review.body, '#benchmark')
) || (
github.event_name == 'schedule' &&
github.repository_owner == 'nervosnetwork'
) || (
github.event_name == 'workflow_dispatch'
)
env:
AWS_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY }}
AWS_SECRET_KEY: ${{ secrets.AWS_SECRET_KEY }}
AWS_EC2_TYPE: "c5.xlarge"
GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
GITHUB_REF_NAME: ${{ github.ref_name }}
GITHUB_REPO: ${{ github.repository }}
GITHUB_EVENT_NAME: ${{ github.event_name }}
steps:
- uses: actions/checkout@v3
with:
repository: nervosnetwork/ckb-integration-test
- name: Get branch name when event is pr review comments
if: github.event_name == 'pull_request_review' && contains(github.event.review.body, '#benchmark')
uses: xt0rted/pull-request-comment-branch@v1
id: comment-branch
- name: Get Current Date & Set ENV
id: date
run: |
echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
echo "START_TIME=$(date +%Y-%m-%d' '%H:%M:%S.%6N)" >> $GITHUB_ENV
echo "CKB_COMMIT_ID=$(git describe --dirty --always --match _EXCLUDE__ --abbrev=7)" >> $GITHUB_ENV
echo "CKB_COMMIT_TIME=$(git log -1 --date=iso "--pretty=format:%cd" | cut -d ' ' -f 1,2)" >> $GITHUB_ENV
- name: Start
env:
JOB_ID: "benchmark-${{ github.repository_owner }}-${{ github.ref_name }}-${{ steps.date.outputs.date }}-in-10h"
run: |
export GITHUB_BRANCH=${{ steps.comment-branch.outputs.head_ref }}
./ckb-bench/devtools/ci/script/benchmark.sh run
- name: Set test state when benchmark success.
if: ${{ success() }}
run: echo "GITHUB_RUN_STATE=0" >> $GITHUB_ENV
- name: Set test state when benchmark failed.
if: ${{ failure() }}
run: echo "GITHUB_RUN_STATE=1" >> $GITHUB_ENV
- name: Clean Up
if: ${{ always() }}
env:
JOB_ID: "benchmark-${{ github.repository_owner }}-${{ github.ref_name }}-${{ steps.date.outputs.date }}-in-10h"
run: ./ckb-bench/devtools/ci/script/benchmark.sh clean