foundry-rs / foundry-toolchain

GitHub action to install Foundry
Apache License 2.0
225 stars 92 forks source link

Feature: Set output for run results for easy historical analysis #50

Open sambacha opened 5 months ago

sambacha commented 5 months ago

Foundry CI Analysis

Tracking metrics for monitoring both foundry regressions and contract development should not be hard.

It is desirable to monitor and track metrics such as:

bundle size
build time
lines of code
number of dependencies (i.e. import statements)
benchmarks
code coverage

Save run results

Something like this (pseudo code for illustration)


function outputResult(runResult: RunResult) {
    const result = normalizeResult(runResult);

    setOutput('success', result.success);

    // Build Related
    setOutput('number_of_contracts_compiled', result.number_of_contracts_compiled);
    setOutput('compiletime_of_contracts_compiled', result.compiletime_of_contracts_compiled);

    // Testing related
    setOutput('number_of_contracts_checked', result.number_of_contracts_checked);
    setOutput('number_of_issues', result.number_of_issues);
    setOutput('number_of_contracts_with_issues', result.files_with_issues.length);
    setOutput('contracts_with_issues', normalizeFiles(result.files_with_issues));
    setOutput('result', result);
}

The build related metrics should be applicable to all repos, as opposed to the testing related, which would ofc require tests (notwithstanding tests that are 'correct').