Repository navigation
95 lines (83 loc) · 3.03 KB
/
Copy pathbench.yml
File metadata and controls
95 lines (83 loc) · 3.03 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
name: Benchmarks
on:
release:
types: [published]
workflow_dispatch:
inputs:
scales:
description: "Corpus scales to benchmark (space-separated)"
default: "small medium"
type: string
concurrency:
group: bench-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
cli-bench:
permissions:
contents: write # upload release assets
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Harden Runner
uses: step-security/harden-runner@46b06cea07f9e64621fdf066ba77ac6915163d43 # v2.22.3
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
- name: Install hyperfine
uses: taiki-e/install-action@b80e2bb2635f28eb98b9fce1e2f0887e1535c6b2 # v2
with:
tool: hyperfine@1.20.0
- name: Install jq and yq
env:
JQ_VERSION: jq-1.8.1
YQ_VERSION: v4.53.2
INSTALL_DIR: ${{ runner.temp }}/bench-bin
run: |
mkdir -p "$INSTALL_DIR"
case "$(uname -s)-$(uname -m)" in
Linux-x86_64) jq_suffix="linux-amd64"; yq_suffix="linux_amd64" ;;
Linux-aarch64) jq_suffix="linux-arm64"; yq_suffix="linux_arm64" ;;
Darwin-x86_64) jq_suffix="macos-amd64"; yq_suffix="darwin_amd64" ;;
Darwin-arm64) jq_suffix="macos-arm64"; yq_suffix="darwin_arm64" ;;
*) echo "Unsupported platform: $(uname -s)-$(uname -m)" >&2; exit 1 ;;
esac
curl --retry 5 --retry-all-errors --retry-delay 2 -sSfL \
-o "$INSTALL_DIR/jq" \
"https://github.com/jqlang/jq/releases/download/${JQ_VERSION}/jq-${jq_suffix}"
curl --retry 5 --retry-all-errors --retry-delay 2 -sSfL \
-o "$INSTALL_DIR/yq" \
"https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_${yq_suffix}"
chmod +x "$INSTALL_DIR/jq" "$INSTALL_DIR/yq"
printf '%s\n' "$INSTALL_DIR" >> "$GITHUB_PATH"
- name: Verify benchmark tools
run: |
hyperfine --version
jq --version
yq --version
- name: Run CLI benchmarks
env:
BENCH_SCALES: ${{ inputs.scales || 'small medium' }}
run: |
cd benches/cli
bash run.sh "$BENCH_SCALES"
- name: Upload results
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
with:
name: cli-bench-results
path: benches/cli/results/*.md
retention-days: 14
- name: Attach to release
if: github.event_name == 'release'
env:
GH_TOKEN: ${{ github.token }}
run: |
for f in benches/cli/results/*.md; do
gh release upload "${{ github.event.release.tag_name }}" "$f" --clobber
done