-
Notifications
You must be signed in to change notification settings - Fork 5
163 lines (140 loc) · 5.47 KB
/
benchmarks.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
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
name: benchmarks
on:
workflow_dispatch:
pull_request:
schedule:
- cron: '0 */8 * * *' # Run workflow threee times a day
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_MULTILEVEL_LOOKUP: 0
jobs:
benchmarks_windows:
strategy:
matrix:
test_script: [NuGetClient-win-2a15947]
fail-fast: false
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: code
- name: Benchmark
shell: pwsh
run: |
.\code\scripts\perftests\testCases\${{matrix.test_script}}.ps1
Rename-Item -Path "results.csv" -NewName "${{matrix.test_script}}.csv"
- name: Upload benchmark results
uses: actions/upload-artifact@v4
with:
name: ${{matrix.test_script}}
path: ${{matrix.test_script}}.csv
benchmarks_linux:
strategy:
matrix:
test_script: [LargeAppCPM64-142722b, LargeAppCPM64-nostaticgraph-142722b, OrchardCore-5dbd92c, Orleans-eda972a]
fail-fast: false
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: code
- name: Benchmark
shell: pwsh
run: |
.\code\scripts\perftests\testCases\${{matrix.test_script}}.ps1
Rename-Item -Path "results.csv" -NewName "${{matrix.test_script}}.csv"
- name: Upload benchmark results
uses: actions/upload-artifact@v4
with:
name: ${{matrix.test_script}}
path: ${{matrix.test_script}}.csv
process_data:
# Only run on main repository
# Scheduled workflows do not have information about fork status, hence the hardcoded check
if: always() && github.repository == 'G-Research/NuPerfMonitor' && github.ref == 'refs/heads/main'
environment: updater
runs-on: ubuntu-latest
needs: [benchmarks_windows, benchmarks_linux]
steps:
- name: Install Step CLI
env:
VERSION: 0.19.0
run: |
curl -sLO https://github.com/smallstep/cli/releases/download/v${VERSION}/step-cli_${VERSION}_amd64.deb
sudo dpkg -i step-cli_${VERSION}_amd64.deb
rm step-cli_${VERSION}_amd64.deb
- name: Create access token
id: token
env:
APP_ID: ${{ secrets.APP_ID }}
APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }}
run: |
jwt=$(step crypto jwt sign --key /dev/fd/3 --issuer $APP_ID --expiration $(date -d +5min +%s) --subtle 3<<< $APP_PRIVATE_KEY)
installation_id=$(curl -s -H "Accept: application/vnd.github.v3+json" -H "Authorization: Bearer $jwt" https://api.github.com/app/installations | jq '.[] | select(.account.login == "${{ github.repository_owner }}") | .id')
token=$(curl -s -X POST -H "Accept: application/vnd.github.v3+json" -H "Authorization: Bearer $jwt" https://api.github.com/app/installations/$installation_id/access_tokens | jq -r '.token')
echo "::add-mask::$token"
echo "token=$token" >> $GITHUB_OUTPUT
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ steps.token.outputs.token }}
- uses: actions/setup-python@v5
with:
python-version: "3.8"
- name: Install dependencies
run: pip3 install -r requirements.txt
- uses: actions/download-artifact@v4
with:
path: artifacts
- name: Process data
shell: pwsh
run: |
Get-ChildItem -File -Path artifacts -Depth 1 | Foreach {. python3 process_results.py $_.fullname data.csv}
- name: Generate graph with Plotly for Python
if: ${{ false }}
shell: pwsh
run: |
. python3 generate_html.py data.csv index-python.html
- name: Get alerts
id: alerts
run: |
python3 generate_alert.py data.csv active_regressions.txt
if test -f "active_regressions.txt"; then
echo "file_exists=true" >> $GITHUB_OUTPUT
echo "file_content='$file_content'" >> $GITHUB_OUTPUT
fi
- name: Create new issue if necessary
if: steps.alerts.outputs.file_exists == 'true'
run: |
numOpenIssues="$(gh api graphql -F owner=$OWNER -F name=$REPO -f query='
query($name: String!, $owner: String!) {
repository(owner: $owner, name: $name) {
issues(states:OPEN, filterBy: { labels: ["active_regression"]}){
totalCount
}
}
}
' --jq '.data.repository.issues.totalCount')"
if [ $numOpenIssues -eq 0 ]; then
echo "Creating new issue"
gh issue create --title "Active NuGet restore regression" --label "active_regression" --body "\`\`\` $(cat active_regressions.txt) \`\`\`" --repo $GITHUB_REPOSITORY
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OWNER: ${{ github.repository_owner }}
REPO: ${{ github.event.repository.name }}
- uses: stefanzweifel/git-auto-commit-action@v5
with:
file_pattern: 'data.csv'
commit_author: 'github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>'
- name: Upload data
if: steps.alerts.outputs.file_exists == 'true'
uses: actions/upload-artifact@v4
with:
name: active_regressions
path: |
data.csv
active_regressions.txt