diff --git a/.circleci/config.yml b/.circleci/config.yml index 82c221e..06d7245 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -167,6 +167,21 @@ jobs: - maven_command_with_cache: command: mvn deploy + benchmark: + executor: main_exe + steps: + - maven_command_with_cache: + command: mvn package + - run: + name: Run benchmarks + command: sh scriptTime.sh + - run: + command: | + mkdir -p benchmark + mv benchmark_report benchmark/ + - store_artifacts: + path: benchmark + destination: benchmark workflows: main_flow: jobs: @@ -189,4 +204,14 @@ workflows: only: - master requires: - - package \ No newline at end of file + - package + master-scheduled-benchmark: + triggers: + - schedule: + cron: "0 12 * * *" + filters: + branches: + only: + - master + jobs: + - benchmark \ No newline at end of file diff --git a/scriptBench.sh b/scriptBench.sh new file mode 100644 index 0000000..3c0c28b --- /dev/null +++ b/scriptBench.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +echo "Benchmark report" >> benchmark_report +echo "--------------------" >> benchmark_report +i="0" +total=0 +while [ $i -lt 5 ] +do + start=`date +%s` + mvn test --quiet + end=`date +%s` + runtime=$((end-start)) + total=$((total+runtime)) + i=$(($i + 1)) + echo " - Time spent job $i: $runtime" >> benchmark_report +done + +mean=$((total/5)) +echo "--------------------" >> benchmark_report +echo "Total time spent ($i jobs): $total" >> benchmark_report +echo "Time spent per job: $mean" >> benchmark_report +echo "--------------------" >> benchmark_report \ No newline at end of file