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

Implement CI #3

Merged
merged 4 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
24 changes: 24 additions & 0 deletions .github/workflows/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"
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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why only build without check?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two chains to build now - gcc and clang.
It would take too long to build all. I would prefer to start 2 different jobs, so the CI will run faster

env:
NIX_CONFIG: |
cores = 4
24 changes: 24 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
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:
name: Linux Crypto3 Testing
uses: ./.github/workflows/linux-nix-check.yml
if: |
always() && !cancelled()
secrets: inherit

9 changes: 4 additions & 5 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,7 +20,7 @@ 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];

Expand All @@ -33,6 +31,7 @@ in stdenv.mkDerivation {
(if enableDebug then "-DCMAKE_BUILD_TYPE=Debug" else "-DCMAKE_BUILD_TYPE=Release")
(if enableDebug then "-DCMAKE_CXX_FLAGS=-ggdb" else "")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's keep CXX flags in CMake (like in zkEVMFramework)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

(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()
14 changes: 7 additions & 7 deletions crypto3/libs/hash/test/tiger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@

#define BOOST_TEST_MODULE tiger_test

#include <iostream>
#include <string>
#include <unordered_map>
#include <cstdio>
#include <cstdint>

#include <nil/crypto3/hash/algorithm/hash.hpp>
#include <nil/crypto3/hash/adaptor/hashed.hpp>

Expand All @@ -39,12 +45,6 @@

#include <boost/static_assert.hpp>

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

#include <cstdio>

using namespace nil::crypto3;
using namespace nil::crypto3::accumulators;

Expand Down Expand Up @@ -155,4 +155,4 @@ BOOST_AUTO_TEST_CASE(tiger_iterator_hash7) {
BOOST_CHECK_EQUAL("1c14795529fd9f207a958f84c52f11e887fa0cabdfd91bfd", out);
}

BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_SUITE_END()
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <boost/random/uniform_int.hpp>
#include <iostream>
#include <iomanip>
#include <cstdint>

#include <nil/marshalling/status_type.hpp>
#include <nil/marshalling/endianness.hpp>
Expand Down
1 change: 1 addition & 0 deletions crypto3/libs/random/test/rfc6979.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <sstream>
#include <cstdlib>
#include <ctime>
#include <cstdint>

#include <boost/test/unit_test.hpp>

Expand Down
Loading
Loading