-
Notifications
You must be signed in to change notification settings - Fork 12
206 lines (181 loc) · 6.76 KB
/
dwarf-perf-history.yml
File metadata and controls
206 lines (181 loc) · 6.76 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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
name: DWARF Perf History
on:
push:
branches: [ main ]
paths:
- 'ghostscope-dwarf/**'
- 'bins/dwarf-tool/**'
- 'scripts/dwarf-perf/**'
- 'Cargo.toml'
- 'Cargo.lock'
- '.github/workflows/dwarf-perf-history.yml'
schedule:
- cron: '17 3 * * *'
workflow_dispatch:
concurrency:
group: dwarf-perf-history-${{ github.ref }}
cancel-in-progress: false
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
LLVM_SYS_181_PREFIX: /usr/lib/llvm-18
jobs:
build:
name: Build DWARF Perf History
runs-on: ubuntu-latest
timeout-minutes: 75
permissions:
contents: write
env:
CARGO_TARGET_DIR: ${{ github.workspace }}/.target_tmp/dwarf-perf-history
DWARF_PERF_RESULTS_DIR: ${{ github.workspace }}/.tmp/dwarf-perf-results
DWARF_PERF_SITE_DIR: ${{ github.workspace }}/.tmp/dwarf-perf-site
DWARF_PERF_HISTORY_BRANCH: dwarf-perf-history-data
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Configure GitHub Pages
id: pages
uses: actions/configure-pages@v5
- name: Install LLVM 18 and jq
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 18
sudo apt-get install -y llvm-18-dev libpolly-18-dev jq
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@1.88.0
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-dwarf-perf-history-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-dwarf-perf-history-cargo-registry-
- name: Cache cargo index
uses: actions/cache@v4
with:
path: ~/.cargo/git
key: ${{ runner.os }}-dwarf-perf-history-cargo-index-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-dwarf-perf-history-cargo-index-
- name: Cache cargo build
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/.target_tmp/dwarf-perf-history
key: ${{ runner.os }}-dwarf-perf-history-target-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-dwarf-perf-history-target-
- name: Prepare result directories
run: mkdir -p "$DWARF_PERF_RESULTS_DIR"
- name: Run baseline
run: |
set -euo pipefail
./scripts/dwarf-perf/build_corpus.sh
parse_targets=(
parse-stress
rust-parse-stress
cpp-template-stress
rust-generic-stress
cpp-deep-namespace
)
combine_args=()
primary_json=""
for target in "${parse_targets[@]}"; do
result_json="$DWARF_PERF_RESULTS_DIR/main-${target}.json"
./scripts/dwarf-perf/run_baseline.sh \
--skip-build \
--results-dir "$DWARF_PERF_RESULTS_DIR" \
--result-name "main-${target}" \
--runs 10 \
--cargo-target-dir "$CARGO_TARGET_DIR" \
--parse-target "$target"
if [[ -z "$primary_json" ]]; then
primary_json="$result_json"
else
combine_args+=(--additional "$result_json")
fi
done
python3 scripts/dwarf-perf/combine_baselines.py \
--primary "$primary_json" \
"${combine_args[@]}" \
--output "$DWARF_PERF_RESULTS_DIR/main.json"
- name: Restore history state worktree
env:
REPO_URL: https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
run: |
set -euo pipefail
if git ls-remote --exit-code --heads "$REPO_URL" "$DWARF_PERF_HISTORY_BRANCH" >/dev/null 2>&1; then
git clone --depth 1 --branch "$DWARF_PERF_HISTORY_BRANCH" "$REPO_URL" "$DWARF_PERF_SITE_DIR"
else
mkdir -p "$DWARF_PERF_SITE_DIR"
git init "$DWARF_PERF_SITE_DIR"
git -C "$DWARF_PERF_SITE_DIR" checkout -b "$DWARF_PERF_HISTORY_BRANCH"
git -C "$DWARF_PERF_SITE_DIR" remote add origin "$REPO_URL"
fi
- name: Publish history site
run: |
set -euo pipefail
python3 scripts/dwarf-perf/publish_history.py \
--baseline "$DWARF_PERF_RESULTS_DIR/main.json" \
--site-dir "$DWARF_PERF_SITE_DIR" \
--repo "$GITHUB_REPOSITORY" \
--sha "$GITHUB_SHA" \
--ref "$GITHUB_REF_NAME" \
--event "$GITHUB_EVENT_NAME" \
--run-id "$GITHUB_RUN_ID" \
--run-number "$GITHUB_RUN_NUMBER" \
--run-attempt "$GITHUB_RUN_ATTEMPT" \
--run-url "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"
- name: Commit and push history state
run: |
set -euo pipefail
git -C "$DWARF_PERF_SITE_DIR" add .
if git -C "$DWARF_PERF_SITE_DIR" diff --cached --quiet; then
echo "No history changes to persist"
else
git -C "$DWARF_PERF_SITE_DIR" \
-c user.name='github-actions[bot]' \
-c user.email='41898282+github-actions[bot]@users.noreply.github.com' \
commit -m "chore: update dwarf perf history for ${GITHUB_SHA::12}"
git -C "$DWARF_PERF_SITE_DIR" push origin "$DWARF_PERF_HISTORY_BRANCH"
fi
- name: Remove git metadata from published site
run: rm -rf "$DWARF_PERF_SITE_DIR/.git"
- name: Upload GitHub Pages artifact
uses: actions/upload-pages-artifact@v4
with:
path: ${{ github.workspace }}/.tmp/dwarf-perf-site
- name: Publish summary
run: |
cat >> "$GITHUB_STEP_SUMMARY" <<EOF
## DWARF Perf History
- Baseline JSON: \`${DWARF_PERF_RESULTS_DIR}/main.json\`
- History state branch: \`${DWARF_PERF_HISTORY_BRANCH}\`
- Pages base path: ${{ steps.pages.outputs.base_path }}
- Pages deployment: configured through \`GitHub Actions\`
EOF
- name: Upload history artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: dwarf-perf-history-${{ github.run_id }}
path: |
${{ github.workspace }}/.tmp/dwarf-perf-results/*.json
${{ github.workspace }}/.tmp/dwarf-perf-site/**
deploy:
name: Deploy DWARF Perf History
needs: build
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4