forked from salesforce/lwc
-
Notifications
You must be signed in to change notification settings - Fork 0
101 lines (88 loc) · 3.71 KB
/
benchmark-release.yml
File metadata and controls
101 lines (88 loc) · 3.71 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
name: Run Performance Benchmarks
on:
push:
branches:
- winter*
- spring*
- summer*
workflow_dispatch:
inputs:
old_version:
description: Old version to compare
type: string
required: true
grep:
description: Tests to focus (regex supported)
type: string
required: false
env:
NODE_VERSION: '24.11.1'
jobs:
run-performance-tests:
# It is important to use this image so that we have a consistent IP address
runs-on: salesforce-Ubuntu
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set old version (manual)
if: github.event_name == 'workflow_dispatch'
run: |
INPUT='${{ inputs.old_version }}'
# Convert branch/tag into commit
COMMIT="$(git ls-remote origin "$INPUT" | cut -f 1)"
if [ -z "$COMMIT" ]; then
# Input is not a branch/tag; check if it's actually a commit
if git cat-file -e "$INPUT^{commit}" >/dev/null; then
COMMIT="$INPUT"
else
echo 'Could not resolve "${{ inputs.old_version }}" to a commit ID'
exit 1
fi
fi
echo "Parsed '$INPUT' to commit $COMMIT."
echo "BENCHMARK_REF=$COMMIT" >> "$GITHUB_ENV"
- name: Set old version (release)
if: github.event_name == 'push'
run: |
# Parse current season and year from branch name
[[ "$GITHUB_REF_NAME" =~ ^(winter|spring|summer)([0-9]+)$ ]]
season="${BASH_REMATCH[1]}"
year="${BASH_REMATCH[2]}"
# Get previous season and year
case $season in
winter) previous="summer$((year - 1))";;
spring) previous="winter$year";;
summer) previous="spring$year";;
esac
# Expose to GitHub Actions
echo "BENCHMARK_REF=$previous" >> "$GITHUB_ENV"
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'yarn'
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Build benchmarks
run: yarn build:performance
- name: Run benchmarks
id: benchmarks
working-directory: ./packages/@lwc/perf-benchmarks
run: |
echo "Running benchmarks for $GITHUB_REF_NAME against $BENCHMARK_REF"
yarn test:run
env:
GREP: ${{ inputs.grep }}
- name: Format results
# Upload successful results, even if some steps failed
if: ${{ steps.benchmarks.outcome == 'success' || steps.benchmarks.outcome == 'failure' }}
working-directory: ./packages/@lwc/perf-benchmarks
run: yarn --silent test:format >> "$GITHUB_STEP_SUMMARY"
- name: Upload unit test coverage report
uses: actions/upload-artifact@v4
with:
name: benchmark-results
path: |
packages/@lwc/perf-benchmarks/dist/__benchmarks__/results.md
packages/@lwc/perf-benchmarks/dist/__benchmarks__/results.html
packages/@lwc/perf-benchmarks/dist/__benchmarks__/**/*.results.json