Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re introduce reporting #23

Merged
merged 4 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion .github/workflows/clang-linux-nix-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,19 @@ jobs:
fetch-depth: 0

- name: Run checks
run: nix build -L .?#checks.x86_64-linux.all-clang
run: |
nix build -L .?#checks.x86_64-linux.all-clang
mkdir results
cp result/test-logs/*_test.xml results/
env:
NIX_CONFIG: |
cores = 4

- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action/linux@v2
with:
check_name: "Clang Test Results"
files: "results/*.xml"
comment_mode: ${{ github.event.pull_request.head.repo.fork && 'off' || 'always' }} # Don't create PR comment from fork runs
action_fail_on_inconclusive: true # fail, if no reports

14 changes: 13 additions & 1 deletion .github/workflows/gcc-linux-nix-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,19 @@ jobs:
fetch-depth: 0

- name: Run checks
run: nix build -L .?#checks.x86_64-linux.all-gcc
run: |
nix build -L .?#checks.x86_64-linux.all-gcc
mkdir results
cp result/test-logs/*_test.xml results/
env:
NIX_CONFIG: |
cores = 4

- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action/linux@v2
with:
check_name: "Gcc Test Results"
files: "results/*.xml"
comment_mode: ${{ github.event.pull_request.head.repo.fork && 'off' || 'always' }} # Don't create PR comment from fork runs
action_fail_on_inconclusive: true # fail, if no reports

6 changes: 6 additions & 0 deletions crypto3/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,17 @@ option(Boost_USE_STATIC_LIBS "Use static libraries for Boost" OFF)
option(CMAKE_ENABLE_TESTS "Enable tests" FALSE) # used by CMTest module
option(BUILD_BENCH_TESTS "Build performance benchmark tests" FALSE)
option(BUILD_DOCS "Build with configuring Doxygen documentation compiler" FALSE)
option(SANITIZE "Build sanitizers" FALSE)

if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
set(CMAKE_CXX_FLAGS "-ggdb -O0")
endif()

if(${SANITIZE})
add_compile_options(-fsanitize=undefined,address,leak)
add_link_options(-fsanitize=undefined,address,leak)
endif()

# This is useful due to some build systems (Ninja in particular) are piping
# compiler output and compiler switches it's output to plain text
option (FORCE_COLORED_OUTPUT "Always produce ANSI-colored output (GNU/Clang only)." FALSE)
Expand Down
10 changes: 10 additions & 0 deletions crypto3/crypto3.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
enableDebugging,
enableDebug ? false,
runTests ? false,
sanitize ? false,
}:
let
inherit (lib) optional;
Expand All @@ -28,11 +29,20 @@ in stdenv.mkDerivation {
[
(if runTests then "-DBUILD_TESTS=TRUE" else "-DBUILD_TESTS=False")
(if enableDebug then "-DCMAKE_BUILD_TYPE=Debug" else "-DCMAKE_BUILD_TYPE=Release")
(if sanitize then "-DSANITIZE=ON" else "-DSANITIZE=OFF")
"-G Ninja"
];

doCheck = runTests; # tests are inside crypto3-tests derivation

checkPhase = ''
# JUNIT file without explicit file name is generated after the name of the master test suite inside `CMAKE_CURRENT_SOURCE_DIR`
export BOOST_TEST_LOGGER=JUNIT:HRF
ctest --verbose --output-on-failure -R
mkdir -p ${placeholder "out"}/test-logs
find .. -type f -name '*_test.xml' -exec cp {} ${placeholder "out"}/test-logs \;
'';

shellHook = ''
PS1="\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ "
echo "Welcome to Crypto3 development environment!"
Expand Down
15 changes: 15 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@
enableDebug = true;
runTests = true;
});
crypto3-sanitize = (pkgs.callPackage ./crypto3/crypto3.nix {
enableDebug = true;
runTests = true;
sanitize = true;
});

parallel-crypto3 = (pkgs.callPackage ./parallel-crypto3/parallel-crypto3.nix {
runTests = false;
Expand Down Expand Up @@ -145,6 +150,12 @@
runTests = true;
enableDebug = false;
});
crypto3-clang-sanitize = (pkgs.callPackage ./crypto3/crypto3.nix {
stdenv = pkgs.llvmPackages_18.stdenv;
runTests = true;
enableDebug = false;
sanitize = true;
});

parallel-crypto3-gcc = (pkgs.callPackage ./parallel-crypto3/parallel-crypto3.nix {
runTests = true;
Expand Down Expand Up @@ -209,6 +220,10 @@
name = "all";
paths = [ crypto3-clang parallel-crypto3-clang evm-assigner-clang transpiler-clang proof-producer-clang ];
};
all-sanitizers = pkgs.symlinkJoin {
name = "all";
paths = [ crypto3-clang-sanitize ];
};
all-gcc = pkgs.symlinkJoin {
name = "all";
paths = [ crypto3-gcc parallel-crypto3-gcc evm-assigner-gcc zkevm-framework-gcc transpiler-gcc proof-producer-gcc ];
Expand Down
Loading