Skip to content

Commit

Permalink
feat(ci): Initial compilation report on test_programs (#6731)
Browse files Browse the repository at this point in the history
  • Loading branch information
vezenovm authored Dec 9, 2024
1 parent 56cfbe6 commit b3c04f0
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 1 deletion.
48 changes: 47 additions & 1 deletion .github/workflows/reports.yml
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ jobs:
- name: Parse memory report
id: memory_report
uses: noir-lang/noir-bench-report@ccb0d806a91d3bd86dba0ba3d580a814eed5673c
uses: noir-lang/noir-bench-report@0d7464a8c39170523932d7846b6e6b458a294aea
with:
report: memory_report.json
header: |
Expand All @@ -233,3 +233,49 @@ jobs:
with:
header: memory
message: ${{ steps.memory_report.outputs.markdown }}

generate_compilation_report:
name: Compilation time
needs: [build-nargo]
runs-on: ubuntu-latest
permissions:
pull-requests: write

steps:
- uses: actions/checkout@v4

- name: Download nargo binary
uses: actions/download-artifact@v4
with:
name: nargo
path: ./nargo

- name: Set nargo on PATH
run: |
nargo_binary="${{ github.workspace }}/nargo/nargo"
chmod +x $nargo_binary
echo "$(dirname $nargo_binary)" >> $GITHUB_PATH
export PATH="$PATH:$(dirname $nargo_binary)"
nargo -V
- name: Generate Compilation report
working-directory: ./test_programs
run: |
./compilation_report.sh
mv compilation_report.json ../compilation_report.json
- name: Parse compilation report
id: compilation_report
uses: noir-lang/noir-bench-report@0d7464a8c39170523932d7846b6e6b458a294aea
with:
report: compilation_report.json
header: |
# Compilation Report
memory_report: false

- name: Add memory report to sticky comment
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
uses: marocchino/sticky-pull-request-comment@v2
with:
header: compilation
message: ${{ steps.compilation_report.outputs.markdown }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ tooling/noir_js/lib
gates_report.json
gates_report_brillig.json
gates_report_brillig_execution.json
compilation_report.json

# Github Actions scratch space
# This gives a location to download artifacts into the repository in CI without making git dirty.
Expand Down
39 changes: 39 additions & 0 deletions test_programs/compilation_report.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
set -e

current_dir=$(pwd)
base_path="$current_dir/execution_success"
test_dirs=$(ls $base_path)

# Tests to be profiled for compilation report
tests_to_profile=("sha256_regression" "regression_4709" "ram_blowup_regression")
echo "{\"compilation_reports\": [ " > $current_dir/compilation_report.json

ITER="1"
NUM_ARTIFACTS=${#tests_to_profile[@]}

for dir in ${tests_to_profile[@]}; do
if [[ " ${excluded_dirs[@]} " =~ " ${dir} " ]]; then
continue
fi

if [[ ${CI-false} = "true" ]] && [[ " ${ci_excluded_dirs[@]} " =~ " ${dir} " ]]; then
continue
fi

cd $base_path/$dir

COMPILE_TIME=$((time nargo compile --force) 2>&1 | grep real | grep -oE '[0-9]+m[0-9]+.[0-9]+s')
echo -e " {\n \"artifact_name\":\"$dir\",\n \"time\":\"$COMPILE_TIME\"\n" >> $current_dir/compilation_report.json
if (($ITER == $NUM_ARTIFACTS)); then
echo "}" >> $current_dir/compilation_report.json
else
echo "}, " >> $current_dir/compilation_report.json
fi

ITER=$(( $ITER + 1 ))
done

echo "]}" >> $current_dir/compilation_report.json

0 comments on commit b3c04f0

Please sign in to comment.