From 0b43f61c9fbfb47631b5aea37fdd6acbcf401484 Mon Sep 17 00:00:00 2001 From: Brian Szmyd Date: Wed, 23 Aug 2023 11:38:08 -0700 Subject: [PATCH] Update matrix --- .github/workflows/build_commit.yml | 13 ++++++ .github/workflows/build_dependencies.yml | 51 +++++++++++++--------- .github/workflows/conan_build.yml | 54 ++++++++++++++++++++++++ .github/workflows/merge_conan_build.yml | 23 ---------- .github/workflows/pr_conan_build.yml | 22 ---------- .jenkins/Jenkinsfile | 54 +++--------------------- README.md | 2 +- conanfile.py | 14 +++--- 8 files changed, 111 insertions(+), 122 deletions(-) create mode 100644 .github/workflows/conan_build.yml delete mode 100644 .github/workflows/merge_conan_build.yml delete mode 100644 .github/workflows/pr_conan_build.yml diff --git a/.github/workflows/build_commit.yml b/.github/workflows/build_commit.yml index e9b25d3..56e0aa4 100644 --- a/.github/workflows/build_commit.yml +++ b/.github/workflows/build_commit.yml @@ -15,6 +15,9 @@ on: prerelease: required: true type: string + tooling: + required: true + type: string jobs: SislDeps: @@ -25,7 +28,9 @@ jobs: build-type: ${{ inputs.build-type }} malloc-impl: ${{ inputs.malloc-impl }} prerelease: ${{ inputs.prerelease }} + tooling: None if: ${{ github.event_name != 'pull_request' }} + NuRaftMesgDeps: needs: SislDeps uses: eBay/nuraft_mesg/.github/workflows/build_dependencies.yml@main @@ -35,7 +40,9 @@ jobs: build-type: ${{ inputs.build-type }} malloc-impl: ${{ inputs.malloc-impl }} prerelease: ${{ inputs.prerelease }} + tooling: None if: ${{ github.event_name != 'pull_request' }} + IOMgrDeps: needs: SislDeps uses: eBay/iomanager/.github/workflows/build_dependencies.yml@master @@ -45,7 +52,9 @@ jobs: build-type: ${{ inputs.build-type }} malloc-impl: ${{ inputs.malloc-impl }} prerelease: ${{ inputs.prerelease }} + tooling: None if: ${{ github.event_name != 'pull_request' }} + HomeStoreDeps: needs: IOMgrDeps uses: eBay/homestore/.github/workflows/build_dependencies.yml@master @@ -56,6 +65,7 @@ jobs: malloc-impl: ${{ inputs.malloc-impl }} prerelease: ${{ inputs.prerelease }} if: ${{ github.event_name != 'pull_request' }} + HomeReplDeps: needs: [HomeStoreDeps, NuRaftMesgDeps] uses: ./.github/workflows/build_dependencies.yml @@ -65,8 +75,10 @@ jobs: build-type: ${{ inputs.build-type }} malloc-impl: ${{ inputs.malloc-impl }} prerelease: ${{ inputs.prerelease }} + tooling: ${{ inputs.tooling }} testing: 'True' if: ${{ github.event_name != 'pull_request' }} + HomeReplBuild: uses: ./.github/workflows/build_dependencies.yml with: @@ -75,5 +87,6 @@ jobs: build-type: ${{ inputs.build-type }} malloc-impl: ${{ inputs.malloc-impl }} prerelease: ${{ inputs.prerelease }} + tooling: ${{ inputs.tooling }} testing: 'True' if: ${{ github.event_name == 'pull_request' }} diff --git a/.github/workflows/build_dependencies.yml b/.github/workflows/build_dependencies.yml index 0325e3b..4be0907 100644 --- a/.github/workflows/build_dependencies.yml +++ b/.github/workflows/build_dependencies.yml @@ -19,6 +19,10 @@ on: prerelease: required: true type: string + tooling: + required: false + type: string + default: 'None' testing: required: false type: string @@ -60,6 +64,13 @@ on: - 'True' - 'False' default: 'False' + tooling: + required: false + type: choice + - 'Sanitize' + - 'Coverage' + - 'None' + default: 'None' testing: description: 'Build and Run' required: true @@ -166,6 +177,7 @@ jobs: -o iomgr:testing=off \ -o homestore:testing=off \ -o nuraft_mesg:testing=False \ + -o testing=False\ -s build_type=${{ inputs.build-type }} \ --build missing \ . @@ -209,44 +221,43 @@ jobs: fail_on_cache_miss: true if: ${{ inputs.testing == 'True' && github.event_name != 'pull_request' && steps.restore-cache.outputs.cache-hit != 'true' }} - - name: Code Coverage Run + - name: Create and Test Package run: | - conan install \ + sanitize=$([[ "${{ inputs.tooling }}" == "Sanitize" ]] && echo "True" || echo "False") + conan create \ -o sisl:prerelease=${{ inputs.prerelease }} \ -o sisl:malloc_impl=${{ inputs.malloc-impl }} \ -o sisl:testing=False \ -o iomgr:testing=off \ -o homestore:testing=off \ -o nuraft_mesg:testing=False \ - -o coverage=True \ + -o home_replication:testing=True \ + -o home_replication:sanitize=${sanitize} \ -s build_type=${{ inputs.build-type }} \ --build missing \ . - conan build . - if: ${{ inputs.testing == 'True' && inputs.platform == 'ubuntu-22.04' && inputs.build-type == 'Debug' && inputs.malloc-impl == 'libc' && inputs.prerelease == 'False' }} - - - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - gcov: true - if: ${{ inputs.testing == 'True' && inputs.platform == 'ubuntu-22.04' && inputs.build-type == 'Debug' && inputs.malloc-impl == 'libc' && inputs.prerelease == 'False' }} + if: ${{ inputs.testing == 'True' && inputs.tooling != 'Coverage' }} - - name: Create and Test Package + - name: Code Coverage Run run: | - sanitize=$([[ "${{ inputs.build-type }}" == "Debug" && \ - "${{ inputs.malloc-impl }}" == "libc" && \ - "${{ inputs.prerelease }}" == "True" ]] && \ - echo "True" || echo "False") - conan create \ + conan install \ -o sisl:prerelease=${{ inputs.prerelease }} \ -o sisl:malloc_impl=${{ inputs.malloc-impl }} \ -o sisl:testing=False \ -o iomgr:testing=off \ -o homestore:testing=off \ -o nuraft_mesg:testing=False \ - -o home_replication:sanitize=${sanitize} \ + -o coverage=True \ + -o testing=True \ -s build_type=${{ inputs.build-type }} \ --build missing \ . - if: ${{ inputs.testing == 'True' && ( inputs.platform != 'ubuntu-22.04' || inputs.build-type != 'Debug' || inputs.malloc-impl != 'libc' || inputs.prerelease != 'False' ) }} + conan build . + if: ${{ inputs.testing == 'True' && inputs.tooling == 'Coverage' }} + + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + gcov: true + if: ${{ inputs.testing == 'True' && inputs.tooling == 'Coverage' }} diff --git a/.github/workflows/conan_build.yml b/.github/workflows/conan_build.yml new file mode 100644 index 0000000..0d7d3ae --- /dev/null +++ b/.github/workflows/conan_build.yml @@ -0,0 +1,54 @@ +name: HomeReplication Build + +on: + workflow_dispatch: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + Build: + strategy: + fail-fast: false + matrix: + platform: ["ubuntu-22.04"] + build-type: ["Debug", "Release"] + malloc-impl: ["libc", "tcmalloc"] + prerelease: ["True", "False"] + tooling: ["Sanitize", "Coverage", "None"] + exclude: + - build-type: Debug + prerelease: "False" + - build-type: Debug + tooling: None + - build-type: Debug + malloc-impl: tcmalloc + - build-type: Release + malloc-impl: libc + - build-type: Release + tooling: Sanitize + - build-type: Release + tooling: Coverage + uses: ./.github/workflows/build_commit.yml + with: + platform: ${{ matrix.platform }} + build-type: ${{ matrix.build-type }} + malloc-impl: ${{ matrix.malloc-impl }} + prerelease: ${{ matrix.prerelease }} + tooling: ${{ matrix.tooling }} + ChainBuild: + runs-on: "ubuntu-22.04" + steps: + - name: Start HomeObject Build + run: | + curl -L \ + -X POST \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer ${{ secrets.CHAIN_BUILD_TOKEN }}"\ + -H "X-GitHub-Api-Version: 2022-11-28" \ + https://api.github.com/repos/eBay/homeobject/actions/workflows/conan_build.yml/dispatches \ + -d '{"ref":"main","inputs":{}}' + if: ${{ github.ref == 'refs/heads/master' }} diff --git a/.github/workflows/merge_conan_build.yml b/.github/workflows/merge_conan_build.yml deleted file mode 100644 index 1a79695..0000000 --- a/.github/workflows/merge_conan_build.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: HomeReplication Merge Build - -on: - workflow_dispatch: - push: - branches: - - main - -jobs: - Build: - strategy: - fail-fast: false - matrix: - platform: ["ubuntu-22.04"] - build-type: ["Debug", "Release"] - malloc-impl: ["libc"] - prerelease: ["True", "False"] - uses: ./.github/workflows/build_commit.yml - with: - platform: ${{ matrix.platform }} - build-type: ${{ matrix.build-type }} - malloc-impl: ${{ matrix.malloc-impl }} - prerelease: ${{ matrix.prerelease }} diff --git a/.github/workflows/pr_conan_build.yml b/.github/workflows/pr_conan_build.yml deleted file mode 100644 index 1184a71..0000000 --- a/.github/workflows/pr_conan_build.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: HomeReplication PR Build - -on: - pull_request: - branches: - - main - -jobs: - Build: - strategy: - fail-fast: false - matrix: - platform: ["ubuntu-22.04"] - build-type: ["Debug", "Release"] - malloc-impl: ["libc"] - prerelease: ["True", "False"] - uses: ./.github/workflows/build_commit.yml - with: - platform: ${{ matrix.platform }} - build-type: ${{ matrix.build-type }} - malloc-impl: ${{ matrix.malloc-impl }} - prerelease: ${{ matrix.prerelease }} diff --git a/.jenkins/Jenkinsfile b/.jenkins/Jenkinsfile index 86282a7..1de5109 100644 --- a/.jenkins/Jenkinsfile +++ b/.jenkins/Jenkinsfile @@ -9,7 +9,7 @@ pipeline { } stages { - stage('Adjust Tag for Master/PR') { + stage('Adjust Tag for Main/PR') { when { not { branch "${STABLE_BRANCH}" } } @@ -52,55 +52,13 @@ pipeline { } } -/* Commented out until unit tests are available - stage('Coverage') { - when { not { - branch "${STABLE_BRANCH}" - } } - - stages { - stage("Adjust Sonar Branch") { - when { - not { - branch "${TARGET_BRANCH}" - } - } - steps { - sh "echo \"sonar.branch.target=${TARGET_BRANCH}\" >> sonar-project.properties" - } - } - stage("Code Coverage") { - steps { - slackSend channel: '#sds-ci', message: "*${PROJECT}:${TAG}* is undergoing Code Coverage." - sh "echo \"sonar.branch.name=${BRANCH_NAME}\" >> sonar-project.properties" - sh "conan install -o sisl:prerelease=True -pr debug ${BUILD_MISSING} -o ${PROJECT}:coverage=True ." - sh "build-wrapper-linux-x86-64 --out-dir /tmp/sonar conan build ." - sh "find . -name \"*.gcno\" -exec gcov {} \\;" - withSonarQubeEnv('sds-sonar') { - sh "sonar-scanner -Dsonar.projectBaseDir=. -Dsonar.projectVersion=\"${VER}\"" - } - } - } - stage("Quality Gate") { - steps { - timeout(time: 5, unit: 'MINUTES') { - waitForQualityGate abortPipeline: false - } - } - } - } - } -*/ - stage("Compile") { steps { -/* Need some additional variants from homestore and iomgr to build this. - sh "conan create ${BUILD_MISSING} -o sisl:prerelease=False -o ${PROJECT}:sanitize=True -pr debug . ${PROJECT}/${TAG}" - sh "conan remove -f ${PROJECT}/${TAG}" -*/ - sh "conan create ${BUILD_MISSING} -o sisl:prerelease=True -pr debug . ${PROJECT}/${TAG}" - sh "conan create ${BUILD_MISSING} -o sisl:prerelease=True -pr test . ${PROJECT}/${TAG}" - sh "conan create ${BUILD_MISSING} -o sisl:prerelease=False -pr test . ${PROJECT}/${TAG}" + sh "conan create ${BUILD_MISSING} -pr debug -o ${PROJECT}:sanitize=True . ${PROJECT}/${TAG} ; \ + conan create ${BUILD_MISSING} -pr debug . ${PROJECT}/${TAG} ; \ + conan create ${BUILD_MISSING} -pr test -o sisl:malloc_impl=tcmalloc . ${PROJECT}/${TAG} ; \ + conan create ${BUILD_MISSING} -pr test -o sisl:prerelease=True -o sisl:malloc_impl=tcmalloc . ${PROJECT}/${TAG} ; \ + " } } diff --git a/README.md b/README.md index 0e533b0..14a70ff 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # HomeReplication -[![Conan Build](https://github.com/eBay/HomeReplication/actions/workflows/merge_conan_build.yml/badge.svg?branch=main)](https://github.com/eBay/HomeReplication/actions/workflows/merge_conan_build.yml) +[![Conan Build](https://github.com/eBay/HomeReplication/actions/workflows/conan_build.yml/badge.svg?branch=main)](https://github.com/eBay/HomeReplication/actions/workflows/conan_build.yml) [![CodeCov](https://codecov.io/gh/eBay/HomeReplication/branch/main/graph/badge.svg)](https://codecov.io/gh/eBay/HomeReplication) Replicated messaging service built upon HomeStore and NuRaft diff --git a/conanfile.py b/conanfile.py index 677209f..6f9fbfe 100644 --- a/conanfile.py +++ b/conanfile.py @@ -30,15 +30,14 @@ class HomeReplicationConan(ConanFile): 'fPIC': True, 'coverage': False, 'sanitize': False, - 'testing': False, - 'sisl:prerelease': True, + 'testing': True, } generators = "cmake", "cmake_find_package" exports_sources = ("CMakeLists.txt", "cmake/*", "src/*", "LICENSE") def build_requirements(self): - self.build_requires("gtest/1.13.0") + self.build_requires("gtest/1.14.0") def requirements(self): self.requires("nuraft_mesg/[~=1, include_prerelease=True]@oss/main") @@ -49,7 +48,7 @@ def validate(self): if self.info.settings.os in ["Macos", "Windows"]: raise ConanInvalidConfiguration("{} Builds are unsupported".format(self.info.settings.os)) if self.info.settings.compiler.cppstd: - check_min_cppstd(self, 11) + check_min_cppstd(self, 20) def configure(self): if self.options.shared: @@ -57,10 +56,9 @@ def configure(self): if self.settings.build_type == "Debug": if self.options.coverage and self.options.sanitize: raise ConanInvalidConfiguration("Sanitizer does not work with Code Coverage!") - if self.options.sanitize: - self.options['sisl'].malloc_impl = 'libc' - if self.options.coverage: - self.options.testing = True + if not self.options.testing: + if self.options.coverage or self.options.sanitize: + raise ConanInvalidConfiguration("Coverage/Sanitizer requires Testing!") def build(self): definitions = {