-
-
Notifications
You must be signed in to change notification settings - Fork 98
77 lines (70 loc) · 2.93 KB
/
publish-benchmark-results.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: Publish benchmark results
on:
workflow_run:
workflows: [ 'Benchmark' ]
types: [ completed ]
jobs:
push-to-data-repo:
runs-on: ubuntu-latest
if: github.event.workflow_run.conclusion == 'success'
steps:
- name: Download benchmark results from workflow artifacts
uses: actions/github-script@v6.3.3
id: download-results
with:
result-encoding: string
script: |
var artifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{github.event.workflow_run.id }},
});
if (artifacts.data.artifacts.length === 0) {
return 'stop';
}
var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == "benchmark-results"
})[0];
var download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
var fs = require('fs');
fs.writeFileSync('${{github.workspace}}/benchmark-results.zip', Buffer.from(download.data));
return 'continue';
- run: unzip benchmark-results.zip
if: ${{ steps.download-results.outputs.result == 'continue' }}
- name: Set VERSION/B_SHA/B_EVENT env variable
run: |
VERSION=$(cat version)
echo "VERSION=$VERSION" >> $GITHUB_ENV
B_SHA=$(cat sha)
echo "B_SHA=$B_SHA" >> $GITHUB_ENV
B_EVENT=$(cat event)
echo "B_EVENT=$B_EVENT" >> $GITHUB_ENV
if: ${{ steps.download-results.outputs.result == 'continue' }}
- name: Push benchmark file
uses: dmnemec/copy_file_to_another_repo_action@main
env:
API_TOKEN_GITHUB: ${{ secrets.RESULTS_REPO_RW_TOKEN }}
with:
source_file: '${{ env.B_EVENT }}/${{ env.B_SHA }}/${{ env.VERSION }}.json'
destination_folder: '${{ env.B_EVENT }}/${{ env.B_SHA }}'
destination_repo: 'scalalandio/chimney-benchmark-results'
user_email: 'mateusz.kubuszok@gmail.com'
user_name: 'Mateusz Kubuszok'
commit_message: 'Benchmarks for ${{ env.VERSION }} added.'
if: ${{ steps.download-results.outputs.result == 'continue' }}
- name: Push meta file
uses: dmnemec/copy_file_to_another_repo_action@main
env:
API_TOKEN_GITHUB: ${{ secrets.RESULTS_REPO_RW_TOKEN }}
with:
source_file: 'meta.json'
destination_repo: 'scalalandio/chimney-benchmark-results'
user_email: 'mateusz.kubuszok@gmail.com'
user_name: 'Mateusz Kubuszok'
commit_message: 'Meta update for ${{ env.VERSION }}'
if: ${{ steps.download-results.outputs.result == 'continue' }}