[TEST] Breaking performance tests #895
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Performance tests | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
# Abort if new commit since then | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
perf-tests: | |
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-performance-checks') }} | |
runs-on: [ubuntu-latest] | |
permissions: | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v2 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: "npm" | |
# needed for integration & memory tests codecs support | |
- run: echo "${{ contains(github.event.pull_request.labels.*.name, 'skip-performance-checks') }}" | |
- run: echo "${{ contains(github.event.pull_request.labels.*.name, 'totoleheros') }}" | |
- run: echo "${{ !contains(github.event.pull_request.labels.*.name, 'skip-performance-checks') }}" | |
- run: echo "${{ !contains(github.event.pull_request.labels.*.name, 'totoleheros') }}" | |
- run: echo "${{ toJson(github.event.issue.labels) }}" | |
- run: echo "toto" | |
- run: echo "${{ toJson(github.event.issue.labels.*.name) }}" | |
- run: | |
sudo add-apt-repository multiverse && sudo apt update && sudo apt install -y | |
ubuntu-restricted-extras | |
- run: npm ci | |
- run: export DISPLAY=:99 | |
- run: sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & # optional | |
- run: | |
node tests/performance/run.mjs --branch $GITHUB_BASE_REF --remote-git-url | |
https://github.com/canalplus/rx-player.git --report perf-report.md | |
- name: Post comment | |
if: always() | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const { readFileSync, existsSync } = require('fs'); | |
if (!existsSync("./perf-report.md")) { | |
return; | |
} | |
const fileContent = readFileSync("./perf-report.md").toString(); | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
// TODO: generate comment header inside the report file instead of here for better portability? | |
// We should already have access to the sha1 through `git` and the destination branch through the command line arguments. | |
body: "Automated performance checks have been performed on commit " + | |
"\`${{github.event.pull_request.head.sha}}\` with the base branch \`${{github.base_ref}}\`.\n\n" + | |
fileContent + | |
"\n\n If you want to skip performance checks for latter commits, add the `skip-performance-checks` label to this Pull Request.", | |
}) |