Make WordPress Core

Changeset 56506


Ignore:
Timestamp:
09/01/2023 05:24:56 PM (16 months ago)
Author:
swissspidy
Message:

Build/Test Tools: Compare results in performance measurement workflow.

This extends the performance test workflow added in [55459] to also run tests against the target branch (if running on a pull request) or the previous commit (if running on trunk).

Those results are then compared with the ones from the current commit, and the difference is displayed as a GitHub Actions workflow summary for convenience.

Props mukesh27, flixos90, desrosj, joemcgill, swissspidy.
Fixes #58358, #58359.
See #56150.

Location:
trunk
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/.github/workflows/performance.yml

    r56402 r56506  
    4545  BASE_TAG: '6.1.1'
    4646  LOCAL_DIR: build
     47  TARGET_REF: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref || '' }}
     48  TARGET_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }}
    4749
    4850jobs:
     
    6668  # - Run performance tests (current commit).
    6769  # - Print performance tests results.
     70  # - Check out target commit (target branch or previous commit).
     71  # - Install npm dependencies.
     72  # - Build WordPress.
     73  # - Run performance tests (previous/target commit).
     74  # - Print target performance tests results.
     75  # - Reset to original commit.
    6876  # - Set the environment to the baseline version.
    6977  # - Run baseline performance tests.
    70   # - Print base line performance tests results.
     78  # - Print baseline performance tests results.
     79  # - Compare results with base.
     80  # - Add workflow summary.
    7181  # - Set the base sha.
    7282  # - Set commit details.
     
    153163
    154164      - name: Print performance tests results
    155         run: "node ./tests/performance/results.js"
     165        run: node ./tests/performance/results.js
     166
     167      - name: Check out target commit (target branch or previous commit)
     168        run: |
     169          if [[ -z "$TARGET_REF" ]]; then
     170            git fetch -n origin $TARGET_SHA
     171          else
     172            git fetch -n origin $TARGET_REF
     173          fi
     174          git reset --hard $TARGET_SHA
     175
     176      - name: Install npm dependencies
     177        run: npm ci
     178
     179      - name: Build WordPress
     180        run: npm run build
     181
     182      - name: Run target performance tests (base/previous commit)
     183        run: npm run test:performance -- --prefix=before
     184
     185      - name: Print target performance tests results
     186        run: node ./tests/performance/results.js --prefix=before
     187
     188      - name: Reset to original commit
     189        run: git reset --hard $GITHUB_SHA
    156190
    157191      - name: Set the environment to the baseline version
     
    163197        run: npm run test:performance -- --prefix=base
    164198
    165       - name: Print base line performance tests results
    166         run: "node ./tests/performance/results.js --prefix=base"
     199      - name: Print baseline performance tests results
     200        run: node ./tests/performance/results.js --prefix=base
     201
     202      - name: Compare results with base
     203        run: node ./tests/performance/compare-results.js ${{ runner.temp }}/summary.md
     204
     205      - name: Add workflow summary
     206        run: cat ${{ runner.temp }}/summary.md >> $GITHUB_STEP_SUMMARY
    167207
    168208      - name: Set the base sha
Note: See TracChangeset for help on using the changeset viewer.