/
sdds
/
plasma
Обзор
Документация
Войти
/
sdds
/
plasma
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
dev
.github/workflows/performance-test-pr.yml
175 строк
7 KB
Neretin Artem
ci: Add `plasma-themes` and `core-themes` to workflows
22 окт 2024, 11:11
22 окт 2024, 11:11
f827542
Код
Авторство
О чём код?
# Этот workflow нельзя запускать параллельно. # Весь смысл именно запуска в одной сессии, что бы избежать сильного разброса в результатах. name: Component Performance Testing on: workflow_dispatch: concurrency: # New commit on branch cancels running workflows of the same branch group: ${{ github.workflow }}-${{ github.head_ref }} cancel-in-progress: true jobs: authorize: if: false name: Authorize external pull request uses: ./.github/workflows/authorize-external-pr.yml state: if: false needs: [ authorize ] uses: ./.github/workflows/change-detection.yml with: exclude-dependents: true ref: refs/pull/${{github.event.pull_request.number}}/merge secrets: inherit perftest: needs: [ authorize, state ] runs-on: ubuntu-latest if: false env: PR_NAME: pr-${{ github.event.number }} steps: - name: Install s3cmd run: pip3 install s3cmd - uses: actions/checkout@v4 with: path: current show-progress: false ref: refs/pull/${{github.event.pull_request.number}}/merge - uses: actions/checkout@v4 with: path: baseline show-progress: false ref: ${{ github.event.pull_request.base.ref }} - name: Setup Node.js uses: actions/setup-node@v3 with: node-version-file: 'current/.nvmrc' cache: 'npm' cache-dependency-path: 'current/package-lock.json' - name: Cache node modules id: node_modules_current uses: actions/cache@v3 with: path: current/node_modules key: node-modules-${{ hashFiles('current/package-lock.json') }} restore-keys: | node-modules-${{ hashFiles('current/package-lock.json') }} node-modules- - name: Cache node modules id: node_modules_base uses: actions/cache/restore@v3 with: path: baseline/node_modules key: node-modules-${{ hashFiles('baseline/package-lock.json') }} restore-keys: | node-modules-${{ hashFiles('baseline/package-lock.json') }} node-modules- - name: Cache dependencies id: cache_deps uses: actions/cache@v3 with: path: ~/.cache key: cache-${{ hashFiles('current/package-lock.json') }} restore-keys: | cache-${{ hashFiles('current/package-lock.json') }} cache- - name: Setup packages for PR if: ${{ steps.cache_deps.outputs.cache-hit != 'true' || steps.node_modules_current.outputs.cache-hit != 'true' }} run: | cd current npm ci --no-progress - name: Lerna bootstrap for PR run: | cd current npx lerna bootstrap --scope=@salutejs/plasma-{core,hope,new-hope,themes,web,b2c,asdk,ui,icons} --scope=@salutejs/perftest-helpers - name: Setup packages for ${{ github.event.pull_request.base.ref }} if: ${{ steps.cache_deps.outputs.cache-hit != 'true' || steps.node_modules_base.outputs.cache-hit != 'true' }} run: | cd baseline npm ci --no-progress - name: Lerna bootstrap for ${{ github.event.pull_request.base.ref }} run: | cd baseline npx lerna bootstrap --scope=@salutejs/plasma-{core,hope,new-hope,themes,web,b2c,asdk,ui,icons} --scope=@salutejs/perftest-helpers - name: Restore perftool cache run: > s3cmd --access_key ${{ secrets.AWS_ACCESS_KEY_ID }} --secret_key ${{ secrets.AWS_SECRET_ACCESS_KEY }} --host ${{ secrets.AWS_ENDPOINT }} --host-bucket ${{ secrets.AWS_ENDPOINT }} --bucket-location ${{ secrets.AWS_REGION }} --signature-v2 --no-mime-magic --no-preserve sync s3://${{ secrets.AWS_S3_BUCKET_2 }}/perftool-cache/ ./current/.perftool/cache/ - name: Run performance test run: > cd current && npx perftool --baselineRefDir ../baseline -o perftest/pr-result.json --baselineOutputPath perftest/base-result.json --compareOutputPath perftest/comparison.json --visualReportPath perftest/report.html --baseBranchRef ${{ github.event.pull_request.base.sha }} --currentBranchRef ${{ github.event.pull_request.head.sha }} - name: Save perftool cache run: > s3cmd --access_key ${{ secrets.AWS_ACCESS_KEY_ID }} --secret_key ${{ secrets.AWS_SECRET_ACCESS_KEY }} --host ${{ secrets.AWS_ENDPOINT }} --host-bucket ${{ secrets.AWS_ENDPOINT }} --bucket-location ${{ secrets.AWS_REGION }} --signature-v2 --no-mime-magic --no-preserve sync ./current/.perftool/cache/ s3://${{ secrets.AWS_S3_BUCKET_2 }}/perftool-cache/ - name: Save comparison result if: always() uses: actions/upload-artifact@v2 with: name: Component performance comparison result path: ${{ github.workspace }}/current/perftest/* - name: Write report comment if: always() uses: ./current/actions/perftest-helpers/actions/write-comment with: token: ${{ secrets.GITHUB_TOKEN }} reportPath: ${{ github.workspace }}/current/perftest/comparison.json prId: ${{ github.event.number }} owner: ${{ github.repository_owner }} repo: plasma - name: Send report if: always() uses: ./current/actions/perftest-helpers/actions/send-report with: reportPath: ${{ github.workspace }}/current/perftest/comparison.json commitHash: ${{ github.sha }} subject: packages/plasma referrer: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}