mirror of
https://github.com/discordeno/discordeno.git
synced 2026-05-21 02:40:08 +00:00
Remove benchmarks page & package (#4479)
* Remove benchmarks package and page * Remove benchmarks CI
This commit is contained in:
107
.github/workflows/benchmark.yml
vendored
107
.github/workflows/benchmark.yml
vendored
@@ -1,107 +0,0 @@
|
||||
name: Benchmark
|
||||
permissions:
|
||||
contents: write
|
||||
deployments: write
|
||||
actions: write
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
sha:
|
||||
required: true
|
||||
type: string
|
||||
repo:
|
||||
required: true
|
||||
type: string
|
||||
outputs:
|
||||
cpuMatch:
|
||||
value: ${{ jobs.benchmark.outputs.cpuMatch }}
|
||||
|
||||
jobs:
|
||||
benchmark:
|
||||
name: Benchmark
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
cpuMatch: ${{ steps.cpuCheck.outputs.match }}
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version: 20
|
||||
- name: Check cpu model
|
||||
id: cpuCheck
|
||||
run: node ./scripts/checkCpuModel.js
|
||||
|
||||
- name: Get yarn cache directory path
|
||||
if: ${{ steps.cpuCheck.outputs.match == 'true' }}
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
|
||||
- uses: actions/cache@v4
|
||||
if: ${{ steps.cpuCheck.outputs.match == 'true' }}
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-
|
||||
- run: yarn install --immutable
|
||||
if: ${{ steps.cpuCheck.outputs.match == 'true' }}
|
||||
- name: Build
|
||||
if: ${{ steps.cpuCheck.outputs.match == 'true' }}
|
||||
run: yarn build
|
||||
|
||||
#
|
||||
- name: Download db from benchmark repo
|
||||
if: ${{ steps.cpuCheck.outputs.match == 'true' }}
|
||||
run: wget https://github.com/discordeno/benchmarks/raw/main/db.tar.gz
|
||||
- name: Decompress db
|
||||
if: ${{ steps.cpuCheck.outputs.match == 'true' }}
|
||||
run: tar -xzvf db.tar.gz
|
||||
|
||||
- name: Benchmark
|
||||
if: ${{ steps.cpuCheck.outputs.match == 'true' }}
|
||||
run: node --expose-gc ./packages/benchmarks/dist/index.js | tee output.txt
|
||||
|
||||
- name: Download previous benchmark data
|
||||
if: ${{ steps.cpuCheck.outputs.match == 'true' }}
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ./benchmarksResult
|
||||
key: ${{ github.ref }}-benchmark-${{ github.sha }}
|
||||
restore-keys: |
|
||||
${{ github.ref }}-benchmark-
|
||||
- name: Store benchmark result to cache
|
||||
if: ${{ steps.cpuCheck.outputs.match == 'true' }}
|
||||
uses: benchmark-action/github-action-benchmark@v1
|
||||
with:
|
||||
tool: 'benchmarkjs'
|
||||
output-file-path: output.txt
|
||||
external-data-json-path: benchmarksResult/data.json
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: ${{ steps.cpuCheck.outputs.match == 'true' }}
|
||||
with:
|
||||
name: benchmarkResults
|
||||
path: benchmarksResult/data.json
|
||||
- name: Save Commmit SHA
|
||||
if: ${{ steps.cpuCheck.outputs.match == 'true' }}
|
||||
run: |
|
||||
mkdir -p ./commitData
|
||||
echo ${{ inputs.sha }} > ./commitData/sha
|
||||
echo ${{ inputs.repo }} > ./commitData/repo
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: ${{ steps.cpuCheck.outputs.match == 'true' }}
|
||||
with:
|
||||
name: commitData
|
||||
path: commitData/
|
||||
|
||||
- name: remove changes
|
||||
run: git reset --hard HEAD
|
||||
- name: Store benchmark result (Main)
|
||||
uses: benchmark-action/github-action-benchmark@v1
|
||||
if: ${{ github.ref == 'refs/heads/main' && steps.cpuCheck.outputs.match == 'true' }}
|
||||
with:
|
||||
tool: 'benchmarkjs'
|
||||
output-file-path: output.txt
|
||||
gh-pages-branch: 'benchies'
|
||||
benchmark-data-dir-path: benchmarksResult
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
auto-push: true
|
||||
114
.github/workflows/commentBenchResult.yml
vendored
114
.github/workflows/commentBenchResult.yml
vendored
@@ -1,114 +0,0 @@
|
||||
name: Comment Benchmark Result
|
||||
permissions:
|
||||
contents: read
|
||||
actions: read
|
||||
pull-requests: write
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: [Benchmark with retry]
|
||||
types:
|
||||
- completed
|
||||
|
||||
jobs:
|
||||
comment-benchmark-result:
|
||||
name: Comment Benchmark Result
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: denoland/setup-deno@main
|
||||
with:
|
||||
deno-version: v1.x
|
||||
- name: Download Commit Data Artifact
|
||||
uses: actions/github-script@v8
|
||||
with:
|
||||
script: |
|
||||
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
run_id: context.payload.workflow_run.id,
|
||||
});
|
||||
let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {
|
||||
return artifact.name == "commitData"
|
||||
})[0];
|
||||
let download = await github.rest.actions.downloadArtifact({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
artifact_id: matchArtifact.id,
|
||||
archive_format: 'zip',
|
||||
});
|
||||
let fs = require('fs');
|
||||
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/commitData.zip`, Buffer.from(download.data));
|
||||
|
||||
- name: Unzip Commit Data Artifact
|
||||
run: unzip commitData.zip
|
||||
|
||||
- name: Download Result Artifact
|
||||
uses: actions/github-script@v8
|
||||
with:
|
||||
script: |
|
||||
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
run_id: context.payload.workflow_run.id,
|
||||
});
|
||||
let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {
|
||||
return artifact.name == "benchmarkResults"
|
||||
})[0];
|
||||
let download = await github.rest.actions.downloadArtifact({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
artifact_id: matchArtifact.id,
|
||||
archive_format: 'zip',
|
||||
});
|
||||
let fs = require('fs');
|
||||
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/benchmarkResults.zip`, Buffer.from(download.data));
|
||||
|
||||
- name: Unzip Result Artifact
|
||||
run: unzip benchmarkResults.zip
|
||||
|
||||
- name: Generate Message
|
||||
id: genMessage
|
||||
run: |
|
||||
MESSAGE=$(deno run -A scripts/generateMessage.js)
|
||||
echo "MESSAGE<<EOF" >> $GITHUB_ENV
|
||||
echo "$MESSAGE" >> $GITHUB_ENV
|
||||
echo "EOF" >> $GITHUB_ENV
|
||||
|
||||
- name: 'Comment on PR'
|
||||
uses: actions/github-script@v8
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
script: |
|
||||
const fs = require('fs');
|
||||
const commit_sha = fs.readFileSync('./sha', 'utf-8');
|
||||
const repo = fs.readFileSync('./repo', 'utf-8');
|
||||
if (repo.split('/')[1] === undefined) process.exit(0)
|
||||
const pr = await github.rest.repos.listPullRequestsAssociatedWithCommit({
|
||||
commit_sha: commit_sha.slice(0,-1),
|
||||
owner: repo.split('/')[0],
|
||||
repo: repo.split('/')[1].slice(0,-1),
|
||||
});
|
||||
if (pr.data[0]) {
|
||||
const comments = await github.rest.issues.listComments({
|
||||
owner: "discordeno",
|
||||
repo: "discordeno",
|
||||
issue_number: pr.data[0].number,
|
||||
})
|
||||
const oldComment = comments.data.find((comment) => comment.body.includes('benchmark comment by ci'))
|
||||
if(!oldComment) {
|
||||
github.rest.issues.createComment({
|
||||
issue_number: pr.data[0].number,
|
||||
owner: "discordeno",
|
||||
repo: "discordeno",
|
||||
body: `${{ env.MESSAGE }}`
|
||||
})
|
||||
} else {
|
||||
github.rest.issues.updateComment({
|
||||
owner: "discordeno",
|
||||
repo: "discordeno",
|
||||
comment_id: oldComment.id,
|
||||
body: `${{ env.MESSAGE }}`
|
||||
});
|
||||
}
|
||||
}
|
||||
91
.github/workflows/retryBenchmark.yml
vendored
91
.github/workflows/retryBenchmark.yml
vendored
@@ -1,91 +0,0 @@
|
||||
name: Benchmark with retry
|
||||
permissions:
|
||||
contents: read
|
||||
on:
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- 'website/**'
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths-ignore:
|
||||
- 'website/**'
|
||||
|
||||
jobs:
|
||||
benchmark-try-1:
|
||||
uses: ./.github/workflows/benchmark.yml
|
||||
with:
|
||||
sha: ${{ github.event.pull_request.head.sha }}
|
||||
repo: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
|
||||
benchmark-try-2:
|
||||
needs: benchmark-try-1
|
||||
if: ${{ needs.benchmark-try-1.outputs.cpuMatch == 'false' }}
|
||||
uses: ./.github/workflows/benchmark.yml
|
||||
with:
|
||||
sha: ${{ github.event.pull_request.head.sha }}
|
||||
repo: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
|
||||
benchmark-try-3:
|
||||
needs: benchmark-try-2
|
||||
if: ${{ needs.benchmark-try-2.outputs.cpuMatch == 'false' }}
|
||||
uses: ./.github/workflows/benchmark.yml
|
||||
with:
|
||||
sha: ${{ github.event.pull_request.head.sha }}
|
||||
repo: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
|
||||
benchmark-try-4:
|
||||
needs: benchmark-try-3
|
||||
if: ${{ needs.benchmark-try-3.outputs.cpuMatch == 'false' }}
|
||||
uses: ./.github/workflows/benchmark.yml
|
||||
with:
|
||||
sha: ${{ github.event.pull_request.head.sha }}
|
||||
repo: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
|
||||
benchmark-try-5:
|
||||
needs: benchmark-try-4
|
||||
if: ${{ needs.benchmark-try-4.outputs.cpuMatch == 'false' }}
|
||||
uses: ./.github/workflows/benchmark.yml
|
||||
with:
|
||||
sha: ${{ github.event.pull_request.head.sha }}
|
||||
repo: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
|
||||
benchmark-try-6:
|
||||
needs: benchmark-try-5
|
||||
if: ${{ needs.benchmark-try-5.outputs.cpuMatch == 'false' }}
|
||||
uses: ./.github/workflows/benchmark.yml
|
||||
with:
|
||||
sha: ${{ github.event.pull_request.head.sha }}
|
||||
repo: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
|
||||
benchmark-try-7:
|
||||
needs: benchmark-try-6
|
||||
if: ${{ needs.benchmark-try-6.outputs.cpuMatch == 'false' }}
|
||||
uses: ./.github/workflows/benchmark.yml
|
||||
with:
|
||||
sha: ${{ github.event.pull_request.head.sha }}
|
||||
repo: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
|
||||
benchmark-try-8:
|
||||
needs: benchmark-try-7
|
||||
if: ${{ needs.benchmark-try-7.outputs.cpuMatch == 'false' }}
|
||||
uses: ./.github/workflows/benchmark.yml
|
||||
with:
|
||||
sha: ${{ github.event.pull_request.head.sha }}
|
||||
repo: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
|
||||
benchmark-try-9:
|
||||
needs: benchmark-try-8
|
||||
if: ${{ needs.benchmark-try-8.outputs.cpuMatch == 'false' }}
|
||||
uses: ./.github/workflows/benchmark.yml
|
||||
with:
|
||||
sha: ${{ github.event.pull_request.head.sha }}
|
||||
repo: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
|
||||
benchmark-try-10:
|
||||
needs: benchmark-try-9
|
||||
if: ${{ needs.benchmark-try-9.outputs.cpuMatch == 'false' }}
|
||||
uses: ./.github/workflows/benchmark.yml
|
||||
with:
|
||||
sha: ${{ github.event.pull_request.head.sha }}
|
||||
repo: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
Reference in New Issue
Block a user