From 2e137e2032e681d0a98eed91021523ca5816ea3b Mon Sep 17 00:00:00 2001 From: Reto Schneider Date: Wed, 21 Apr 2021 01:54:50 +0200 Subject: [PATCH 1/3] ci: Sort lines alphabetically Doing this allows to reduce merge conflicts. Signed-off-by: Reto Schneider --- tools/ci/run_ci.sh | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/tools/ci/run_ci.sh b/tools/ci/run_ci.sh index c643c0ec4..f4d3e1c4f 100755 --- a/tools/ci/run_ci.sh +++ b/tools/ci/run_ci.sh @@ -20,40 +20,40 @@ readonly REPO_ROOT_DIR="${PWD}" readonly SCRIPT_NAME="$(basename "$0")" CMAKE_ARGS="-DCMAKE_BUILD_TYPE=RelWithDebInfo" -RUN_CLEAN=0 -RUN_BUILD=0 -RUN_TESTS=0 OPT_C_EXTENSIONS="" OPT_C_STANDARD="" -OPT_VERBOSE=0 OPT_SANITIZER="" -OPT_TEST_COVERAGE_REPORT="" OPT_SCAN_BUILD="" OPT_SONARQUBE="" +OPT_TEST_COVERAGE_REPORT="" +OPT_VERBOSE=0 OPT_WRAPPER_CMD="" +RUN_BUILD=0 +RUN_CLEAN=0 +RUN_TESTS=0 HELP_MSG="usage: ${SCRIPT_NAME} ... Runs build and test steps in CI. Select steps to execute with --run- options Options: - -v, --verbose Verbose output - -a, --all Run all steps required for a MR - -h, --help Display this help and exit - --sanitizer TYPE Enable sanitizer - (TYPE: address leak thread undefined) - --scan-build BINARY Enable Clang code analyzer using specified - executable - (BINARY: e.g. scan-build-10) - --test-coverage REPORT Enable code coverage measurement, output REPORT - (REPORT: xml html text none) - --c-standard VERSION Explicitly specify C VERSION to be used - (VERSION: 99, 11) - --c-extensions ENABLE Whether to allow compiler extensions. Defaults to - ON. - (ENABLE: ON or OFF) - --sonarqube WRAPPER Collect data for SonarQube - (WRAPPER: path to build-wrapper) + --c-extensions ENABLE Whether to allow compiler extensions. Defaults to + ON. + (ENABLE: ON or OFF) + --c-standard VERSION Explicitly specify C VERSION to be used + (VERSION: 99, 11) + --sanitizer TYPE Enable sanitizer + (TYPE: address leak thread undefined) + --scan-build BINARY Enable Clang code analyzer using specified + executable + (BINARY: e.g. scan-build-10) + --sonarqube WRAPPER Collect data for SonarQube + (WRAPPER: path to build-wrapper) + --test-coverage REPORT Enable code coverage measurement, output REPORT + (REPORT: xml html text none) + -v, --verbose Verbose output + -a, --all Run all steps required for a MR + -h, --help Display this help and exit Available steps (executed by --all): --clean Remove all build artifacts @@ -140,10 +140,10 @@ if ! PARSED_OPTS=$(getopt -o vah \ -l c-standard: \ -l clean \ -l help \ + -l run-tests \ -l sanitizer: \ -l scan-build: \ -l sonarqube: \ - -l run-tests \ -l test-coverage: \ -l verbose \ --name "${SCRIPT_NAME}" -- "$@"); From 77dca16b3d6e935f95d82601c6d7ac689d8b4763 Mon Sep 17 00:00:00 2001 From: Reto Schneider Date: Wed, 21 Apr 2021 02:05:03 +0200 Subject: [PATCH 2/3] ci: Remove superfluous '--clean' flags While not harmful, those flags are not needed in a clean environment. Signed-off-by: Reto Schneider --- .github/workflows/build.yaml | 1 - .github/workflows/coverage.yaml | 1 - 2 files changed, 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index f3bc834b5..0430d7052 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -33,7 +33,6 @@ jobs: - name: Build all binaries run: | tools/ci/run_ci.sh \ - --clean \ --build \ --c-standard ${{ matrix.c_standard }} \ --c-extensions ${{ matrix.c_extensions }} diff --git a/.github/workflows/coverage.yaml b/.github/workflows/coverage.yaml index 433bdc35f..03ef9ad88 100644 --- a/.github/workflows/coverage.yaml +++ b/.github/workflows/coverage.yaml @@ -28,7 +28,6 @@ jobs: run: | tools/ci/run_ci.sh --run-tests \ --build \ - --clean \ --test-coverage html - name: Upload HTML coverage report From 98626910502d6d7ca139d888cbf06ccdb2c9bf83 Mon Sep 17 00:00:00 2001 From: Reto Schneider Date: Wed, 21 Apr 2021 01:59:39 +0200 Subject: [PATCH 3/3] ci: Prefix step flags with '--run-' This aligns the actually used flags with the documentation printed when passing '--help'. Signed-off-by: Reto Schneider --- .github/workflows/build.yaml | 2 +- .github/workflows/build_and_test.yaml | 2 +- .github/workflows/clang-static-analyzer.yaml | 2 +- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/coverage.yaml | 5 ++-- .github/workflows/multiarch.yaml | 2 +- tools/ci/run_ci.sh | 24 ++++++++++---------- 7 files changed, 20 insertions(+), 19 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 0430d7052..f1297f5d1 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -33,7 +33,7 @@ jobs: - name: Build all binaries run: | tools/ci/run_ci.sh \ - --build \ + --run-build \ --c-standard ${{ matrix.c_standard }} \ --c-extensions ${{ matrix.c_extensions }} env: diff --git a/.github/workflows/build_and_test.yaml b/.github/workflows/build_and_test.yaml index b77d671ac..a246fe8bc 100644 --- a/.github/workflows/build_and_test.yaml +++ b/.github/workflows/build_and_test.yaml @@ -35,7 +35,7 @@ jobs: - name: Build all binaries run: | - tools/ci/run_ci.sh --build --verbose + tools/ci/run_ci.sh --run-build --verbose env: CC: ${{ matrix.compiler }} diff --git a/.github/workflows/clang-static-analyzer.yaml b/.github/workflows/clang-static-analyzer.yaml index 5cd7a4f6b..3e27c5144 100644 --- a/.github/workflows/clang-static-analyzer.yaml +++ b/.github/workflows/clang-static-analyzer.yaml @@ -25,7 +25,7 @@ jobs: uses: seanmiddleditch/gha-setup-ninja@master - name: Run Clang Static Analyzer - run: tools/ci/run_ci.sh --build --scan-build scan-build-10 + run: tools/ci/run_ci.sh --run-build --scan-build scan-build-10 - name: Upload scan build reports uses: actions/upload-artifact@v1 diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 77b52a26b..b18413b98 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -36,7 +36,7 @@ jobs: languages: cpp - name: Build all binaries - run: tools/ci/run_ci.sh --build + run: tools/ci/run_ci.sh --run-build - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v1 diff --git a/.github/workflows/coverage.yaml b/.github/workflows/coverage.yaml index 03ef9ad88..91090e7b4 100644 --- a/.github/workflows/coverage.yaml +++ b/.github/workflows/coverage.yaml @@ -26,8 +26,9 @@ jobs: - name: Collect test coverage data run: | - tools/ci/run_ci.sh --run-tests \ - --build \ + tools/ci/run_ci.sh \ + --run-build \ + --run-tests \ --test-coverage html - name: Upload HTML coverage report diff --git a/.github/workflows/multiarch.yaml b/.github/workflows/multiarch.yaml index 53cfd2823..ef2d54f3e 100644 --- a/.github/workflows/multiarch.yaml +++ b/.github/workflows/multiarch.yaml @@ -43,4 +43,4 @@ jobs: cd .. rm -r cmake-${{ env.cmake_version }} cmake-${{ env.cmake_version }}.tar.gz run: | - tools/ci/run_ci.sh --build --run-tests + tools/ci/run_ci.sh --run-build --run-tests diff --git a/tools/ci/run_ci.sh b/tools/ci/run_ci.sh index f4d3e1c4f..b1b47469f 100755 --- a/tools/ci/run_ci.sh +++ b/tools/ci/run_ci.sh @@ -56,8 +56,8 @@ Options: -h, --help Display this help and exit Available steps (executed by --all): - --clean Remove all build artifacts - --build Build all targets + --run-clean Remove all build artifacts + --run-build Build all targets --run-tests Build and execute tests " @@ -135,11 +135,11 @@ fi if ! PARSED_OPTS=$(getopt -o vah \ -l all \ - -l build \ -l c-extensions: \ -l c-standard: \ - -l clean \ -l help \ + -l run-build \ + -l run-clean \ -l run-tests \ -l sanitizer: \ -l scan-build: \ @@ -155,14 +155,6 @@ eval set -- "${PARSED_OPTS}" while true; do case "$1" in - --clean) - RUN_CLEAN=1 - shift - ;; - --build) - RUN_BUILD=1 - shift 1 - ;; --c-extensions) OPT_C_EXTENSIONS=$2 shift 2 @@ -171,6 +163,14 @@ while true; do OPT_C_STANDARD=$2 shift 2 ;; + --run-clean) + RUN_CLEAN=1 + shift + ;; + --run-build) + RUN_BUILD=1 + shift 1 + ;; --run-tests) RUN_TESTS=1 shift