зеркало из https://github.com/microsoft/CCF.git
Restore simpler Bencher setup - run on `main` only (#6220)
This commit is contained in:
Родитель
5eddfe7a85
Коммит
6251861329
|
@ -3,8 +3,7 @@ name: "Bencher: Run Benchmarks"
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: main
|
branches: main
|
||||||
pull_request:
|
workflow_dispatch:
|
||||||
types: [opened, reopened, edited, synchronize]
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
run_benchmarks:
|
run_benchmarks:
|
||||||
|
@ -30,14 +29,14 @@ jobs:
|
||||||
./tests.sh -VV -R historical_query
|
./tests.sh -VV -R historical_query
|
||||||
./tests.sh -VV -R commit_latency
|
./tests.sh -VV -R commit_latency
|
||||||
|
|
||||||
- name: Upload Benchmark Results
|
- uses: bencherdev/bencher@main
|
||||||
uses: actions/upload-artifact@v4
|
- name: Track base branch benchmarks with Bencher
|
||||||
with:
|
run: |
|
||||||
name: BenchmarkResults
|
bencher run \
|
||||||
path: ./build/bencher.json
|
--project ccf \
|
||||||
|
--token '${{ secrets.BENCHER_API_TOKEN }}' \
|
||||||
- name: Upload GitHub Pull Request Event
|
--branch main \
|
||||||
uses: actions/upload-artifact@v4
|
--testbed gha-virtual-ccf-sub \
|
||||||
with:
|
--adapter json \
|
||||||
name: event.json
|
--err \
|
||||||
path: ${{ github.event_path }}
|
--file build/bencher.json
|
|
@ -1,104 +0,0 @@
|
||||||
name: "Bencher: Process Benchmarks"
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_run:
|
|
||||||
workflows: ["Bencher: Run Benchmarks"]
|
|
||||||
types: [completed]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
process_benchmarks:
|
|
||||||
name: Process benchmarks
|
|
||||||
permissions:
|
|
||||||
pull-requests: write
|
|
||||||
if: github.event.workflow_run.conclusion == 'success'
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
env:
|
|
||||||
BENCHMARK_RESULTS_ARTIFACT: BenchmarkResults
|
|
||||||
BENCHMARK_RESULTS_FILE: bencher.json
|
|
||||||
PR_EVENT: event.json
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Download Benchmark Results
|
|
||||||
uses: actions/github-script@v7
|
|
||||||
with:
|
|
||||||
script: |
|
|
||||||
async function downloadArtifact(artifactName) {
|
|
||||||
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 == artifactName
|
|
||||||
})[0];
|
|
||||||
if (!matchArtifact) {
|
|
||||||
core.setFailed(`Failed to find artifact: ${artifactName}`);
|
|
||||||
}
|
|
||||||
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}/${artifactName}.zip`, Buffer.from(download.data));
|
|
||||||
}
|
|
||||||
await downloadArtifact(process.env.BENCHMARK_RESULTS_ARTIFACT);
|
|
||||||
await downloadArtifact(process.env.PR_EVENT);
|
|
||||||
|
|
||||||
- name: Unzip Benchmark Results
|
|
||||||
run: |
|
|
||||||
unzip $BENCHMARK_RESULTS_ARTIFACT.zip
|
|
||||||
unzip $PR_EVENT.zip
|
|
||||||
|
|
||||||
- name: Export PR Event Data
|
|
||||||
id: export
|
|
||||||
uses: actions/github-script@v7
|
|
||||||
with:
|
|
||||||
script: |
|
|
||||||
let fs = require('fs');
|
|
||||||
let prEvent = JSON.parse(fs.readFileSync(process.env.PR_EVENT, {encoding: 'utf8'}));
|
|
||||||
if (prEvent.pull_request === undefined) {
|
|
||||||
core.setOutput("is_pr", false);
|
|
||||||
core.exportVariable("MAIN_HEAD_SHA", prEvent.after);
|
|
||||||
} else {
|
|
||||||
core.setOutput("is_pr", true);
|
|
||||||
core.exportVariable("PR_HEAD", `${prEvent.number}/merge`);
|
|
||||||
core.exportVariable("PR_BASE", prEvent.pull_request.base.ref);
|
|
||||||
core.exportVariable("PR_BASE_SHA", prEvent.pull_request.base.sha);
|
|
||||||
core.exportVariable("PR_HEAD_SHA", prEvent.pull_request.head.sha);
|
|
||||||
core.exportVariable("PR_NUMBER", prEvent.number);
|
|
||||||
}
|
|
||||||
|
|
||||||
- uses: bencherdev/bencher@main
|
|
||||||
|
|
||||||
- name: Track Benchmarks with Bencher
|
|
||||||
run: |
|
|
||||||
if [[ ${{ steps.export.outputs.is_pr }} == "true" ]];
|
|
||||||
then
|
|
||||||
echo "Uploading PR benchmark results";
|
|
||||||
bencher run \
|
|
||||||
--project ccf \
|
|
||||||
--token '${{ secrets.BENCHER_API_TOKEN }}' \
|
|
||||||
--branch '${{ env.PR_HEAD }}' \
|
|
||||||
--branch-start-point '${{ env.PR_BASE }}' \
|
|
||||||
--branch-start-point-hash '${{ env.PR_BASE_SHA }}' \
|
|
||||||
--testbed gha-virtual-ccf-sub \
|
|
||||||
--adapter json \
|
|
||||||
--err \
|
|
||||||
--github-actions '${{ secrets.GITHUB_TOKEN }}' \
|
|
||||||
--ci-number '${{ env.PR_NUMBER }}' \
|
|
||||||
--hash '${{ env.PR_HEAD_SHA }}' \
|
|
||||||
--file "$BENCHMARK_RESULTS_FILE";
|
|
||||||
else
|
|
||||||
echo "Uploading main benchmark results";
|
|
||||||
bencher run \
|
|
||||||
--project ccf \
|
|
||||||
--token '${{ secrets.BENCHER_API_TOKEN }}' \
|
|
||||||
--branch main \
|
|
||||||
--testbed gha-virtual-ccf-sub \
|
|
||||||
--adapter json \
|
|
||||||
--err \
|
|
||||||
--hash '${{ env.MAIN_HEAD_SHA }}' \
|
|
||||||
--file "$BENCHMARK_RESULTS_FILE";
|
|
||||||
fi
|
|
Загрузка…
Ссылка в новой задаче