From aad1544a1a9fd07b8f9acc9bd57619d713cf0f3f Mon Sep 17 00:00:00 2001 From: Matt Witherspoon <32485495+spoonincode@users.noreply.github.com> Date: Thu, 21 Dec 2023 20:36:41 -0500 Subject: [PATCH 1/2] add SYSTEM_ENABLE_LEAP_VERSION_CHECK & SYSTEM_ENABLE_CDT_VERSION_CHECK --- CMakeLists.txt | 6 ++++++ contracts/CMakeLists.txt | 34 ++++++++++++++++++---------------- tests/CMakeLists.txt | 34 ++++++++++++++++++---------------- 3 files changed, 42 insertions(+), 32 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 00388c3d..5f9d3925 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,6 +25,12 @@ option(SYSTEM_CONFIGURABLE_WASM_LIMITS option(SYSTEM_BLOCKCHAIN_PARAMETERS "Enables use of the host functions activated by the BLOCKCHAIN_PARAMETERS protocol feature" ON) +option(SYSTEM_ENABLE_LEAP_VERSION_CHECK + "Enables a configure-time check that the version of Leap's tester library is compatible with this project's unit tests" ON) + +option(SYSTEM_ENABLE_CDT_VERSION_CHECK + "Enables a configure-time check that the version of CDT is compatible with this project's contracts" ON) + ExternalProject_Add( contracts_project SOURCE_DIR ${CMAKE_SOURCE_DIR}/contracts diff --git a/contracts/CMakeLists.txt b/contracts/CMakeLists.txt index f66e1afc..d48cae0e 100644 --- a/contracts/CMakeLists.txt +++ b/contracts/CMakeLists.txt @@ -15,22 +15,24 @@ set(CDT_VERSION_SOFT_MAX "4.0") # set(CDT_VERSION_HARD_MAX "") # Check the version of CDT -set(VERSION_MATCH_ERROR_MSG "") -CDT_CHECK_VERSION(VERSION_OUTPUT "${CDT_VERSION}" "${CDT_VERSION_MIN}" "${CDT_VERSION_SOFT_MAX}" - "${CDT_VERSION_HARD_MAX}" VERSION_MATCH_ERROR_MSG) -if(VERSION_OUTPUT STREQUAL "MATCH") - message(STATUS "Using CDT version ${CDT_VERSION}") -elseif(VERSION_OUTPUT STREQUAL "WARN") - message( - WARNING - "Using CDT version ${CDT_VERSION} even though it exceeds the maximum supported version of ${CDT_VERSION_SOFT_MAX}; continuing with configuration, however build may fail.\nIt is recommended to use CDT version ${CDT_VERSION_SOFT_MAX}.x" - ) -else() # INVALID OR MISMATCH - message( - FATAL_ERROR - "Found CDT version ${CDT_VERSION} but it does not satisfy version requirements: ${VERSION_MATCH_ERROR_MSG}\nPlease use CDT version ${CDT_VERSION_SOFT_MAX}.x" - ) -endif(VERSION_OUTPUT STREQUAL "MATCH") +if(SYSTEM_ENABLE_CDT_VERSION_CHECK) + set(VERSION_MATCH_ERROR_MSG "") + CDT_CHECK_VERSION(VERSION_OUTPUT "${CDT_VERSION}" "${CDT_VERSION_MIN}" "${CDT_VERSION_SOFT_MAX}" + "${CDT_VERSION_HARD_MAX}" VERSION_MATCH_ERROR_MSG) + if(VERSION_OUTPUT STREQUAL "MATCH") + message(STATUS "Using CDT version ${CDT_VERSION}") + elseif(VERSION_OUTPUT STREQUAL "WARN") + message( + WARNING + "Using CDT version ${CDT_VERSION} even though it exceeds the maximum supported version of ${CDT_VERSION_SOFT_MAX}; continuing with configuration, however build may fail.\nIt is recommended to use CDT version ${CDT_VERSION_SOFT_MAX}.x" + ) + else() # INVALID OR MISMATCH + message( + FATAL_ERROR + "Found CDT version ${CDT_VERSION} but it does not satisfy version requirements: ${VERSION_MATCH_ERROR_MSG}\nPlease use CDT version ${CDT_VERSION_SOFT_MAX}.x" + ) + endif(VERSION_OUTPUT STREQUAL "MATCH") +endif() set(ICON_BASE_URL "https://raw.githubusercontent.com/AntelopeIO/reference-contracts/main/contracts/icons") diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 8c0ab125..4b05daa3 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -7,22 +7,24 @@ set(EOSIO_VERSION_SOFT_MAX "4.1") find_package(leap) # Check the version of Leap -set(VERSION_MATCH_ERROR_MSG "") -eosio_check_version(VERSION_OUTPUT "${EOSIO_VERSION}" "${EOSIO_VERSION_MIN}" "${EOSIO_VERSION_SOFT_MAX}" - "${EOSIO_VERSION_HARD_MAX}" VERSION_MATCH_ERROR_MSG) -if(VERSION_OUTPUT STREQUAL "MATCH") - message(STATUS "Using Leap version ${EOSIO_VERSION}") -elseif(VERSION_OUTPUT STREQUAL "WARN") - message( - WARNING - "Using Leap version ${EOSIO_VERSION} even though it exceeds the maximum supported version of ${EOSIO_VERSION_SOFT_MAX}; continuing with configuration, however build may fail.\nIt is recommended to use Leap version ${EOSIO_VERSION_SOFT_MAX}.x" - ) -else() # INVALID OR MISMATCH - message( - FATAL_ERROR - "Found Leap version ${EOSIO_VERSION} but it does not satisfy version requirements: ${VERSION_MATCH_ERROR_MSG}\nPlease use Leap version ${EOSIO_VERSION_SOFT_MAX}.x" - ) -endif(VERSION_OUTPUT STREQUAL "MATCH") +if(SYSTEM_ENABLE_LEAP_VERSION_CHECK) + set(VERSION_MATCH_ERROR_MSG "") + eosio_check_version(VERSION_OUTPUT "${EOSIO_VERSION}" "${EOSIO_VERSION_MIN}" "${EOSIO_VERSION_SOFT_MAX}" + "${EOSIO_VERSION_HARD_MAX}" VERSION_MATCH_ERROR_MSG) + if(VERSION_OUTPUT STREQUAL "MATCH") + message(STATUS "Using Leap version ${EOSIO_VERSION}") + elseif(VERSION_OUTPUT STREQUAL "WARN") + message( + WARNING + "Using Leap version ${EOSIO_VERSION} even though it exceeds the maximum supported version of ${EOSIO_VERSION_SOFT_MAX}; continuing with configuration, however build may fail.\nIt is recommended to use Leap version ${EOSIO_VERSION_SOFT_MAX}.x" + ) + else() # INVALID OR MISMATCH + message( + FATAL_ERROR + "Found Leap version ${EOSIO_VERSION} but it does not satisfy version requirements: ${VERSION_MATCH_ERROR_MSG}\nPlease use Leap version ${EOSIO_VERSION_SOFT_MAX}.x" + ) + endif(VERSION_OUTPUT STREQUAL "MATCH") +endif() configure_file(${CMAKE_CURRENT_SOURCE_DIR}/contracts.hpp.in ${CMAKE_CURRENT_BINARY_DIR}/contracts.hpp) From 58d798436da2f244ebb309f47a6bea3cdf3f73ff Mon Sep 17 00:00:00 2001 From: Matt Witherspoon <32485495+spoonincode@users.noreply.github.com> Date: Sat, 6 Jan 2024 14:05:26 -0500 Subject: [PATCH 2/2] u22, libtester 5, update some action versions --- .cicd/defaults.json | 2 +- .github/workflows/build.yaml | 14 ++++++-------- tests/CMakeLists.txt | 2 +- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/.cicd/defaults.json b/.cicd/defaults.json index ff3a3dbc..a6751a1e 100644 --- a/.cicd/defaults.json +++ b/.cicd/defaults.json @@ -1,6 +1,6 @@ { "leap-dev":{ - "target":"3", + "target":"5", "prerelease":false }, "cdt":{ diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 1b211e8a..d536cea4 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -36,7 +36,7 @@ defaults: jobs: build-test: name: Build & Test - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: Setup leap-dev & cdt versions id: versions @@ -62,7 +62,7 @@ jobs: echo cdt-prerelease=${{inputs.override-cdt-prerelease}} >> $GITHUB_OUTPUT fi - name: Download cdt - uses: AntelopeIO/asset-artifact-download-action@v2 + uses: AntelopeIO/asset-artifact-download-action@v3 with: owner: AntelopeIO repo: cdt @@ -70,24 +70,22 @@ jobs: target: '${{steps.versions.outputs.cdt-target}}' prereleases: ${{fromJSON(steps.versions.outputs.cdt-prerelease)}} artifact-name: cdt_ubuntu_package_amd64 - token: ${{github.token}} - name: Download leap-dev - uses: AntelopeIO/asset-artifact-download-action@v2 + uses: AntelopeIO/asset-artifact-download-action@v3 with: owner: AntelopeIO repo: leap - file: 'leap-dev.*(x86_64|amd64).deb' + file: 'leap-dev.*ubuntu22\.04_amd64.deb' target: '${{steps.versions.outputs.leap-dev-target}}' prereleases: ${{fromJSON(steps.versions.outputs.leap-dev-prerelease)}} - artifact-name: leap-dev-ubuntu20-amd64 + artifact-name: leap-dev-ubuntu22-amd64 container-package: experimental-binaries - token: ${{github.token}} - name: Install packages run: | sudo apt install ./*.deb sudo apt-get install cmake rm ./*.deb - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: path: src - name: Build & Test diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 4b05daa3..f5875dbf 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.5) set(EOSIO_VERSION_MIN "3.1") -set(EOSIO_VERSION_SOFT_MAX "4.1") +set(EOSIO_VERSION_SOFT_MAX "5.0") # set(EOSIO_VERSION_HARD_MAX "") find_package(leap)