From 0e0bc446517124150bfd95b71763c3624328cd98 Mon Sep 17 00:00:00 2001 From: Peter Conrad Date: Mon, 18 Nov 2019 11:33:29 +0100 Subject: [PATCH 1/7] Added initial workflow --- .github/workflows/build-and-test.yml | 60 ++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 .github/workflows/build-and-test.yml diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml new file mode 100644 index 0000000..9639aea --- /dev/null +++ b/.github/workflows/build-and-test.yml @@ -0,0 +1,60 @@ +on: [ push, pull_request ] +jobs: + test-release: + name: Build and run tests in Release mode + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + with: + submodules: recursive + - name: Configure + run: | + mkdir -p _build + pushd _build + cmake -D CMAKE_BUILD_TYPE=Release \ + -D CMAKE_CXX_OUTPUT_EXTENSION_REPLACE=ON \ + -D CMAKE_C_COMPILER=gcc \ + -D CMAKE_CXX_COMPILER=g++ \ + .. + popd + - name: Build + run: | + make -C _build + - name: Test + run: | + pushd _build + tests/all_tests + tests/bloom_test ../README.md + tests/ecc_test ../README.md + tests/hmac_test + tests/task_cancel_test + popd + test-debug: + name: Build and run tests in Debug mode + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + with: + submodules: recursive + - name: Configure + run: | + mkdir -p _build + pushd _build + cmake -D CMAKE_BUILD_TYPE=Debug \ + -D CMAKE_CXX_OUTPUT_EXTENSION_REPLACE=ON \ + -D CMAKE_C_COMPILER=gcc \ + -D CMAKE_CXX_COMPILER=g++ \ + .. + popd + - name: Build + run: | + make -C _build + - name: Test + run: | + pushd _build + tests/all_tests + tests/bloom_test ../README.md + tests/ecc_test ../README.md + tests/hmac_test + tests/task_cancel_test + popd From 453345cedf87b655f853590d5870d209f02b9528 Mon Sep 17 00:00:00 2001 From: Peter Conrad Date: Mon, 18 Nov 2019 11:40:49 +0100 Subject: [PATCH 2/7] Install boost --- .github/workflows/build-and-test.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 9639aea..889fede 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -4,6 +4,20 @@ jobs: name: Build and run tests in Release mode runs-on: ubuntu-latest steps: + - name: Install dependencies + run: | + sudo apt-get install -y \ + libboost-thread-dev \ + libboost-iostreams-dev \ + libboost-date-time-dev \ + libboost-system-dev \ + libboost-filesystem-dev \ + libboost-program-options-dev \ + libboost-chrono-dev \ + libboost-test-dev \ + libboost-context-dev \ + libboost-regex-dev \ + libboost-coroutine-dev - uses: actions/checkout@v1 with: submodules: recursive @@ -33,6 +47,20 @@ jobs: name: Build and run tests in Debug mode runs-on: ubuntu-latest steps: + - name: Install dependencies + run: | + sudo apt-get install -y \ + libboost-thread-dev \ + libboost-iostreams-dev \ + libboost-date-time-dev \ + libboost-system-dev \ + libboost-filesystem-dev \ + libboost-program-options-dev \ + libboost-chrono-dev \ + libboost-test-dev \ + libboost-context-dev \ + libboost-regex-dev \ + libboost-coroutine-dev - uses: actions/checkout@v1 with: submodules: recursive From 540a99670bf146b8eebb2f735d9ab96aa61ec657 Mon Sep 17 00:00:00 2001 From: Peter Conrad Date: Mon, 18 Nov 2019 12:08:41 +0100 Subject: [PATCH 3/7] Build and run in parallel --- .github/workflows/build-and-test.yml | 34 +++++++++++++++------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 889fede..8608b63 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -7,6 +7,7 @@ jobs: - name: Install dependencies run: | sudo apt-get install -y \ + parallel \ libboost-thread-dev \ libboost-iostreams-dev \ libboost-date-time-dev \ @@ -33,16 +34,16 @@ jobs: popd - name: Build run: | - make -C _build + make -j 2 -C _build - name: Test run: | - pushd _build - tests/all_tests - tests/bloom_test ../README.md - tests/ecc_test ../README.md - tests/hmac_test - tests/task_cancel_test - popd + parallel echo Running {}\; sh -c "_build/tests/{}" <<_EOT_ + all_tests + bloom_test README.md + ecc_test README.md + hmac_test + task_cancel_test + _EOT_ test-debug: name: Build and run tests in Debug mode runs-on: ubuntu-latest @@ -50,6 +51,7 @@ jobs: - name: Install dependencies run: | sudo apt-get install -y \ + parallel \ libboost-thread-dev \ libboost-iostreams-dev \ libboost-date-time-dev \ @@ -76,13 +78,13 @@ jobs: popd - name: Build run: | - make -C _build + make -j 2 -C _build - name: Test run: | - pushd _build - tests/all_tests - tests/bloom_test ../README.md - tests/ecc_test ../README.md - tests/hmac_test - tests/task_cancel_test - popd + parallel echo Running {}\; sh -c "_build/tests/{}" <<_EOT_ + all_tests + bloom_test README.md + ecc_test README.md + hmac_test + task_cancel_test + _EOT_ From f7f64ee1fd23b0cf98e7e12d787c3dbeedc81e3c Mon Sep 17 00:00:00 2001 From: Peter Conrad Date: Mon, 18 Nov 2019 12:09:18 +0100 Subject: [PATCH 4/7] Add ccache --- .github/workflows/build-and-test.yml | 31 ++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 8608b63..56b1cd4 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -1,4 +1,7 @@ on: [ push, pull_request ] +env: + CCACHE_COMPRESS: exists means true + CCACHE_SLOPPINESS: include_file_ctime,include_file_mtime,time_macros jobs: test-release: name: Build and run tests in Release mode @@ -7,6 +10,7 @@ jobs: - name: Install dependencies run: | sudo apt-get install -y \ + ccache \ parallel \ libboost-thread-dev \ libboost-iostreams-dev \ @@ -29,11 +33,24 @@ jobs: cmake -D CMAKE_BUILD_TYPE=Release \ -D CMAKE_CXX_OUTPUT_EXTENSION_REPLACE=ON \ -D CMAKE_C_COMPILER=gcc \ + -D CMAKE_C_COMPILER_LAUNCHER=ccache \ -D CMAKE_CXX_COMPILER=g++ \ + -D CMAKE_CXX_COMPILER_LAUNCHER=ccache \ .. popd + - name: Load Cache + uses: actions/cache@v1 + with: + path: ccache + key: ccache-release-${{ github.ref }}-${{ github.sha }} + restore-keys: | + ccache-release-${{ github.ref }}- + ccache-release- + ccache- - name: Build run: | + export CCACHE_DIR="$GITHUB_WORKSPACE/ccache" + mkdir -p "$CCACHE_DIR" make -j 2 -C _build - name: Test run: | @@ -51,6 +68,7 @@ jobs: - name: Install dependencies run: | sudo apt-get install -y \ + ccache \ parallel \ libboost-thread-dev \ libboost-iostreams-dev \ @@ -73,11 +91,24 @@ jobs: cmake -D CMAKE_BUILD_TYPE=Debug \ -D CMAKE_CXX_OUTPUT_EXTENSION_REPLACE=ON \ -D CMAKE_C_COMPILER=gcc \ + -D CMAKE_C_COMPILER_LAUNCHER=ccache \ -D CMAKE_CXX_COMPILER=g++ \ + -D CMAKE_CXX_COMPILER_LAUNCHER=ccache \ .. popd + - name: Load Cache + uses: actions/cache@v1 + with: + path: ccache + key: ccache-debug-${{ github.ref }}-${{ github.sha }} + restore-keys: | + ccache-debug-${{ github.ref }}- + ccache-debug- + ccache- - name: Build run: | + export CCACHE_DIR="$GITHUB_WORKSPACE/ccache" + mkdir -p "$CCACHE_DIR" make -j 2 -C _build - name: Test run: | From 005aa69c0a97edcc9e8eb887f8b4be8e090b8299 Mon Sep 17 00:00:00 2001 From: Peter Conrad Date: Mon, 18 Nov 2019 14:03:07 +0100 Subject: [PATCH 5/7] Attempt to fix tests --- .github/workflows/build-and-test.yml | 4 ++-- tests/crypto/dh_test.cpp | 2 +- tests/stacktrace_test.cpp | 9 +++++---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 56b1cd4..c346f5e 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -56,7 +56,7 @@ jobs: run: | parallel echo Running {}\; sh -c "_build/tests/{}" <<_EOT_ all_tests - bloom_test README.md + bloom_test -- README.md ecc_test README.md hmac_test task_cancel_test @@ -114,7 +114,7 @@ jobs: run: | parallel echo Running {}\; sh -c "_build/tests/{}" <<_EOT_ all_tests - bloom_test README.md + bloom_test -- README.md ecc_test README.md hmac_test task_cancel_test diff --git a/tests/crypto/dh_test.cpp b/tests/crypto/dh_test.cpp index bc38cc4..a6d9d25 100644 --- a/tests/crypto/dh_test.cpp +++ b/tests/crypto/dh_test.cpp @@ -50,7 +50,7 @@ BOOST_AUTO_TEST_CASE(dh_test) alice.p.clear(); alice.p.push_back(100); alice.p.push_back(2); BOOST_CHECK( !alice.validate() ); alice.p = bob.p; - alice.g = 9; + alice.g = 1; BOOST_CHECK( !alice.validate() ); } diff --git a/tests/stacktrace_test.cpp b/tests/stacktrace_test.cpp index 452a63e..feb5790 100644 --- a/tests/stacktrace_test.cpp +++ b/tests/stacktrace_test.cpp @@ -64,17 +64,18 @@ public: BOOST_AUTO_TEST_CASE(static_variant_depth_test) { int64_t i = 1; - fc::static_variant test(i); + fc::static_variant,std::vector,std::vector, + uint8_t,uint16_t,uint32_t,uint64_t,int8_t,int16_t,int32_t,int64_t> test(i); std::string stacktrace = test.visit( _svdt_visitor() ); - //std::cerr << stacktrace << "\n"; + std::cerr << stacktrace << "\n"; std::vector lines; boost::split( lines, stacktrace, boost::is_any_of("\n") ); int count = 0; for( const auto& line : lines ) if( line.find("_svdt_visitor") != std::string::npos ) count++; - BOOST_CHECK_LT( 2, count ); // test.visit(), static_variant::visit, function object, visitor - BOOST_CHECK_GT( 8, count ); // some is implementation-dependent + BOOST_CHECK_LT( 1, count ); // The actual count depends on compiler and optimization settings. + BOOST_CHECK_GT( 10, count ); // It *should* be less than the number of static variant components. } #endif From 7981ab08f5e2046a61df93bd641b7eab6141416b Mon Sep 17 00:00:00 2001 From: Peter Conrad Date: Mon, 25 Nov 2019 15:03:46 +0100 Subject: [PATCH 6/7] Added badge to README --- .github/workflows/build-and-test.yml | 1 + README.md | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index c346f5e..3961f9f 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -1,3 +1,4 @@ +name: Github Autobuild on: [ push, pull_request ] env: CCACHE_COMPRESS: exists means true diff --git a/README.md b/README.md index e528ef8..7f38366 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ fc == [![](https://travis-ci.org/bitshares/bitshares-fc.svg?branch=master)](https://travis-ci.org/bitshares/bitshares-fc) +[https://github.com/bitshares/bitshares-fc/workflows/Github%20Autobuild/badge.svg?branch=master](https://github.com/bitshares/bitshares-fc/actions?query=branch%3Amaster) **NOTE:** This fork reverts upstream commit a421e280488385cab26a42153f7ce3c8d5b6281f to avoid changing the BitShares API. From 6e5fe1f5508d9b328d91ea4517136d2b01b7c5a6 Mon Sep 17 00:00:00 2001 From: Peter Conrad Date: Fri, 29 Nov 2019 17:45:19 +0100 Subject: [PATCH 7/7] Fixed badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7f38366..87d504a 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ fc == [![](https://travis-ci.org/bitshares/bitshares-fc.svg?branch=master)](https://travis-ci.org/bitshares/bitshares-fc) -[https://github.com/bitshares/bitshares-fc/workflows/Github%20Autobuild/badge.svg?branch=master](https://github.com/bitshares/bitshares-fc/actions?query=branch%3Amaster) +[![](https://github.com/bitshares/bitshares-fc/workflows/Github%20Autobuild/badge.svg?branch=master)](https://github.com/bitshares/bitshares-fc/actions?query=branch%3Amaster) **NOTE:** This fork reverts upstream commit a421e280488385cab26a42153f7ce3c8d5b6281f to avoid changing the BitShares API.