From 0b4d690714018ff291128334f4842619bbeb2cfb Mon Sep 17 00:00:00 2001 From: Alexander Bigerl Date: Tue, 28 Feb 2023 09:12:05 +0100 Subject: [PATCH 1/2] Feature/cleanup ci and fix conan version (#36) --- .github/workflows/code_testing.yml | 17 ++++++----- .github/workflows/conan_upload.yml | 30 ------------------- .github/workflows/documentation.yml | 8 +++-- .../publish-conan-branch-package.yml | 20 +++++++++++++ .github/workflows/publish-release.yml | 25 ++++++++++++++++ conanfile.py | 5 ---- test_package/conanfile.py | 15 ++++------ 7 files changed, 67 insertions(+), 53 deletions(-) delete mode 100644 .github/workflows/conan_upload.yml create mode 100644 .github/workflows/publish-conan-branch-package.yml create mode 100644 .github/workflows/publish-release.yml diff --git a/.github/workflows/code_testing.yml b/.github/workflows/code_testing.yml index 00d0df6..0bb6684 100644 --- a/.github/workflows/code_testing.yml +++ b/.github/workflows/code_testing.yml @@ -1,6 +1,10 @@ name: code_testing -on: [push] +on: [ push ] + +concurrency: + group: publish-conan-branch-package-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true jobs: build_test: @@ -15,7 +19,7 @@ jobs: CXX: "g++-10" steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 # setup - name: install needed packages run: sudo apt-get -qq update && sudo apt-get -qq install -y git make cmake gcc-10 g++-10 clang-10 libstdc++-10-dev @@ -36,14 +40,13 @@ jobs: run: sudo apt-get update -qq && sudo apt-get -qq install -y python3-pip gcc-10 - name: setup conan run: | - sudo pip3 install conan + sudo pip3 install "conan==1.59" conan profile new --detect default conan profile update settings.compiler.libcxx=libstdc++11 default env: CC: gcc-10 CXX: g++-10 - - name: Checkout - uses: actions/checkout@v1 + - uses: actions/checkout@v3 - name: build and test the package run: conan create . --build missing env: @@ -55,7 +58,7 @@ jobs: build_docker: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 # build - name: build image run: docker build -t dockerimage . @@ -76,7 +79,7 @@ jobs: CXX: "g++-10" steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 # setup - name: install needed packages run: sudo apt-get -qq update && sudo apt-get -qq install -y git make cmake gcc-10 g++-10 clang-10 libstdc++-10-dev diff --git a/.github/workflows/conan_upload.yml b/.github/workflows/conan_upload.yml deleted file mode 100644 index 8e9a710..0000000 --- a/.github/workflows/conan_upload.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: conan_upload - -# idea: run on every push connected to a tag -on: - push: - tags: - - '*' - -jobs: - build_and_upload: - runs-on: ubuntu-20.04 - steps: - - name: Install conan - run: sudo apt-get update -qq && sudo apt-get install -qq python3 python3-pip gcc-10 -y && sudo pip3 install conan - - name: Checkout - uses: actions/checkout@v1 - # set the remote and login into the user - - name: setup conan - run: | - conan remote add dice-group https://conan.dice-research.org/artifactory/api/conan/tentris - conan user -p ${{ secrets.ARTIFACTORY_API_KEY }} -r dice-group ${{ secrets.ARTIFACTORY_USER }} - - name: build the package - run: conan create . "dice-group/stable" --build missing -e CC=gcc-10 -e CXX=g++-10 - # will use `grep` and `sed` to extract the version number out of the cmake file - - name: upload the package - run: | - VERSION=$(conan inspect . --raw version) - echo "$VERSION" - conan remove "$(conan inspect . --raw name)/$(conan inspect . --raw version)" -r dice-group -f - conan upload "$(conan inspect . --raw name)/$(conan inspect . --raw version)" --force --all -r dice-group \ No newline at end of file diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 60c8d2a..79392e0 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -3,13 +3,17 @@ name: documentation on: push: branches: - - master + - main + +concurrency: + group: publish-conan-branch-package-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true jobs: generate_doxygen_docu: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 # https://github.com/marketplace/actions/doxygen-action - name: generate docu uses: mattnotmitt/doxygen-action@v1 diff --git a/.github/workflows/publish-conan-branch-package.yml b/.github/workflows/publish-conan-branch-package.yml new file mode 100644 index 0000000..259a860 --- /dev/null +++ b/.github/workflows/publish-conan-branch-package.yml @@ -0,0 +1,20 @@ +name: Publish Conan branch package + +on: [ push ] + +concurrency: + group: publish-conan-branch-package-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + publish-release: + uses: dice-group/cpp-conan-release-reusable-workflow/.github/workflows/publish-conan-branch-package.yml@main + with: + public_artifactory: false + os: ubuntu-22.04 + compiler: clang-14 + cmake-version: 3.22.6 + conan-version: 1.59 + secrets: + CONAN_USER: ${{ secrets.CONAN_USER }} + CONAN_PW: ${{ secrets.CONAN_PW }} diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml new file mode 100644 index 0000000..f856517 --- /dev/null +++ b/.github/workflows/publish-release.yml @@ -0,0 +1,25 @@ +name: Publish Release + +on: + workflow_run: + workflows: [ "Publish Conan branch package" ] + branches: [ main ] + types: + - completed + + +concurrency: + group: publish-release-${{ github.workflow }}-${{ github.ref }} + +jobs: + publish-conan-branch-package: + uses: dice-group/cpp-conan-release-reusable-workflow/.github/workflows/publish-release.yml@main + with: + public_artifactory: false + os: ubuntu-22.04 + compiler: clang-14 + cmake-version: 3.22.6 + conan-version: 1.59 + secrets: + CONAN_USER: ${{ secrets.CONAN_USER }} + CONAN_PW: ${{ secrets.CONAN_PW }} diff --git a/conanfile.py b/conanfile.py index d14c693..5f5b625 100644 --- a/conanfile.py +++ b/conanfile.py @@ -32,11 +32,6 @@ def set_version(self): cmake_file = load(self, os.path.join(self.recipe_folder, "CMakeLists.txt")) self.description = re.search(r"project\([^)]*DESCRIPTION\s+\"([^\"]+)\"[^)]*\)", cmake_file).group(1) - def set_version(self): - if not hasattr(self, 'version') or self.version is None: - cmake_file = load(self, os.path.join(self.recipe_folder, "CMakeLists.txt")) - self.version = re.search(r"project\([^)]*VERSION\s+(\d+\.\d+.\d+)[^)]*\)", cmake_file).group(1) - def package_id(self): self.info.header_only() diff --git a/test_package/conanfile.py b/test_package/conanfile.py index 5620702..c7d1297 100644 --- a/test_package/conanfile.py +++ b/test_package/conanfile.py @@ -1,17 +1,14 @@ import os -from conans import ConanFile -from conan.tools.cmake import CMake, CMakeToolchain +from conan import ConanFile +from conan.tools.cmake import CMake from conan.tools.layout import cmake_layout -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.59" + class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "CMakeDeps" - - def generate(self): - tc = CMakeToolchain(self) - tc.generate() + generators = "CMakeDeps", "CMakeToolchain" def layout(self): cmake_layout(self) @@ -22,4 +19,4 @@ def build(self): cmake.build() def test(self): - self.run(os.path.join(self.cpp.build.bindirs[0], "example"), run_environment=True) \ No newline at end of file + self.run(os.path.join(self.cpp.build.bindirs[0], "example"), run_environment=True) From 06008be69413d020586e2990e7ef20b6264ccddd Mon Sep 17 00:00:00 2001 From: Alexander Bigerl Date: Tue, 28 Feb 2023 09:14:58 +0100 Subject: [PATCH 2/2] version bump --- CMakeLists.txt | 2 +- README.md | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f45b689..eb63ac1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.16) project( dice-hash - VERSION 0.4.1 + VERSION 0.4.2 DESCRIPTION "dice-hash provides a framework to generate stable hashes. It provides state-of-the-art hash functions, supports STL containers out of the box and helps you to defines stable hashes for your own structs and classes." HOMEPAGE_URL "https://dice-group.github.io/dice-hash/") diff --git a/README.md b/README.md index 02a1f93..246b74b 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ add FetchContent_Declare( dice-hash GIT_REPOSITORY https://github.com/dice-group/dice-hash.git - GIT_TAG 0.4.0 + GIT_TAG 0.4.2 GIT_SHALLOW TRUE) FetchContent_MakeAvailable(dice-hash) @@ -49,7 +49,7 @@ To use it with [conan](https://conan.io/) you need to add the repository: conan remote add dice-group https://conan.dice-research.org/artifactory/api/conan/tentris ``` -To use it add `dice-hash/0.4.1` to the `[requires]` section of your conan file. +To use it add `dice-hash/0.4.2` to the `[requires]` section of your conan file. ## build and run tests @@ -107,6 +107,7 @@ namespace dice::hash { } ``` Now you can use `DiceHash` with your container. + __However__: Your container __needs__ to have `begin`, `end` and `size` functions. One simple example can be found [here](examples/customContainer.cpp).