From 3f0d4b53b73f4d87d39c964da99e981509efa686 Mon Sep 17 00:00:00 2001 From: FeignClaims Date: Sat, 8 Jun 2024 17:30:46 +0800 Subject: [PATCH 1/5] refactor(ci): Unify install, build and test into one --- .github/actions/setup_conan/action.yml | 5 ----- .github/workflows/ci.yml | 10 ++++------ 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/.github/actions/setup_conan/action.yml b/.github/actions/setup_conan/action.yml index 12d8557..81fa9ec 100644 --- a/.github/actions/setup_conan/action.yml +++ b/.github/actions/setup_conan/action.yml @@ -89,11 +89,6 @@ runs: run: | conan remove '*/system' -c - - name: Install conan packages - shell: bash - run: | - conan install . ${{ steps.output.outputs.args }} -b missing - - name: Clean 30 days unused conan caches shell: bash run: | diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 08d0d97..d7049cc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -133,13 +133,11 @@ jobs: compiler_version: ${{ steps.parsed.outputs.compiler_version }} build_type: ${{ matrix.build_type }} - - name: Configure cmake + - name: Configure, build and test run: | - cmake --preset ${{ steps.parsed.outputs.compiler_name }} ${{ steps.parsed.outputs.compiler_name == 'msvc' && '-A x64 -T v143' || '' }} -D ENABLE_DEVELOPER_MODE:BOOL=${{ matrix.developer_mode }} -D OPT_ENABLE_COVERAGE:BOOL=${{ matrix.build_type == 'Debug' }} - - - name: Build and test - run: | - conan build . ${{ steps.conan.outputs.args }} + conan build . ${{ steps.conan.outputs.args }} \ + -c "tools.cmake.cmaketoolchain:extra_variables*={'ENABLE_DEVELOPER_MODE': {'value': '${{ matrix.developer_mode }}', 'cache': True, 'type': 'BOOL', 'docstring': 'Set up defaults for a developer of the project, and let developer change options'}}" \ + -c "tools.cmake.cmaketoolchain:extra_variables*={'OPT_ENABLE_COVERAGE' : {'value': '${{ matrix.build_type == 'Debug' }}', 'cache': True, 'type': 'BOOL', 'docstring': 'Analyze and report on coverage'}}" - name: Unix - Coverage if: runner.os != 'Windows' && matrix.build_type == 'Debug' From 6e1c2771128489167c39aba97af5b237703df0e4 Mon Sep 17 00:00:00 2001 From: FeignClaims Date: Sat, 8 Jun 2024 17:39:05 +0800 Subject: [PATCH 2/5] fix(ci): Unify install, build and test in codeql --- .github/workflows/codeql.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index d28591c..616a188 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -69,7 +69,6 @@ jobs: uses: ./.github/actions/setup_cache with: key: ${{ steps.parsed.outputs.os_name }}-${{ steps.parsed.outputs.os_version }}-${{ steps.parsed.outputs.compiler_name }}-${{ steps.parsed.outputs.compiler_version }}-${{ matrix.build_type }}-${{ matrix.developer_mode }} - restore_key: ${{ steps.parsed.outputs.os_name }}-${{ steps.parsed.outputs.os_version }}-${{ steps.parsed.outputs.compiler_name }}-${{ steps.parsed.outputs.compiler_version }}-${{ matrix.build_type }} - name: Setup Cpp uses: aminya/setup-cpp@v0.37.0 @@ -102,15 +101,18 @@ jobs: # Learnt from https://github.com/igraph/igraph/issues/1181 args: -c tools.build:cflags+=-static-libasan -c tools.build:cxxflags+=-static-libasan - - name: Configure cmake - run: | - cmake --preset ${{ steps.parsed.outputs.compiler_name }} ${{ steps.parsed.outputs.compiler_name == 'msvc' && '-A x64 -T v143' || '' }} -D ENABLE_DEVELOPER_MODE:BOOL=${{ matrix.developer_mode }} -D OPT_ENABLE_COVERAGE:BOOL=${{ matrix.build_type == 'Debug' }} -D OPT_ENABLE_CLANG_TIDY:BOOL=OFF -D OPT_ENABLE_CPPCHECK:BOOL=OFF -D OPT_ENABLE_INCLUDE_WHAT_YOU_USE:BOOL=OFF - - name: Initialize CodeQL uses: github/codeql-action/init@v3 with: languages: cpp + - name: Configure, build and test + shell: bash + run: | + conan build . ${{ steps.conan.outputs.args }} \ + -c "tools.cmake.cmaketoolchain:extra_variables*={'ENABLE_DEVELOPER_MODE': {'value': '${{ matrix.developer_mode }}', 'cache': True, 'type': 'BOOL', 'docstring': 'Set up defaults for a developer of the project, and let developer change options'}}" \ + -c "tools.cmake.cmaketoolchain:extra_variables*={'OPT_ENABLE_COVERAGE' : {'value': '${{ matrix.build_type == 'Debug' }}', 'cache': True, 'type': 'BOOL', 'docstring': 'Analyze and report on coverage'}}" + - name: Build and test run: | conan build . ${{ steps.conan.outputs.args }} From 99af480c2ab3d4fec0efbbead8c4071f2c2643dd Mon Sep 17 00:00:00 2001 From: FeignClaims Date: Sat, 8 Jun 2024 17:39:52 +0800 Subject: [PATCH 3/5] fix(ci): Specify bash when running `conan build` --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d7049cc..46e54a4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -134,6 +134,7 @@ jobs: build_type: ${{ matrix.build_type }} - name: Configure, build and test + shell: bash run: | conan build . ${{ steps.conan.outputs.args }} \ -c "tools.cmake.cmaketoolchain:extra_variables*={'ENABLE_DEVELOPER_MODE': {'value': '${{ matrix.developer_mode }}', 'cache': True, 'type': 'BOOL', 'docstring': 'Set up defaults for a developer of the project, and let developer change options'}}" \ From fdc1ea36ea466554c6e0ff8bc7968d42c3100599 Mon Sep 17 00:00:00 2001 From: FeignClaims Date: Sat, 8 Jun 2024 17:47:25 +0800 Subject: [PATCH 4/5] fix(ci): Disable other static analysis tools in codeql --- .github/workflows/codeql.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 616a188..5f67775 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -110,8 +110,10 @@ jobs: shell: bash run: | conan build . ${{ steps.conan.outputs.args }} \ - -c "tools.cmake.cmaketoolchain:extra_variables*={'ENABLE_DEVELOPER_MODE': {'value': '${{ matrix.developer_mode }}', 'cache': True, 'type': 'BOOL', 'docstring': 'Set up defaults for a developer of the project, and let developer change options'}}" \ - -c "tools.cmake.cmaketoolchain:extra_variables*={'OPT_ENABLE_COVERAGE' : {'value': '${{ matrix.build_type == 'Debug' }}', 'cache': True, 'type': 'BOOL', 'docstring': 'Analyze and report on coverage'}}" + -c "tools.cmake.cmaketoolchain:extra_variables*={'ENABLE_DEVELOPER_MODE' : {'value': '${{ matrix.developer_mode }}', 'cache': True, 'type': 'BOOL', 'docstring': 'Set up defaults for a developer of the project, and let developer change options'}}" \ + -c "tools.cmake.cmaketoolchain:extra_variables*={'OPT_ENABLE_CLANG_TIDY' : {'value': 'OFF', 'cache': True, 'type': 'BOOL', 'docstring': 'Enable clang-tidy analysis during compilation'}}" \ + -c "tools.cmake.cmaketoolchain:extra_variables*={'OPT_ENABLE_CPPCHECK' : {'value': 'OFF', 'cache': True, 'type': 'BOOL', 'docstring': 'Enable cppcheck analysis during compilation'}}" \ + -c "tools.cmake.cmaketoolchain:extra_variables*={'OPT_ENABLE_INCLUDE_WHAT_YOU_USE': {'value': 'OFF', 'cache': True, 'type': 'BOOL', 'docstring': 'Enable include-what-you-use analysis during compilation'}}" - name: Build and test run: | From 67d218c4095ac377987872365b42862c68c5fe1f Mon Sep 17 00:00:00 2001 From: FeignClaims Date: Sat, 8 Jun 2024 17:50:40 +0800 Subject: [PATCH 5/5] fix(ci): Build missing conan packages --- .github/workflows/ci.yml | 2 +- .github/workflows/codeql.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 46e54a4..b10c62e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -136,7 +136,7 @@ jobs: - name: Configure, build and test shell: bash run: | - conan build . ${{ steps.conan.outputs.args }} \ + conan build . ${{ steps.conan.outputs.args }} -b missing \ -c "tools.cmake.cmaketoolchain:extra_variables*={'ENABLE_DEVELOPER_MODE': {'value': '${{ matrix.developer_mode }}', 'cache': True, 'type': 'BOOL', 'docstring': 'Set up defaults for a developer of the project, and let developer change options'}}" \ -c "tools.cmake.cmaketoolchain:extra_variables*={'OPT_ENABLE_COVERAGE' : {'value': '${{ matrix.build_type == 'Debug' }}', 'cache': True, 'type': 'BOOL', 'docstring': 'Analyze and report on coverage'}}" diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 5f67775..66a65fd 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -109,7 +109,7 @@ jobs: - name: Configure, build and test shell: bash run: | - conan build . ${{ steps.conan.outputs.args }} \ + conan build . ${{ steps.conan.outputs.args }} -b missing \ -c "tools.cmake.cmaketoolchain:extra_variables*={'ENABLE_DEVELOPER_MODE' : {'value': '${{ matrix.developer_mode }}', 'cache': True, 'type': 'BOOL', 'docstring': 'Set up defaults for a developer of the project, and let developer change options'}}" \ -c "tools.cmake.cmaketoolchain:extra_variables*={'OPT_ENABLE_CLANG_TIDY' : {'value': 'OFF', 'cache': True, 'type': 'BOOL', 'docstring': 'Enable clang-tidy analysis during compilation'}}" \ -c "tools.cmake.cmaketoolchain:extra_variables*={'OPT_ENABLE_CPPCHECK' : {'value': 'OFF', 'cache': True, 'type': 'BOOL', 'docstring': 'Enable cppcheck analysis during compilation'}}" \