-
Notifications
You must be signed in to change notification settings - Fork 23
137 lines (121 loc) · 4 KB
/
benchmarks-run.yml
File metadata and controls
137 lines (121 loc) · 4 KB
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Benchmarks Run
run-name: Benchmarks Run for ${{github.event.inputs.branch}}
concurrency:
group: ${{github.workflow}}-${{github.ref}}
cancel-in-progress: true
on:
workflow_dispatch:
inputs:
branch:
description: "Branch"
required: true
pallets:
description: "Specific Pallets? (Ex: 'msa,messages')"
required: true
default: all
jobs:
build:
if: github.repository == 'frequency-chain/frequency'
name: Build Benchmark Binary
runs-on: ubicloud-standard-16
container: ghcr.io/frequency-chain/frequency/ci-base-image:1.5.8
permissions:
contents: read
steps:
- name: Check Out Repo
uses: actions/checkout@v6
with:
ref: ${{github.event.inputs.branch}}
- name: Build Binary for Benchmarks
run: |
echo "Running benchmark binary builder..."
./scripts/run_benchmarks.sh -b
- name: Upload Binary
uses: actions/upload-artifact@v6
with:
name: benchmark-binary
path: |
target/release/frequency
target/release/benchmark_transform
retention-days: 3
- name: Upload WASM Build Artifacts
uses: actions/upload-artifact@v6
with:
name: wasm-artifacts
path: target/release/wbuild
retention-days: 3
run-benchmarks:
if: github.repository == 'frequency-chain/frequency'
name: Run Benchmarks
needs: build
runs-on: [self-hosted, Linux, X64, benchmark]
permissions:
contents: write
statuses: write
pull-requests: write
steps:
- name: Print Info
run: |
echo "Running benchmarks..."
echo "Pallets: ${{github.event.inputs.pallets}}"
- name: Check Out Repo
uses: actions/checkout@v6
with:
ref: ${{github.event.inputs.branch}}
- name: Create Target Directory
run: mkdir -p target/release
- name: Download Benchmark Binary
uses: actions/download-artifact@v8
with:
name: benchmark-binary
path: target/release
- name: Download WASM Build Artifacts
uses: actions/download-artifact@v8
with:
name: wasm-artifacts
path: target/release/wbuild
- name: Make Binary Executable
run: |
chmod +x target/release/frequency
chmod +x target/release/benchmark_transform
- name: Update Weights
run: |
pallets_str="${{github.event.inputs.pallets}}"
echo "Pallets: $pallets_str"
if [ -z "${pallets_str}" -o $pallets_str = 'all' ]; then
echo "Running benchmarks for all pallets..."
./scripts/run_benchmarks.sh -s -n
else
IFS=',' read -r -a pallets <<< "$pallets_str"
echo "Running benchmarks for pallets: ${pallets[*]}..."
./scripts/run_benchmarks.sh -s -n "${pallets[@]}"
echo "Finished benchmarks for pallets: ${pallets[*]}."
fi
- name: Print Updated Weights
run: |
git status
git diff
- name: Commit Updated Weights
id: commit-updated-weights
uses: stefanzweifel/git-auto-commit-action@28e16e81777b558cc906c8750092100bbb34c5e3
with:
commit_message: "Update weights"
file_pattern: "pallets/**/*.rs runtime/common/src/weights/*"
test:
if: github.repository == 'frequency-chain/frequency'
name: Post Benchmark Tests
needs: run-benchmarks
runs-on: ubicloud-standard-16
container: ghcr.io/frequency-chain/frequency/ci-base-image:1.5.8
permissions:
contents: read
steps:
- name: Check Out Repo
uses: actions/checkout@v6
with:
ref: ${{github.event.inputs.branch}}
- name: Current Commit
run: git log -n 1
- name: Run Tests
run: cargo test --features runtime-benchmarks,frequency-lint-check --workspace --release