Skip to content

Commit

Permalink
Merge pull request #3 from NilFoundation/fix_ci
Browse files Browse the repository at this point in the history
Implement CI
  • Loading branch information
AndreyMlashkin authored Sep 5, 2024
2 parents 8242b5e + b0da678 commit 6d9263b
Show file tree
Hide file tree
Showing 23 changed files with 172 additions and 380 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/clang-linux-nix-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Build and Test on Linux Platforms

on:
workflow_call:

jobs:
build-and-test:
name: "Build and test Linux with clang"
runs-on: [self-hosted, Linux, X64, aws_autoscaling]
steps:
# https://github.com/actions/checkout/issues/1552
- name: Clean up after previous checkout
run: chmod +w -R ${GITHUB_WORKSPACE}; rm -rf ${GITHUB_WORKSPACE}/*;

- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Run checks
run: nix build -L .?#checks.x86_64-linux.all-clang
env:
NIX_CONFIG: |
cores = 4
24 changes: 24 additions & 0 deletions .github/workflows/gcc-linux-nix-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Build and Test on Linux Platforms

on:
workflow_call:

jobs:
build-and-test:
name: "Build and test Linux with gcc"
runs-on: [self-hosted, Linux, X64, aws_autoscaling]
steps:
# https://github.com/actions/checkout/issues/1552
- name: Clean up after previous checkout
run: chmod +w -R ${GITHUB_WORKSPACE}; rm -rf ${GITHUB_WORKSPACE}/*;

- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Run checks
run: nix build -L .?#checks.x86_64-linux.all-gcc
env:
NIX_CONFIG: |
cores = 4
31 changes: 31 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: PR Testing

on:
pull_request:
push:
branches:
- master

concurrency:
# In master we want to run for every commit, in other branches — only for the last one
group: ${{
( github.ref == 'refs/heads/master' && format('{0}/{1}/{2}', github.workflow, github.ref, github.sha) )
||
format('{0}/{1}', github.workflow, github.ref) }}
cancel-in-progress: true

jobs:
test-linux-gcc:
name: Linux Crypto3 Testing with gcc
uses: ./.github/workflows/gcc-linux-nix-check.yml
if: |
always() && !cancelled()
secrets: inherit

test-linux-clang:
name: Linux Crypto3 Testing with clang
uses: ./.github/workflows/clang-linux-nix-check.yml
if: |
always() && !cancelled()
secrets: inherit

4 changes: 4 additions & 0 deletions crypto3/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ 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)

if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
set(CMAKE_CXX_FLAGS "-ggdb -O0")
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
12 changes: 4 additions & 8 deletions crypto3/crypto3.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@
ninja,
pkg-config,
cmake,
boost183,
# We'll use boost183 by default, but you can override it
boost_lib ? boost183,
boost,
gdb,
cmake_modules,
enableDebugging,
enableDebug ? true,
enableDebug ? false,
runTests ? false,
}:
let
Expand All @@ -22,17 +20,15 @@ in stdenv.mkDerivation {
nativeBuildInputs = [ cmake ninja pkg-config ] ++ (lib.optional (!stdenv.isDarwin) gdb);

# enableDebugging will keep debug symbols in boost
propagatedBuildInputs = [ (if enableDebug then (enableDebugging boost_lib) else boost_lib) ];
propagatedBuildInputs = [ (if enableDebug then (enableDebugging boost) else boost) ];

buildInputs = [cmake_modules];

cmakeFlags =
[
(if runTests then "-DBUILD_TESTS=TRUE" else "")
(if runTests then "-DCMAKE_ENABLE_TESTS=TRUE" else "")
(if enableDebug then "-DCMAKE_BUILD_TYPE=Debug" else "-DCMAKE_BUILD_TYPE=Release")
(if enableDebug then "-DCMAKE_CXX_FLAGS=-ggdb" else "")
(if enableDebug then "-DCMAKE_CXX_FLAGS=-O0" else "")
"-G Ninja"
];

doCheck = runTests; # tests are inside crypto3-tests derivation
Expand Down
84 changes: 0 additions & 84 deletions crypto3/flake.lock

This file was deleted.

59 changes: 0 additions & 59 deletions crypto3/flake.nix

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

#include <iostream>
#include <fstream>
#include <cstdint>

#include <boost/test/unit_test.hpp>

Expand Down
3 changes: 1 addition & 2 deletions crypto3/libs/blueprint/test/zkevm/opcodes/iszero.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

#include <boost/test/unit_test.hpp>

#include <nil/blueprint/zkevm/zkevm_machine_interface.hpp>
#include <nil/crypto3/algebra/fields/arithmetic_params/goldilocks64.hpp>

#include <nil/blueprint/blueprint/plonk/circuit.hpp>
Expand All @@ -34,8 +35,6 @@
#include <nil/blueprint/zkevm/zkevm_circuit.hpp>
#include "../opcode_tester.hpp"

#include <nil/blueprint/zkevm/operations/iszero.hpp>

using namespace nil::blueprint;
using namespace nil::crypto3::algebra;

Expand Down
5 changes: 3 additions & 2 deletions crypto3/libs/blueprint/test/zkevm/opcodes/mul.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@
#include <nil/blueprint/blueprint/plonk/assignment.hpp>

#include <nil/blueprint/zkevm/zkevm_circuit.hpp>
#include "../opcode_tester.hpp"

#include <nil/blueprint/zkevm/zkevm_operation.hpp>
#include <nil/blueprint/zkevm/operations/mul.hpp>

#include "../opcode_tester.hpp"

using namespace nil::blueprint;
using namespace nil::crypto3::algebra;

Expand Down
13 changes: 7 additions & 6 deletions crypto3/libs/containers/test/merkle/merkle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@

#define BOOST_TEST_MODULE containter_merkletree_test

#include <chrono>
#include <cstdio>
#include <limits>
#include <type_traits>
#include <cstdint>

#include <nil/crypto3/algebra/random_element.hpp>
#include <nil/crypto3/algebra/type_traits.hpp>
#include <nil/crypto3/hash/block_to_field_elements_wrapper.hpp>
Expand All @@ -35,6 +41,7 @@
#include <nil/crypto3/hash/keccak.hpp>
#include <nil/crypto3/hash/pedersen.hpp>
#include <nil/crypto3/hash/poseidon.hpp>
#include <nil/crypto3/hash/algorithm/hash.hpp>

#include <nil/crypto3/container/merkle/tree.hpp>
#include <nil/crypto3/container/merkle/proof.hpp>
Expand All @@ -43,12 +50,6 @@
#include <boost/test/data/test_case.hpp>
#include <boost/test/data/monomorphic.hpp>

#include <chrono>
#include <cstdio>
#include <limits>
#include <type_traits>
#include <nil/crypto3/hash/algorithm/hash.hpp>

using namespace nil::crypto3;
using namespace nil::crypto3::containers;

Expand Down
14 changes: 7 additions & 7 deletions crypto3/libs/hash/test/crc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@

#define BOOST_TEST_MODULE crc_test

#include <nil/crypto3/hash/algorithm/hash.hpp>
#include <iostream>
#include <string>
#include <cassert>
#include <cstdint>
#include <unordered_map>

#include <nil/crypto3/hash/algorithm/hash.hpp>
#include <nil/crypto3/hash/crc.hpp>
#include <nil/crypto3/hash/hash_state.hpp>

Expand All @@ -19,11 +24,6 @@
#include <boost/test/data/test_case.hpp>
#include <boost/test/data/monomorphic.hpp>

#include <iostream>
#include <string>
#include <cassert>
#include <unordered_map>

using namespace nil::crypto3;
using namespace nil::crypto3::hashes;
using namespace nil::crypto3::accumulators;
Expand Down Expand Up @@ -130,4 +130,4 @@ BOOST_AUTO_TEST_CASE(crc_stateful_hash3) {
BOOST_CHECK_EQUAL(d, "a7943e77");
}

BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_SUITE_END()
Loading

0 comments on commit 6d9263b

Please sign in to comment.