From 80abae59e8aae47f55f558ba381d733eebd4b585 Mon Sep 17 00:00:00 2001 From: Matteo Nardelli Date: Wed, 22 Nov 2023 09:21:46 +0000 Subject: [PATCH] FROST: Add github workflow to build with CMake --- .github/workflows/build-with-cmake.yml | 76 ++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 .github/workflows/build-with-cmake.yml diff --git a/.github/workflows/build-with-cmake.yml b/.github/workflows/build-with-cmake.yml new file mode 100644 index 0000000000..395bbdeb5b --- /dev/null +++ b/.github/workflows/build-with-cmake.yml @@ -0,0 +1,76 @@ +name: Build using cmake + +# In secp256k1 some assertions are not exactly equal when coverage is enabled +# and when it is not. Hence, it is better to run the two cases separately. + +on: + push: + branches: + - frost + pull_request: + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + build-with-cmake: + runs-on: ubuntu-22.04 + # Use fedora:38 to compile using gcc-13 + container: + image: fedora:38 + steps: + - name: Install build dependencies + run: | + dnf install -y \ + autoconf \ + automake \ + gcc \ + gcovr \ + libtool \ + pkg-config \ + cmake + - uses: actions/checkout@v3 + with: + fetch-depth: 1 + - name: Create and enter build directory + continue-on-error: false + run: | + mkdir _build + cd _build + - name: Build with CMake + run: | + cmake -DCMAKE_C_FLAGS="-Werror" -DCMAKE_BUILD_TYPE="Release" -DSECP256K1_EXPERIMENTAL=ON -DSECP256K1_ENABLE_MODULE_FROST=ON -DSECP256K1_BUILD_BENCHMARK=OFF -DSECP256K1_BUILD_EXAMPLES=ON -DSECP256K1_BUILD_EXHAUSTIVE_TESTS=OFF -DSECP256K1_BUILD_TESTS=ON . + make -j + - name: Run FROST example + continue-on-error: true + id: run_frost_example + run: | + ./_build/examples/frost_example + - name: Functional tests with -Werror, no code coverage + continue-on-error: true + id: tests_no_coverage + run: | + ./_build/src/tests + - name: Summarize outcomes. Fail if any step failed. + run: | + # summary + RED='\033[0;31m' + GREEN='\033[0;32m' + NC='\033[0m' # No Color + + echo -n "FROST example: " + if [[ ${{ steps.run_frost_example.outcome }} == "success" ]]; then + printf "${GREEN}SUCCESS${NC}\n" + else + printf "${RED}FAIL${NC} (${{ steps.run_frost_example.outcome }}), please check\n" + fi + + echo -n "Functional tests with -Werror, no code coverage: " + if [[ ${{ steps.tests_no_coverage.outcome }} == "success" ]]; then + printf "${GREEN}SUCCESS${NC}\n" + else + printf "${RED}FAIL${NC} (${{ steps.tests_no_coverage.outcome }}), please check\n" + fi + + if [[ ${{ steps.tests_with_coverage.outcome }} != "success" ]] || [[ ${{ steps.tests_no_coverage.outcome }} != "success" ]]; then + exit 1 + fi