|
| 1 | +name: Run Performance Benchmarks |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - winter* |
| 7 | + - spring* |
| 8 | + - summer* |
| 9 | + |
| 10 | +jobs: |
| 11 | + run-performance-tests: |
| 12 | + # It is important to use this image so that we have a consistent IP address |
| 13 | + runs-on: salesforce-Ubuntu |
| 14 | + steps: |
| 15 | + - name: Checkout repository |
| 16 | + uses: actions/checkout@v4 |
| 17 | + |
| 18 | + - name: Setup Node |
| 19 | + uses: actions/setup-node@v4 |
| 20 | + with: |
| 21 | + node-version: '20.18.1' |
| 22 | + cache: 'yarn' |
| 23 | + |
| 24 | + - name: Install dependencies |
| 25 | + run: yarn install --frozen-lockfile |
| 26 | + |
| 27 | + - name: Get Previous Release |
| 28 | + id: previous_release |
| 29 | + run: | |
| 30 | + # Parse current season and year from branch name |
| 31 | + [[ "$GITHUB_REF_NAME" =~ ^(winter|spring|summer)([0-9]+)$ ]] |
| 32 | + season="${BASH_REMATCH[1]}" |
| 33 | + year="${BASH_REMATCH[2]}" |
| 34 | +
|
| 35 | + # Get previous season and year |
| 36 | + case $season in |
| 37 | + winter) previous="summer$((year - 1))";; |
| 38 | + spring) previous="winter$year";; |
| 39 | + summer) previous="spring$year";; |
| 40 | + esac |
| 41 | + # Expose to GitHub Actions |
| 42 | + echo "branch=$previous" >> "$GITHUB_OUTPUT" |
| 43 | +
|
| 44 | + - name: Build benchmarks |
| 45 | + env: |
| 46 | + BENCHMARK_REF: ${{steps.previous_release.outputs.branch}} |
| 47 | + run: yarn build:performance |
| 48 | + |
| 49 | + - name: Run benchmarks |
| 50 | + working-directory: ./packages/@lwc/perf-benchmarks |
| 51 | + env: |
| 52 | + BENCHMARK_REF: ${{steps.previous_release.outputs.branch}} |
| 53 | + run: | |
| 54 | + echo "Running benchmarks for $GITHUB_REF_NAME against $BENCHMARK_REF" |
| 55 | + yarn test:run |
| 56 | +
|
| 57 | + - name: Format results |
| 58 | + working-directory: ./packages/@lwc/perf-benchmarks |
| 59 | + run: yarn --silent test:format >> "$GITHUB_STEP_SUMMARY" |
0 commit comments