forked from BYVoid/OpenCC
-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (66 loc) · 2.32 KB
/
Copy pathcodspeed.yml
File metadata and controls
75 lines (66 loc) · 2.32 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
name: CodSpeed
on:
push:
branches: [master, opencc-wasm-develop, upstream-master]
pull_request:
branches: [master, opencc-wasm-develop, upstream-master]
workflow_dispatch:
inputs:
ref:
description: 'Branch or SHA to benchmark (merged on top of opencc-wasm-develop)'
required: true
default: 'upstream-master'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
benchmarks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Merge benchmark target
if: github.event_name == 'workflow_dispatch'
run: |
git config user.email "github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
git fetch origin ${{ inputs.ref }}
git merge FETCH_HEAD --no-edit
- uses: bazel-contrib/setup-bazel@0.19.0
with:
bazelisk-cache: true
repository-cache: true
- name: Configure BuildBuddy
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
shell: bash
env:
BUILDBUDDY_API_KEY: ${{ secrets.BUILDBUDDY_API_KEY }}
run: |
if [ -n "${BUILDBUDDY_API_KEY}" ]; then
{
echo "build --config=buildbuddy"
echo "build --remote_header=x-buildbuddy-api-key=${BUILDBUDDY_API_KEY}"
echo "build --bes_header=x-buildbuddy-api-key=${BUILDBUDDY_API_KEY}"
} >> .bazelrc.user
echo "BuildBuddy enabled."
else
echo "BUILDBUDDY_API_KEY not set; skipping BuildBuddy config."
fi
- name: Build benchmark
run: >-
bazel build
--@codspeed_google_benchmark_compat//:codspeed_mode=simulation
--compilation_mode=dbg
--copt=-O2
--copt=-DNDEBUG
//src/benchmark:performance
- name: Prepare temp directory
run: mkdir -p /tmp/opencc_bench_temp
- uses: CodSpeedHQ/action@v3
with:
token: ${{ secrets.CODSPEED_TOKEN_FRANKSLIN }}
run: >-
OPENCC_BENCHMARK_TEMP_DIR=/tmp/opencc_bench_temp
bazel-bin/src/benchmark/performance
'--benchmark_filter=BM_ConvertLongText.*ocd2'