Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
DawidNiezgodka committed Oct 1, 2023
1 parent 5fdff77 commit 9cc2157
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 11 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,24 @@ jobs:
- name: checkout the main branch
uses: actions/checkout@v3

- name: checkout the bench_data branch to a given folder
uses: actions/checkout@v3
with:
ref: 'bench_data'
sparse-checkout: |
data.json
sparse-checkout-cone-mode: false
path: 'benchmark_data'
# - name: checkout the bench_data branch to a given folder
# uses: actions/checkout@v3
# with:
# ref: 'bench_data'
# sparse-checkout: |
# data.json
# sparse-checkout-cone-mode: false
# path: 'benchmark_data'

- name: print the content of the file from the bench_data branch
run: cat benchmark_data/data.json
# - name: print the content of the file from the bench_data branch
# run: cat benchmark_data/data.json

- name: evaluate benchmark
uses: ./
with:
current_bench_res_file: ./benchmark_results/curr.json
bench_type: simple
reference: previous
reference: threshold
thresholds: 400,100000,95
comparison_modes: smaller, bigger, range
comparison_margins: 10, 20, 20 # if comp margin -1, then strict comparison
Expand Down
Empty file added benchmark_data/data.json
Empty file.
14 changes: 14 additions & 0 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions src/bench.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const { getCommit } = require('./commit')
const core = require('@actions/core')

const { SimpleMetricResult } = require('./types')
const { CompleteBenchmark } = require('./types')
Expand All @@ -20,6 +21,7 @@ module.exports.createCurrBench = function (config) {

console.log('MetricResults: ' + JSON.stringify(metricResults))
const commit = getCommit()
core.debug('Commit info: ' + JSON.stringify(commit))
return new CompleteBenchmark(
config.benchName,
benchInfo,
Expand Down
8 changes: 8 additions & 0 deletions src/comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ module.exports.createComment = function (
comparisonMargins
)
} else {
core.debug('Creating comment body for comparison with threshold')
commentBody = module.exports.createCommentBodyForComparisonWithThreshold(
currentBenchmark,
thresholdArray,
Expand Down Expand Up @@ -133,6 +134,10 @@ module.exports.createCommentBodyForComparisonWithPrevBench = function (

module.exports.createBenchDataText = function (currentBenchmark) {
const benchInfo = currentBenchmark.benchmarkInfo
core.debug(
'From createBenchDataText: Current benchmark info: ' +
JSON.stringify(benchInfo)
)
const benchDataLines = [
`**Execution time**: ${benchInfo.executionTime}`,
`**Parametrization**:`
Expand Down Expand Up @@ -211,7 +216,10 @@ module.exports.createCommentBodyForComparisonWithThreshold = function (

lines.push('## Benchmark information')

core.debug('Current benchmark: ' + JSON.stringify(currentBenchmark))
const benchDataText = module.exports.createBenchDataText(currentBenchmark)
core.debug('Bench data text: ' + benchDataText)
core.debug('Commit ID:' + currentBenchmark.commitInfo.id)

lines.push(benchDataText)
lines.push('', '', '', '')
Expand Down
3 changes: 3 additions & 0 deletions src/commit.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
const github = require('@actions/github')
const { Commit } = require('./types')
const core = require('@actions/core')

module.exports.getCommit = function () {
core.debug(github.context.payload.author)
if (github.context.payload.head_commit) {
const { head_commit } = github.context.payload
return new Commit(
Expand Down
1 change: 1 addition & 0 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ async function run() {
}

if (config.addComment) {
core.debug("G'nna add comment to a commit")
if (config.reference === 'threshold') {
createComment(
currentBenchmark,
Expand Down

0 comments on commit 9cc2157

Please sign in to comment.