{"thread":{"id":"58161","subject":"[PATCH 01/10] CI: run \"set -ex\" early in ci/lib.sh","startedAt":"2022-07-14T19:40:00Z","lastAt":"2022-07-14T19:40:31Z","messageCount":11,"participants":["Ævar Arnfjörð Bjarmason"],"isPatch":true,"patchVersion":1,"patchTotal":10},"messages":[{"id":"459069","messageId":"patch-01.10-905a9419267-20220714T193808Z-avarab@gmail.com","threadId":"58161","inReplyTo":"cover-00.10-00000000000-20220714T193808Z-avarab@gmail.com","subject":"[PATCH 01/10] CI: run \"set -ex\" early in ci/lib.sh","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-07-14T19:39:38Z","receivedAt":"2022-07-14T19:40:00Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change ci/lib.sh to run \"set -e\" before it does anything else, this\nhelp us to assert that we have no failing commands early on in the\nfile.\n\nWhile we're at it let's fix a stray typo in\necaba2ad4c0 (ci/run-build-and-tests: add some structure to the GitHub\nworkflow output, 2022-05-21), which seemingly added \"#\" to the middle\nof a line while re-wrapping a comment.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh | 15 ++++++++-------\n 1 file changed, 8 insertions(+), 7 deletions(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex f095519f8db..4f12bcaabb9 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -1,5 +1,13 @@\n # Library of functions shared by all CI scripts\n \n+# Set 'exit on error' for all CI scripts to let the caller know that\n+# something went wrong.\n+#\n+# We'll enable \"set -x\" below for tracing executed commands, that will\n+# help to show how environment variables are set and and dependencies\n+# are installed.\n+set -e\n+\n if test true != \"$GITHUB_ACTIONS\"\n then\n \tbegin_group () { :; }\n@@ -44,13 +52,6 @@ else\n \tbegin_group \"CI setup\"\n fi\n \n-# Set 'exit on error' for all CI scripts to let the caller know that\n-# something went wrong.\n-#\n-# We already enabled tracing executed commands earlier. This helps by showing\n-# how # environment variables are set and and dependencies are installed.\n-set -e\n-\n skip_branch_tip_with_tag () {\n \t# Sometimes, a branch is pushed at the same time the tag that points\n \t# at the same commit as the tip of the branch is pushed, and building\n-- \n2.37.1.996.g651fc6e809f\n\n"},{"id":"459070","messageId":"cover-00.10-00000000000-20220714T193808Z-avarab@gmail.com","threadId":"58161","inReplyTo":null,"subject":"[PATCH 00/10] ci: make it easy to run locally, part 1","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-07-14T19:39:37Z","receivedAt":"2022-07-14T19:40:02Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"This series extracted from the much larger series to run CI in\n\"steps\"[1] submitted in the last cycle, and rebased on CI work that's\nhappened in-tree since then.\n\nAt the end of this series the \"ci/run-static-analysis.sh\" has been\nextracted to a \"make ci-static-analysis\", target, which the CI then\nruns. The introduction of \"setenv\" and some of the structures here is\nlarger than strictly necessary to get to that point, but as seen in\n[1] is in service of the larger goal of making CI less of a special\nsnowflake.\n\nThe eventual goal down the line is to be able to trivially run local\ntests \"as in CI\", to the extent that's possible. Obviously we can't\neasily run the OSX CI locally on a Linux box, but it's now a needless\nhassle to set up e.g. the same environment variables as various CI\njobs require before they run \"make\" or \"make test\".\n\nThis series starts out by removing some dead Travis CI code, the\nremoval of the Azure bits of CI code has been ejected, as Johannes is\nplanning to re-use it[2]. Per earlier discussions I'm not sure exactly\nwhat parts he had in mind to keep[3], but I've made an educated guess\nhere.\n\nPassing CI for this series can be seen at [4].\n\n1. https://lore.kernel.org/git/cover-v6-00.29-00000000000-20220525T094123Z-avarab@gmail.com/\n2. https://lore.kernel.org/git/pull.1288.git.1657789234416.gitgitgadget@gmail.com/\n3. https://lore.kernel.org/git/220609.86r13xsj00.gmgdl@evledraar.gmail.com/\n4. https://github.com/avar/git/actions/runs/2671838770\n\nÆvar Arnfjörð Bjarmason (10):\n  CI: run \"set -ex\" early in ci/lib.sh\n  CI: remove more dead Travis CI support\n  CI: remove dead \"tree skipping\" code\n  CI: make \"$jobname\" explicit, remove fallback\n  CI/lib.sh: stop adding leading whitespace to $MAKEFLAGS\n  CI: consistently use \"export\" in ci/lib.sh\n  CI: export variables via a wrapper\n  CI: don't have \"git grep\" invoke a pager in tree content check\n  CI: have \"static-analysis\" run a \"make ci-static-analysis\" target\n  CI: have \"static-analysis\" run \"check-builtins\", not \"documentation\"\n\n .github/workflows/main.yml           |  13 +-\n Makefile                             |  32 ++++-\n ci/check-directional-formatting.bash |   2 +-\n ci/lib.sh                            | 200 ++++++++++-----------------\n ci/print-test-failures.sh            |  39 ------\n ci/run-build-and-tests.sh            |  41 +++---\n ci/run-docker-build.sh               |  66 ---------\n ci/run-docker.sh                     |  47 -------\n ci/run-static-analysis.sh            |  34 -----\n ci/run-test-slice.sh                 |   5 -\n ci/test-documentation.sh             |   3 -\n ci/util/extract-trash-dirs.sh        |  50 -------\n shared.mak                           |   1 +\n 13 files changed, 135 insertions(+), 398 deletions(-)\n delete mode 100755 ci/run-docker-build.sh\n delete mode 100755 ci/run-docker.sh\n delete mode 100755 ci/run-static-analysis.sh\n delete mode 100755 ci/util/extract-trash-dirs.sh\n\nRange-diff:\n 1:  25cb08ad06c !  1:  905a9419267 CI: run \"set -ex\" early in ci/lib.sh\n    @@ Metadata\n      ## Commit message ##\n         CI: run \"set -ex\" early in ci/lib.sh\n     \n    -    Change ci/lib.sh to run \"set -ex\" before it does anything else, before\n    -    this we were omitting a few \"export\" commands in our trace output that\n    -    happened before we enabled tracing.\n    +    Change ci/lib.sh to run \"set -e\" before it does anything else, this\n    +    help us to assert that we have no failing commands early on in the\n    +    file.\n    +\n    +    While we're at it let's fix a stray typo in\n    +    ecaba2ad4c0 (ci/run-build-and-tests: add some structure to the GitHub\n    +    workflow output, 2022-05-21), which seemingly added \"#\" to the middle\n    +    of a line while re-wrapping a comment.\n     \n         Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n     \n    @@ ci/lib.sh\n      \n     +# Set 'exit on error' for all CI scripts to let the caller know that\n     +# something went wrong.\n    -+# Set tracing executed commands, primarily setting environment variables\n    -+# and installing dependencies.\n    -+set -ex\n    ++#\n    ++# We'll enable \"set -x\" below for tracing executed commands, that will\n    ++# help to show how environment variables are set and and dependencies\n    ++# are installed.\n    ++set -e\n     +\n    - skip_branch_tip_with_tag () {\n    - \t# Sometimes, a branch is pushed at the same time the tag that points\n    - \t# at the same commit as the tip of the branch is pushed, and building\n    -@@ ci/lib.sh: export TERM=${TERM:-dumb}\n    - # Clear MAKEFLAGS that may come from the outside world.\n    - export MAKEFLAGS=\n    + if test true != \"$GITHUB_ACTIONS\"\n    + then\n    + \tbegin_group () { :; }\n    +@@ ci/lib.sh: else\n    + \tbegin_group \"CI setup\"\n    + fi\n      \n     -# Set 'exit on error' for all CI scripts to let the caller know that\n     -# something went wrong.\n    --# Set tracing executed commands, primarily setting environment variables\n    --# and installing dependencies.\n    --set -ex\n    +-#\n    +-# We already enabled tracing executed commands earlier. This helps by showing\n    +-# how # environment variables are set and and dependencies are installed.\n    +-set -e\n     -\n    - if test -n \"$SYSTEM_COLLECTIONURI\" || test -n \"$SYSTEM_TASKDEFINITIONSURI\"\n    - then\n    - \tCI_TYPE=azure-pipelines\n    + skip_branch_tip_with_tag () {\n    + \t# Sometimes, a branch is pushed at the same time the tag that points\n    + \t# at the same commit as the tip of the branch is pushed, and building\n 3:  234e248e831 !  2:  39ef9d2ab6e CI: remove more dead Travis CI support\n    @@ ci/lib.sh: then\n      \tDONT_SKIP_TAGS=t\n     @@ ci/lib.sh: then\n      \texport GIT_PROVE_OPTS=\"--timer --jobs 10\"\n    - \texport GIT_TEST_OPTS=\"--verbose-log -x\"\n    + \texport GIT_TEST_OPTS=\"--verbose-log -x --github-workflow-markup\"\n      \tMAKEFLAGS=\"$MAKEFLAGS --jobs=10\"\n     -\ttest windows != \"$CI_OS_NAME\" ||\n     +\ttest Windows != \"$RUNNER_OS\" ||\n    @@ ci/run-build-and-tests.sh\n     -*) ln -s \"$cache_dir/.prove\" t/.prove;;\n     -esac\n     -\n    - export MAKE_TARGETS=\"all test\"\n    + run_tests=t\n      \n      case \"$jobname\" in\n     \n    @@ ci/run-test-slice.sh\n     -*) ln -s \"$cache_dir/.prove\" t/.prove;;\n     -esac\n     -\n    - make --quiet -C t T=\"$(cd t &&\n    + group \"Run tests\" make --quiet -C t T=\"$(cd t &&\n      \t./helper/test-tool path-utils slice-tests \"$1\" \"$2\" t[0-9]*.sh |\n    - \ttr '\\n' ' ')\"\n    + \ttr '\\n' ' ')\" ||\n     \n      ## ci/util/extract-trash-dirs.sh (deleted) ##\n     @@\n 4:  36a6287ee9b !  3:  10ea16766f1 CI: remove dead \"tree skipping\" code\n    @@ Commit message\n         runs for already-tested commits/trees, 2020-10-08).\n     \n         This code hasn't been used since 4a6e4b96026 (CI: remove Travis CI\n    -    support, 2021-11-23), and before that for the retired Azure pipeline\n    -    support removed in 6081d3898fe (ci: retire the Azure Pipelines\n    -    definition, 2020-04-11).\n    +    support, 2021-11-23). At one point it was used for the now-removed\n    +    Azure Pipelines support. That support was removed in 6081d3898fe (ci:\n    +    retire the Azure Pipelines definition, 2020-04-11), but before in\n    +    50b206371d2 (travis: remove the hack to build the Windows job on Azure\n    +    Pipelines, 2019-02-28) the \"save_good_tree\" function had not been\n    +    called by the Azure Pipelines code.\n     \n    -    This change is needed because this and subsequent commits are turning\n    -    \"ci/lib.sh\" into a dumber library that'll only be tasked with setting\n    -    variables for CI jobs, or for specific steps within those jobs. Now we\n    -    don't need to worry about it potentially skipping the run on its own.\n    +    Therefore even for those who'd like to resurrect the\n    +    azure-pipelines.yml for occasional ad-hoc use (see the thread(s)\n    +    starting at [1]) this change should be OK. This code was really only\n    +    used for the now-removed Travis CI.\n     \n         This change also removes a subtle potential logic error introduced in\n         0e7696c64db (ci: disallow directional formatting, 2021-11-04). The\n    @@ Commit message\n         removed. It appears to have been added to appease the subsequent\n         'mkdir -p \"$cache_dir\"', which wasn't needed in GitHub CI.\n     \n    -    1. https://lore.kernel.org/git/patch-1.1-eec0a8c3164-20211217T000418Z-avarab@gmail.com/\n    +    1. https://lore.kernel.org/git/220609.86r13xsj00.gmgdl@evledraar.gmail.com/\n     \n         Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n     \n      ## ci/lib.sh ##\n    -@@ ci/lib.sh: then\n    - \texit 1\n    +@@ ci/lib.sh: else\n    + \tbegin_group \"CI setup\"\n      fi\n      \n     -skip_branch_tip_with_tag () {\n    @@ ci/lib.sh: then\n     -\texit 0\n     -}\n     -\n    - check_unignored_build_artifacts ()\n    - {\n    + check_unignored_build_artifacts () {\n      \t! git ls-files --other --exclude-standard --error-unmatch \\\n    + \t\t-- ':/*' 2>/dev/null ||\n     @@ ci/lib.sh: if test -n \"$SYSTEM_COLLECTIONURI\" || test -n \"$SYSTEM_TASKDEFINITIONSURI\"\n      then\n      \tCI_TYPE=azure-pipelines\n    @@ ci/lib.sh: then\n     -\tCI_JOB_ID=\"$GITHUB_RUN_ID\"\n      \tCC=\"${CC_PACKAGE:-${CC:-gcc}}\"\n     -\tDONT_SKIP_TAGS=t\n    --\n    --\tcache_dir=\"$HOME/none\"\n    + \thandle_failed_tests () {\n    + \t\tmkdir -p t/failed-test-artifacts\n    + \t\techo \"FAILED_TEST_ARTIFACTS=t/failed-test-artifacts\" >>$GITHUB_ENV\n    +@@ ci/lib.sh: then\n    + \t\treturn 1\n    + \t}\n      \n    +-\tcache_dir=\"$HOME/none\"\n    +-\n      \texport GIT_PROVE_OPTS=\"--timer --jobs 10\"\n    - \texport GIT_TEST_OPTS=\"--verbose-log -x\"\n    + \texport GIT_TEST_OPTS=\"--verbose-log -x --github-workflow-markup\"\n    + \tMAKEFLAGS=\"$MAKEFLAGS --jobs=10\"\n     @@ ci/lib.sh: else\n      \texit 1\n      fi\n    @@ ci/lib.sh: else\n     -skip_branch_tip_with_tag\n     -skip_good_tree\n     -\n    - export DEVELOPER=1\n    - export DEFAULT_TEST_TARGET=prove\n    - export GIT_TEST_CLONE_2GB=true\n    + if test -z \"$jobname\"\n    + then\n    + \tjobname=\"$CI_OS_NAME-$CC\"\n     \n      ## ci/run-build-and-tests.sh ##\n    -@@ ci/run-build-and-tests.sh: esac\n    - # start running tests.\n    - make $MAKE_TARGETS\n    +@@ ci/run-build-and-tests.sh: then\n    + \thandle_failed_tests\n    + fi\n      check_unignored_build_artifacts\n     -\n     -save_good_tree\n     \n      ## ci/run-static-analysis.sh ##\n    -@@ ci/run-static-analysis.sh: fi\n    - \n    - make hdr-check ||\n    +@@ ci/run-static-analysis.sh: make hdr-check ||\n      exit 1\n    + \n    + make check-pot\n     -\n     -save_good_tree\n     \n 2:  1be7910c728 !  4:  5d1df78d0de CI: make \"$jobname\" explicit, remove fallback\n    @@ Commit message\n     \n         This makes all of our CI jobs have an explicit $jobname, and removes\n         the special-case of the Windows jobs implicitly setting one (that they\n    -    don't currently use). In subsequent commits we'll use this new\n    -    $jobname explicitly.\n    +    don't currently use).\n     \n         This is a follow-up to my 25715419bf4 (CI: don't run \"make test\" twice\n         in one job, 2021-11-23), since then all the jobs except the Windows\n    @@ Commit message\n         ci/lib.sh.\n     \n         Since we'll need this to run ci/lib.sh it makes sense to move the\n    -    check to the top of the file. Subsequent commits will add more such\n    -    assertions to it.\n    +    check to the top of the file.\n     \n         Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n     \n    @@ .github/workflows/main.yml: jobs:\n          needs: [windows-build]\n          strategy:\n     @@ .github/workflows/main.yml: jobs:\n    -         path: ${{env.FAILED_TEST_ARTIFACTS}}\n    -   vs-build:\n    -     name: win+VS build\n    -+    env:\n    -+      jobname: vs-build\n          needs: ci-config\n          if: needs.ci-config.outputs.enabled == 'yes'\n          env:\n    ++      jobname: vs-build\n    +       NO_PERL: 1\n    +       GIT_CONFIG_PARAMETERS: \"'user.name=CI' 'user.email=ci@git'\"\n    +     runs-on: windows-latest\n     @@ .github/workflows/main.yml: jobs:\n              path: artifacts\n        vs-test:\n    @@ .github/workflows/main.yml: jobs:\n     \n      ## ci/lib.sh ##\n     @@\n    - # and installing dependencies.\n    - set -ex\n    + # are installed.\n    + set -e\n      \n     +# Starting assertions\n     +if test -z \"$jobname\"\n    @@ ci/lib.sh\n     +\texit 1\n     +fi\n     +\n    - skip_branch_tip_with_tag () {\n    - \t# Sometimes, a branch is pushed at the same time the tag that points\n    - \t# at the same commit as the tip of the branch is pushed, and building\n    -@@ ci/lib.sh: test -n \"${DONT_SKIP_TAGS-}\" ||\n    - skip_branch_tip_with_tag\n    - skip_good_tree\n    + if test true != \"$GITHUB_ACTIONS\"\n    + then\n    + \tbegin_group () { :; }\n    +@@ ci/lib.sh: else\n    + \texit 1\n    + fi\n      \n     -if test -z \"$jobname\"\n     -then\n 5:  66b0a383daf <  -:  ----------- CI: remove unused Azure ci/* code\n 6:  d96333c1bd8 !  5:  ee36d4eb2a9 CI/lib.sh: stop adding leading whitespace to $MAKEFLAGS\n    @@ Commit message\n         Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n     \n      ## ci/lib.sh ##\n    -@@ ci/lib.sh: check_unignored_build_artifacts ()\n    +@@ ci/lib.sh: handle_failed_tests () {\n      # GitHub Action doesn't set TERM, which is required by tput\n      export TERM=${TERM:-dumb}\n      \n    @@ ci/lib.sh: check_unignored_build_artifacts ()\n     -export MAKEFLAGS=\n     +export MAKEFLAGS=--jobs=$NPROC\n      \n    - if test \"$GITHUB_ACTIONS\" = \"true\"\n    + if test -n \"$SYSTEM_COLLECTIONURI\" || test -n \"$SYSTEM_TASKDEFINITIONSURI\"\n      then\n    - \tCI_TYPE=github-actions\n    - \tCC=\"${CC_PACKAGE:-${CC:-gcc}}\"\n    +@@ ci/lib.sh: then\n    + \t# We are running in Azure Pipelines\n    + \tCC=\"${CC:-gcc}\"\n    + \n    +-\texport GIT_PROVE_OPTS=\"--timer --jobs 10 --state=failed,slow,save\"\n    ++\texport GIT_PROVE_OPTS=\"--timer --jobs $NPROC --state=failed,slow,save\"\n    + \texport GIT_TEST_OPTS=\"--verbose-log -x --write-junit-xml\"\n    +-\tMAKEFLAGS=\"$MAKEFLAGS --jobs=10\"\n    + \ttest Windows_NT != \"$AGENT_OS\" ||\n    + \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n    + elif test true = \"$GITHUB_ACTIONS\"\n    +@@ ci/lib.sh: then\n    + \t\treturn 1\n    + \t}\n      \n     -\texport GIT_PROVE_OPTS=\"--timer --jobs 10\"\n     +\texport GIT_PROVE_OPTS=\"--timer --jobs $NPROC\"\n    - \texport GIT_TEST_OPTS=\"--verbose-log -x\"\n    + \texport GIT_TEST_OPTS=\"--verbose-log -x --github-workflow-markup\"\n     -\tMAKEFLAGS=\"$MAKEFLAGS --jobs=10\"\n      \ttest Windows != \"$RUNNER_OS\" ||\n      \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n11:  9655bae9e21 !  6:  7cbf8191105 CI: consistently use \"export\" in ci/lib.sh\n    @@ Metadata\n      ## Commit message ##\n         CI: consistently use \"export\" in ci/lib.sh\n     \n    -    Change the \"ci/lib.sh\" script co consistently use \"export\", for\n    +    Change the \"ci/lib.sh\" script to consistently use \"export\", for\n         e.g. MAKEFLAGS we were exporting it, and then assigning to it, let's\n         do it the other way around.\n     \n         Right now this doesn't matter, since we in\n         e.g. \"ci/install-dependencies.sh\" source this file, and don't use\n    -    something like \"env(1)\" to retrieve these variables. But in a\n    -    subsequent commit we'll \"export\" these variables through a wrapper (to\n    -    additionally write them to a GitHub CI-specific $GITHUB_ENV\n    -    file). This change makes that subsequent change easier to read, as it\n    -    won't need to do any control flow refactoring.\n    +    something like \"env(1)\" to retrieve these variables.\n    +\n    +    But in a subsequent commit we'll \"export\" these variables through a\n    +    wrapper (and to eventually write them to a GitHub CI-specific\n    +    $GITHUB_ENV file). This change makes that subsequent change easier to\n    +    read, as it won't need to do any control flow refactoring.\n     \n         Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n     \n    @@ ci/lib.sh: export TERM=${TERM:-dumb}\n     -export MAKEFLAGS=--jobs=$NPROC\n     +MAKEFLAGS=--jobs=$NPROC\n      \n    - if test \"$GITHUB_ACTIONS\" = \"true\"\n    + if test -n \"$SYSTEM_COLLECTIONURI\" || test -n \"$SYSTEM_TASKDEFINITIONSURI\"\n      then\n     @@ ci/lib.sh: then\n    - \tCC=\"${CC_PACKAGE:-${CC:-gcc}}\"\n    + \tCC=\"${CC:-gcc}\"\n    + \n    + \texport GIT_PROVE_OPTS=\"--timer --jobs $NPROC --state=failed,slow,save\"\n    +-\texport GIT_TEST_OPTS=\"--verbose-log -x --write-junit-xml\"\n    ++\tGIT_TEST_OPTS=\"--verbose-log -x --write-junit-xml\"\n    + \ttest Windows_NT != \"$AGENT_OS\" ||\n    + \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n    ++\texport GIT_TEST_OPTS\n    + elif test true = \"$GITHUB_ACTIONS\"\n    + then\n    + \tCI_TYPE=github-actions\n    +@@ ci/lib.sh: then\n    + \t}\n      \n      \texport GIT_PROVE_OPTS=\"--timer --jobs $NPROC\"\n    --\texport GIT_TEST_OPTS=\"--verbose-log -x\"\n    -+\tGIT_TEST_OPTS=\"--verbose-log -x\"\n    +-\texport GIT_TEST_OPTS=\"--verbose-log -x --github-workflow-markup\"\n    ++\tGIT_TEST_OPTS=\"--verbose-log -x --github-workflow-markup\"\n      \ttest Windows != \"$RUNNER_OS\" ||\n      \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n     +\texport GIT_TEST_OPTS\n    @@ ci/lib.sh: then\n      \techo \"Could not identify CI type\" >&2\n      \tenv >&2\n     @@ ci/lib.sh: linux-leaks)\n    - \t;;\n      esac\n      \n    --MAKEFLAGS=\"$MAKEFLAGS CC=${CC:-cc}\"\n    -+export MAKEFLAGS=\"$MAKEFLAGS CC=${CC:-cc}\"\n    + MAKEFLAGS=\"$MAKEFLAGS CC=${CC:-cc}\"\n    ++export MAKEFLAGS\n    + \n    + end_group\n    + set -x\n12:  2da0aa1d40e !  7:  e6805874eb9 CI: export variables via a wrapper\n    @@ Commit message\n         expose what variables we set in what CI \"step\", so having only the\n         ones we actually use will improve readability.\n     \n    -    To that end call the \"setenv\" function with optional \"--build\",\n    -    \"--test\" and \"--all\" parameters to indicate whether they're needed for\n    -    building, testing or both.\n    +    To that end call the \"setenv\" function with optional \"--install\",\n    +    \"--build\", \"--test\" and \"--all\" parameters to indicate whether they're\n    +    needed for building, testing or both.\n     \n         We currently ignore the \"varname\" parameter, but will make use of it in a\n         subsequent commit. Adding it here reduces the needless churn, as we\n    @@ Commit message\n         Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n     \n      ## ci/lib.sh ##\n    -@@ ci/lib.sh: then\n    - \texit 1\n    +@@ ci/lib.sh: else\n    + \tbegin_group \"CI setup\"\n      fi\n      \n     +# Helper functions\n    @@ ci/lib.sh: then\n     +\twhile test $# != 0\n     +\tdo\n     +\t\tcase \"$1\" in\n    ++\t\t--install)\n    ++\t\t\t;;\n     +\t\t--build)\n     +\t\t\t;;\n     +\t\t--test)\n    @@ ci/lib.sh: then\n     +\tval=$2\n     +\tshift 2\n     +\n    -+\teval \"export $key=\\\"$val\\\"\"\n    ++\teval \"$key=\\\"$val\\\"\"\n    ++\teval \"export $key\"\n     +}\n     +\n    - check_unignored_build_artifacts ()\n    - {\n    + check_unignored_build_artifacts () {\n      \t! git ls-files --other --exclude-standard --error-unmatch \\\n    -@@ ci/lib.sh: check_unignored_build_artifacts ()\n    + \t\t-- ':/*' 2>/dev/null ||\n    +@@ ci/lib.sh: handle_failed_tests () {\n      }\n      \n      # GitHub Action doesn't set TERM, which is required by tput\n     -export TERM=${TERM:-dumb}\n    -+setenv TERM ${TERM:-dumb}\n    ++setenv --all TERM ${TERM:-dumb}\n      \n      # How many jobs to run in parallel?\n      NPROC=10\n     @@ ci/lib.sh: then\n    + \t# We are running in Azure Pipelines\n    + \tCC=\"${CC:-gcc}\"\n    + \n    +-\texport GIT_PROVE_OPTS=\"--timer --jobs $NPROC --state=failed,slow,save\"\n    ++\tsetenv --test GIT_PROVE_OPTS \"--timer --jobs $NPROC --state=failed,slow,save\"\n    + \tGIT_TEST_OPTS=\"--verbose-log -x --write-junit-xml\"\n    + \ttest Windows_NT != \"$AGENT_OS\" ||\n    + \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n    +-\texport GIT_TEST_OPTS\n    ++\tsetenv --test GIT_TEST_OPTS \"$GIT_TEST_OPTS\"\n    + elif test true = \"$GITHUB_ACTIONS\"\n    + then\n      \tCI_TYPE=github-actions\n    - \tCC=\"${CC_PACKAGE:-${CC:-gcc}}\"\n    +@@ ci/lib.sh: then\n    + \t\treturn 1\n    + \t}\n      \n     -\texport GIT_PROVE_OPTS=\"--timer --jobs $NPROC\"\n     +\tsetenv --test GIT_PROVE_OPTS \"--timer --jobs $NPROC\"\n    - \tGIT_TEST_OPTS=\"--verbose-log -x\"\n    + \tGIT_TEST_OPTS=\"--verbose-log -x --github-workflow-markup\"\n      \ttest Windows != \"$RUNNER_OS\" ||\n      \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n     -\texport GIT_TEST_OPTS\n    @@ ci/lib.sh: ubuntu-latest)\n      \tfi\n      \n     -\texport GIT_TEST_HTTPD=true\n    ++\tsetenv --test GIT_TEST_HTTPD true\n    + \n    + \t# The Linux build installs the defined dependency versions below.\n    + \t# The OS X build installs much more recent versions, whichever\n    + \t# were recorded in the Homebrew database upon creating the OS X\n    + \t# image.\n    + \t# Keep that in mind when you encounter a broken OS X build!\n    +-\texport LINUX_P4_VERSION=\"16.2\"\n    +-\texport LINUX_GIT_LFS_VERSION=\"1.5.2\"\n    ++\tsetenv --install LINUX_P4_VERSION \"16.2\"\n    ++\tsetenv --install LINUX_GIT_LFS_VERSION \"1.5.2\"\n    + \n    +-\tP4_PATH=\"$HOME/custom/p4\"\n    +-\tGIT_LFS_PATH=\"$HOME/custom/git-lfs\"\n    +-\texport PATH=\"$GIT_LFS_PATH:$P4_PATH:$PATH\"\n    ++\tsetenv --install P4_PATH \"$HOME/custom/p4\"\n    ++\tsetenv --install GIT_LFS_PATH \"$HOME/custom/git-lfs\"\n    ++\tsetenv --all PATH \"$GIT_LFS_PATH:$P4_PATH:$PATH\"\n     +\tsetenv --test GIT_TEST_HTTPD true\n      \t;;\n      macos-latest)\n    @@ ci/lib.sh: linux-musl)\n      \t;;\n      esac\n      \n    --export MAKEFLAGS=\"$MAKEFLAGS CC=${CC:-cc}\"\n    -+setenv --all MAKEFLAGS \"$MAKEFLAGS CC=${CC:-cc}\"\n    + MAKEFLAGS=\"$MAKEFLAGS CC=${CC:-cc}\"\n    +-export MAKEFLAGS\n    ++setenv --all MAKEFLAGS \"$MAKEFLAGS\"\n    + \n    + end_group\n    + set -x\n     \n      ## ci/run-build-and-tests.sh ##\n    -@@ ci/run-build-and-tests.sh: export MAKE_TARGETS=\"all test\"\n    +@@ ci/run-build-and-tests.sh: run_tests=t\n      \n      case \"$jobname\" in\n      linux-gcc)\n    @@ ci/run-build-and-tests.sh: export MAKE_TARGETS=\"all test\"\n     -\texport GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS=1\n     -\texport GIT_TEST_MULTI_PACK_INDEX=1\n     -\texport GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP=1\n    --\texport GIT_TEST_ADD_I_USE_BUILTIN=1\n    +-\texport GIT_TEST_ADD_I_USE_BUILTIN=0\n     -\texport GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master\n     -\texport GIT_TEST_WRITE_REV_INDEX=1\n     -\texport GIT_TEST_CHECKOUT_WORKERS=2\n    @@ ci/run-build-and-tests.sh: export MAKE_TARGETS=\"all test\"\n     +\tsetenv --test GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS 1\n     +\tsetenv --test GIT_TEST_MULTI_PACK_INDEX 1\n     +\tsetenv --test GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP 1\n    -+\tsetenv --test GIT_TEST_ADD_I_USE_BUILTIN 1\n    ++\tsetenv --test GIT_TEST_ADD_I_USE_BUILTIN 0\n     +\tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME master\n     +\tsetenv --test GIT_TEST_WRITE_REV_INDEX 1\n     +\tsetenv --test GIT_TEST_CHECKOUT_WORKERS 2\n    @@ ci/run-build-and-tests.sh: export MAKE_TARGETS=\"all test\"\n      \t# built.\n     -\texport DEVOPTS=pedantic\n     +\tsetenv --build DEVOPTS pedantic\n    - \texport MAKE_TARGETS=all\n    + \trun_tests=\n      \t;;\n      esac\n 7:  d0780ab4a96 =  8:  8bcaeb1dd79 CI: don't have \"git grep\" invoke a pager in tree content check\n 8:  84e368736e2 !  9:  95b9c3797c0 CI: have \"static-analysis\" run a \"make ci-static-analysis\" target\n    @@ Commit message\n     \n         But without those improvements being able to easily run a 1=1\n         equivalent of the checks we do in CI during a local build is already\n    -    an improvement. Subsequent commits will expand on this ability.\n    +    an improvement.\n     \n         This change will also make the CI check faster, since we can take\n    -    advantage of parallelism. The \"make coccicheck\" takes a very long\n    -    time, and at the tail end we might only have one job pegging 100% of\n    -    one CPU core for a long time. Now any extra cores will be free to run\n    -    the rest of the targets under \"ci-static-analysis\".\n    +    advantage of parallelism across these \"make\" invocations. The \"make\n    +    coccicheck\" command in particular takes a long to finish its last job,\n    +    at the end we might only have one job pegging 100% of one CPU\n    +    core. Now any extra cores will be free to run the rest of the targets\n    +    under \"ci-static-analysis\".\n    +\n    +    Because we're now going to invoke \"make\" directly from the CI recipe\n    +    we'll need to amend the new \"setenv\" wrapper to write the \"MAKEFLAGS\"\n    +    and other variables to \"$GITHUB_ENV\".\n    +\n    +    In my testing the \"static-analysis\" job runs in just over 10 minutes\n    +    without this change, but this change cuts just over a minute off the\n    +    runtime.\n     \n         Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n     \n      ## .github/workflows/main.yml ##\n     @@ .github/workflows/main.yml: jobs:\n    +     runs-on: ubuntu-18.04\n          steps:\n          - uses: actions/checkout@v2\n    ++    - run: ci/lib.sh\n    ++      env:\n    ++        NO_CI_GROUPS: 1\n          - run: ci/install-dependencies.sh\n     -    - run: ci/run-static-analysis.sh\n     -    - run: ci/check-directional-formatting.bash\n    @@ Makefile: $(FUZZ_PROGRAMS): all\n     +ci-static-analysis: ci-check-directional-formatting\n     +ci-static-analysis: check-coccicheck\n     +ci-static-analysis: hdr-check\n    ++ci-static-analysis: check-pot\n    +\n    + ## ci/lib.sh ##\n    +@@ ci/lib.sh: then\n    + \texit 1\n    + fi\n    + \n    +-if test true != \"$GITHUB_ACTIONS\"\n    ++if test true != \"$GITHUB_ACTIONS\" || test -n \"$NO_CI_GROUPS\"\n    + then\n    + \tbegin_group () { :; }\n    + \tend_group () { :; }\n    +@@ ci/lib.sh: setenv () {\n    + \n    + \teval \"$key=\\\"$val\\\"\"\n    + \teval \"export $key\"\n    ++\teval \"export $key=\\\"$val\\\"\"\n    ++\tif test -n \"$GITHUB_ENV\"\n    ++\tthen\n    ++\t\techo \"$key=$val\" >>\"$GITHUB_ENV\"\n    ++\tfi\n    + }\n    + \n    + check_unignored_build_artifacts () {\n     \n      ## ci/run-static-analysis.sh (deleted) ##\n     @@\n    @@ ci/run-static-analysis.sh (deleted)\n     -\n     -make hdr-check ||\n     -exit 1\n    +-\n    +-make check-pot\n     \n      ## shared.mak ##\n     @@ shared.mak: ifndef V\n    - \tQUIET_HDR      = @echo '   ' HDR $(<:hcc=h);\n    - \tQUIET_RC       = @echo '   ' RC $@;\n    - \tQUIET_SPATCH   = @echo '   ' SPATCH $<;\n    + ## Used in \"Makefile\"\n    + \tQUIET_CC       = @echo '   ' CC $@;\n    + \tQUIET_AR       = @echo '   ' AR $@;\n     +\tQUIET_CHECK    = @echo '   ' CHECK $@;\n    - \n    - ## Used in \"Documentation/Makefile\"\n    - \tQUIET_ASCIIDOC\t= @echo '   ' ASCIIDOC $@;\n    + \tQUIET_LINK     = @echo '   ' LINK $@;\n    + \tQUIET_BUILT_IN = @echo '   ' BUILTIN $@;\n    + \tQUIET_LNCP     = @echo '   ' LN/CP $@;\n 9:  1a9c98b909c ! 10:  5ef362505c1 CI: have \"static-analysis\" run \"check-builtins\", not \"documentation\"\n    @@ Makefile: ci-check-directional-formatting:\n     +ci-static-analysis: check-builtins\n      ci-static-analysis: check-coccicheck\n      ci-static-analysis: hdr-check\n    + ci-static-analysis: check-pot\n     \n      ## ci/test-documentation.sh ##\n     @@ ci/test-documentation.sh: filter_log () {\n10:  e208a9ab1e2 <  -:  ----------- CI: move p4 and git-lfs variables to ci/install-dependencies.sh\n13:  6e97633652e <  -:  ----------- CI: remove \"run-build-and-tests.sh\", run \"make [test]\" directly\n14:  0488e29859b <  -:  ----------- CI: make ci/{lib,install-dependencies}.sh POSIX-compatible\n15:  f7ac6c33044 <  -:  ----------- CI: check ignored unignored build artifacts in \"win[+VS] build\" too\n16:  f89346f11eb <  -:  ----------- CI: invoke \"make artifacts-tar\" directly in windows-build\n17:  7fa9c69e3ca <  -:  ----------- CI: split up and reduce \"ci/test-documentation.sh\"\n18:  7925b2610fc <  -:  ----------- CI: combine ci/install{,-docker}-dependencies.sh\n19:  b00abc07637 <  -:  ----------- CI: move \"env\" definitions into ci/lib.sh\n20:  bb5960355fe <  -:  ----------- ci/run-test-slice.sh: replace shelling out with \"echo\"\n21:  1eeb2e8e7f0 <  -:  ----------- CI: pre-select test slice in Windows & VS tests\n22:  39979d9887d <  -:  ----------- CI: only invoke ci/lib.sh as \"steps\" in main.yml\n23:  e2b3bf032d6 <  -:  ----------- CI: narrow down variable definitions in --build and --test\n24:  c6f47d52823 <  -:  ----------- CI: add more variables to MAKEFLAGS, except under vs-build\n25:  377460e8024 <  -:  ----------- CI: set CC in MAKEFLAGS directly, don't add it to the environment\n26:  98e320d5e67 <  -:  ----------- CI: set SANITIZE=leak in MAKEFLAGS directly\n27:  282b7c89a4f <  -:  ----------- CI: set PYTHON_PATH setting for osx-{clang,gcc} into \"$jobname\" case\n28:  7a208927819 <  -:  ----------- CI: don't use \"set -x\" in \"ci/lib.sh\" output\n29:  4d8a8f3be07 <  -:  ----------- CI: make it easy to use ci/*.sh outside of CI\n-- \n2.37.1.996.g651fc6e809f\n\n"},{"id":"459071","messageId":"patch-02.10-39ef9d2ab6e-20220714T193808Z-avarab@gmail.com","threadId":"58161","inReplyTo":"cover-00.10-00000000000-20220714T193808Z-avarab@gmail.com","subject":"[PATCH 02/10] CI: remove more dead Travis CI support","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-07-14T19:39:39Z","receivedAt":"2022-07-14T19:40:06Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Remove code that I missed in 4a6e4b96026 (CI: remove Travis CI\nsupport, 2021-11-23). This code was only called from or used by the\nnow-removed .travis.yml, or needed by the Travis CI environment.\n\nFor the symlinking in ci/run-build-and-tests.sh: Back when\n3c93b829205 (travis-ci: build Git during the 'script' phase,\n2018-01-08) and 4b060a4d973 (ci: use a junction on Windows instead of\na symlink, 2019-01-27) adjusted this \"ln\" command, the Windows build\nwould use ci/run-build-and-tests.sh.\n\nAs seen in 889cacb6897 (ci: configure GitHub Actions for CI/PR,\n2020-04-11) the current windows build uses a different entry point\nunder the GitHub CI, which doesn't use this .prove caching. Namely\n\"ci/run-test-slice.sh\".\n\nWe can be certain that it's never used in \"ci/run-test-slice.sh\"\nbecause to have a \".prove\" file we'd need to use \"--state=save\", which\nwe only do in the dead Azure codepath in ci/lib.sh. If it were used it\nwould do the wrong thing, because the different test slices would each\ntry to clobber the same \"t/.prove\" file.\n\nIf a subsequent run then used the \"--state=failed,slow,save\" it would\ndefeat the purpose of \"ci/run-test-slice.sh\", since all slices would\nthen run all tests. I.e. behavior of prove's \"--state\" options is to\nselect tests to run from the provided \"--state\" file, in addition to\nthose specified on the command-line.\n\nFor ci/run-docker{,-build}.sh: It was likewise last referenced in the\n.travis.yml removed in my 4a6e4b96026. The current \"dockerized\" run in\n\".github/workflows/main.yml\" calls the same entry points as the main\n\"regular\" job.\n\nFor \"ci/print-test-failures.sh\" the creation of the tarball added in\naea8879a6ac (travis-ci: include the trash directories of failed tests\nin the trace log, 2018-08-01) has been dead since my 4a6e4b96026,\nwhich removed the fall-through case from the \"case/esac\" statement.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh                     | 10 ++----\n ci/print-test-failures.sh     | 39 ---------------------\n ci/run-build-and-tests.sh     |  5 ---\n ci/run-docker-build.sh        | 66 -----------------------------------\n ci/run-docker.sh              | 47 -------------------------\n ci/run-test-slice.sh          |  5 ---\n ci/util/extract-trash-dirs.sh | 50 --------------------------\n 7 files changed, 2 insertions(+), 220 deletions(-)\n delete mode 100755 ci/run-docker-build.sh\n delete mode 100755 ci/run-docker.sh\n delete mode 100755 ci/util/extract-trash-dirs.sh\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 4f12bcaabb9..f32c588f6ad 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -148,9 +148,6 @@ then\n \tCI_COMMIT=\"$BUILD_SOURCEVERSION\"\n \tCI_JOB_ID=\"$BUILD_BUILDID\"\n \tCI_JOB_NUMBER=\"$BUILD_BUILDNUMBER\"\n-\tCI_OS_NAME=\"$(echo \"$AGENT_OS\" | tr A-Z a-z)\"\n-\ttest darwin != \"$CI_OS_NAME\" || CI_OS_NAME=osx\n-\tCI_REPO_SLUG=\"$(expr \"$BUILD_REPOSITORY_URI\" : '.*/\\([^/]*/[^/]*\\)$')\"\n \tCC=\"${CC:-gcc}\"\n \n \t# use a subdirectory of the cache dir (because the file share is shared\n@@ -160,16 +157,13 @@ then\n \texport GIT_PROVE_OPTS=\"--timer --jobs 10 --state=failed,slow,save\"\n \texport GIT_TEST_OPTS=\"--verbose-log -x --write-junit-xml\"\n \tMAKEFLAGS=\"$MAKEFLAGS --jobs=10\"\n-\ttest windows_nt != \"$CI_OS_NAME\" ||\n+\ttest Windows_NT != \"$AGENT_OS\" ||\n \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n elif test true = \"$GITHUB_ACTIONS\"\n then\n \tCI_TYPE=github-actions\n \tCI_BRANCH=\"$GITHUB_REF\"\n \tCI_COMMIT=\"$GITHUB_SHA\"\n-\tCI_OS_NAME=\"$(echo \"$RUNNER_OS\" | tr A-Z a-z)\"\n-\ttest macos != \"$CI_OS_NAME\" || CI_OS_NAME=osx\n-\tCI_REPO_SLUG=\"$GITHUB_REPOSITORY\"\n \tCI_JOB_ID=\"$GITHUB_RUN_ID\"\n \tCC=\"${CC_PACKAGE:-${CC:-gcc}}\"\n \tDONT_SKIP_TAGS=t\n@@ -200,7 +194,7 @@ then\n \texport GIT_PROVE_OPTS=\"--timer --jobs 10\"\n \texport GIT_TEST_OPTS=\"--verbose-log -x --github-workflow-markup\"\n \tMAKEFLAGS=\"$MAKEFLAGS --jobs=10\"\n-\ttest windows != \"$CI_OS_NAME\" ||\n+\ttest Windows != \"$RUNNER_OS\" ||\n \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n else\n \techo \"Could not identify CI type\" >&2\ndiff --git a/ci/print-test-failures.sh b/ci/print-test-failures.sh\nindex 57277eefcd0..740ebb7c529 100755\n--- a/ci/print-test-failures.sh\n+++ b/ci/print-test-failures.sh\n@@ -16,15 +16,6 @@ then\n \texit\n fi\n \n-case \"$jobname\" in\n-osx-clang|osx-gcc)\n-\t# base64 in OSX doesn't wrap its output at 76 columns by\n-\t# default, but prints a single, very long line.\n-\tbase64_opts=\"-b 76\"\n-\t;;\n-esac\n-\n-combined_trash_size=0\n for TEST_EXIT in test-results/*.exit\n do\n \tif [ \"$(cat \"$TEST_EXIT\")\" != \"0\" ]\n@@ -42,47 +33,17 @@ do\n \t\tazure-pipelines)\n \t\t\tmkdir -p failed-test-artifacts\n \t\t\tmv \"$trash_dir\" failed-test-artifacts\n-\t\t\tcontinue\n \t\t\t;;\n \t\tgithub-actions)\n \t\t\tmkdir -p failed-test-artifacts\n \t\t\techo \"FAILED_TEST_ARTIFACTS=t/failed-test-artifacts\" >>$GITHUB_ENV\n \t\t\tcp \"${TEST_EXIT%.exit}.out\" failed-test-artifacts/\n \t\t\ttar czf failed-test-artifacts/\"$test_name\".trash.tar.gz \"$trash_dir\"\n-\t\t\tcontinue\n \t\t\t;;\n \t\t*)\n \t\t\techo \"Unhandled CI type: $CI_TYPE\" >&2\n \t\t\texit 1\n \t\t\t;;\n \t\tesac\n-\t\ttrash_tgz_b64=\"trash.$test_name.base64\"\n-\t\tif [ -d \"$trash_dir\" ]\n-\t\tthen\n-\t\t\ttar czp \"$trash_dir\" |base64 $base64_opts >\"$trash_tgz_b64\"\n-\n-\t\t\ttrash_size=$(wc -c <\"$trash_tgz_b64\")\n-\t\t\tif [ $trash_size -gt 1048576 ]\n-\t\t\tthen\n-\t\t\t\t# larger than 1MB\n-\t\t\t\techo \"$(tput setaf 1)Didn't include the trash directory of '$test_name' in the trace log, it's too big$(tput sgr0)\"\n-\t\t\t\tcontinue\n-\t\t\tfi\n-\n-\t\t\tnew_combined_trash_size=$(($combined_trash_size + $trash_size))\n-\t\t\tif [ $new_combined_trash_size -gt 1048576 ]\n-\t\t\tthen\n-\t\t\t\techo \"$(tput setaf 1)Didn't include the trash directory of '$test_name' in the trace log, there is plenty of trash in there already.$(tput sgr0)\"\n-\t\t\t\tcontinue\n-\t\t\tfi\n-\t\t\tcombined_trash_size=$new_combined_trash_size\n-\n-\t\t\t# DO NOT modify these two 'echo'-ed strings below\n-\t\t\t# without updating 'ci/util/extract-trash-dirs.sh'\n-\t\t\t# as well.\n-\t\t\techo \"$(tput setaf 1)Start of trash directory of '$test_name':$(tput sgr0)\"\n-\t\t\tcat \"$trash_tgz_b64\"\n-\t\t\techo \"$(tput setaf 1)End of trash directory of '$test_name'$(tput sgr0)\"\n-\t\tfi\n \tfi\n done\ndiff --git a/ci/run-build-and-tests.sh b/ci/run-build-and-tests.sh\nindex 8ebff425967..9a5032e6a77 100755\n--- a/ci/run-build-and-tests.sh\n+++ b/ci/run-build-and-tests.sh\n@@ -5,11 +5,6 @@\n \n . ${0%/*}/lib.sh\n \n-case \"$CI_OS_NAME\" in\n-windows*) cmd //c mklink //j t\\\\.prove \"$(cygpath -aw \"$cache_dir/.prove\")\";;\n-*) ln -s \"$cache_dir/.prove\" t/.prove;;\n-esac\n-\n run_tests=t\n \n case \"$jobname\" in\ndiff --git a/ci/run-docker-build.sh b/ci/run-docker-build.sh\ndeleted file mode 100755\nindex 6cd832efb9c..00000000000\n--- a/ci/run-docker-build.sh\n+++ /dev/null\n@@ -1,66 +0,0 @@\n-#!/bin/sh\n-#\n-# Build and test Git inside container\n-#\n-# Usage:\n-#   run-docker-build.sh <host-user-id>\n-#\n-\n-set -ex\n-\n-if test $# -ne 1 || test -z \"$1\"\n-then\n-\techo >&2 \"usage: run-docker-build.sh <host-user-id>\"\n-\texit 1\n-fi\n-\n-case \"$jobname\" in\n-linux32)\n-\tswitch_cmd=\"linux32 --32bit i386\"\n-\t;;\n-linux-musl)\n-\tswitch_cmd=\n-\tuseradd () { adduser -D \"$@\"; }\n-\t;;\n-*)\n-\texit 1\n-\t;;\n-esac\n-\n-\"${0%/*}/install-docker-dependencies.sh\"\n-\n-# If this script runs inside a docker container, then all commands are\n-# usually executed as root. Consequently, the host user might not be\n-# able to access the test output files.\n-# If a non 0 host user id is given, then create a user \"ci\" with that\n-# user id to make everything accessible to the host user.\n-HOST_UID=$1\n-if test $HOST_UID -eq 0\n-then\n-\t# Just in case someone does want to run the test suite as root.\n-\tCI_USER=root\n-else\n-\tCI_USER=ci\n-\tif test \"$(id -u $CI_USER 2>/dev/null)\" = $HOST_UID\n-\tthen\n-\t\techo \"user '$CI_USER' already exists with the requested ID $HOST_UID\"\n-\telse\n-\t\tuseradd -u $HOST_UID $CI_USER\n-\tfi\n-fi\n-\n-# Build and test\n-command $switch_cmd su -m -l $CI_USER -c \"\n-\tset -ex\n-\texport DEVELOPER='$DEVELOPER'\n-\texport DEFAULT_TEST_TARGET='$DEFAULT_TEST_TARGET'\n-\texport GIT_PROVE_OPTS='$GIT_PROVE_OPTS'\n-\texport GIT_TEST_OPTS='$GIT_TEST_OPTS'\n-\texport GIT_TEST_CLONE_2GB='$GIT_TEST_CLONE_2GB'\n-\texport MAKEFLAGS='$MAKEFLAGS'\n-\texport cache_dir='$cache_dir'\n-\tcd /usr/src/git\n-\ttest -n '$cache_dir' && ln -s '$cache_dir/.prove' t/.prove\n-\tmake\n-\tmake test\n-\"\ndiff --git a/ci/run-docker.sh b/ci/run-docker.sh\ndeleted file mode 100755\nindex af89d1624a4..00000000000\n--- a/ci/run-docker.sh\n+++ /dev/null\n@@ -1,47 +0,0 @@\n-#!/bin/sh\n-#\n-# Download and run Docker image to build and test Git\n-#\n-\n-. ${0%/*}/lib.sh\n-\n-case \"$jobname\" in\n-linux32)\n-\tCI_CONTAINER=\"daald/ubuntu32:xenial\"\n-\t;;\n-linux-musl)\n-\tCI_CONTAINER=alpine\n-\t;;\n-*)\n-\texit 1\n-\t;;\n-esac\n-\n-docker pull \"$CI_CONTAINER\"\n-\n-# Use the following command to debug the docker build locally:\n-# <host-user-id> must be 0 if podman is used as drop-in replacement for docker\n-# $ docker run -itv \"${PWD}:/usr/src/git\" --entrypoint /bin/sh \"$CI_CONTAINER\"\n-# root@container:/# export jobname=<jobname>\n-# root@container:/# /usr/src/git/ci/run-docker-build.sh <host-user-id>\n-\n-container_cache_dir=/tmp/container-cache\n-\n-docker run \\\n-\t--interactive \\\n-\t--env DEVELOPER \\\n-\t--env DEFAULT_TEST_TARGET \\\n-\t--env GIT_PROVE_OPTS \\\n-\t--env GIT_TEST_OPTS \\\n-\t--env GIT_TEST_CLONE_2GB \\\n-\t--env MAKEFLAGS \\\n-\t--env jobname \\\n-\t--env cache_dir=\"$container_cache_dir\" \\\n-\t--volume \"${PWD}:/usr/src/git\" \\\n-\t--volume \"$cache_dir:$container_cache_dir\" \\\n-\t\"$CI_CONTAINER\" \\\n-\t/usr/src/git/ci/run-docker-build.sh $(id -u $USER)\n-\n-check_unignored_build_artifacts\n-\n-save_good_tree\ndiff --git a/ci/run-test-slice.sh b/ci/run-test-slice.sh\nindex a3c67956a8d..312a3ef73fe 100755\n--- a/ci/run-test-slice.sh\n+++ b/ci/run-test-slice.sh\n@@ -5,11 +5,6 @@\n \n . ${0%/*}/lib.sh\n \n-case \"$CI_OS_NAME\" in\n-windows*) cmd //c mklink //j t\\\\.prove \"$(cygpath -aw \"$cache_dir/.prove\")\";;\n-*) ln -s \"$cache_dir/.prove\" t/.prove;;\n-esac\n-\n group \"Run tests\" make --quiet -C t T=\"$(cd t &&\n \t./helper/test-tool path-utils slice-tests \"$1\" \"$2\" t[0-9]*.sh |\n \ttr '\\n' ' ')\" ||\ndiff --git a/ci/util/extract-trash-dirs.sh b/ci/util/extract-trash-dirs.sh\ndeleted file mode 100755\nindex 8e67bec21a2..00000000000\n--- a/ci/util/extract-trash-dirs.sh\n+++ /dev/null\n@@ -1,50 +0,0 @@\n-#!/bin/sh\n-\n-error () {\n-\techo >&2 \"error: $@\"\n-\texit 1\n-}\n-\n-find_embedded_trash () {\n-\twhile read -r line\n-\tdo\n-\t\tcase \"$line\" in\n-\t\t*Start\\ of\\ trash\\ directory\\ of\\ \\'t[0-9][0-9][0-9][0-9]-*\\':*)\n-\t\t\ttest_name=\"${line#*\\'}\"\n-\t\t\ttest_name=\"${test_name%\\'*}\"\n-\n-\t\t\treturn 0\n-\t\tesac\n-\tdone\n-\n-\treturn 1\n-}\n-\n-extract_embedded_trash () {\n-\twhile read -r line\n-\tdo\n-\t\tcase \"$line\" in\n-\t\t*End\\ of\\ trash\\ directory\\ of\\ \\'$test_name\\'*)\n-\t\t\treturn\n-\t\t\t;;\n-\t\t*)\n-\t\t\tprintf '%s\\n' \"$line\"\n-\t\t\t;;\n-\t\tesac\n-\tdone\n-\n-\terror \"unexpected end of input\"\n-}\n-\n-# Raw logs from Linux build jobs have CRLF line endings, while OSX\n-# build jobs mostly have CRCRLF, except an odd line every now and\n-# then that has CRCRCRLF.  'base64 -d' from 'coreutils' doesn't like\n-# CRs and complains about \"invalid input\", so remove all CRs at the\n-# end of lines.\n-sed -e 's/\\r*$//' | \\\n-while find_embedded_trash\n-do\n-\techo \"Extracting trash directory of '$test_name'\"\n-\n-\textract_embedded_trash |base64 -d |tar xzp\n-done\n-- \n2.37.1.996.g651fc6e809f\n\n"},{"id":"459072","messageId":"patch-03.10-10ea16766f1-20220714T193808Z-avarab@gmail.com","threadId":"58161","inReplyTo":"cover-00.10-00000000000-20220714T193808Z-avarab@gmail.com","subject":"[PATCH 03/10] CI: remove dead \"tree skipping\" code","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-07-14T19:39:40Z","receivedAt":"2022-07-14T19:40:08Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Remove the code related to skipping CI runs if the tree was\nsuccessfully tested before. With the GitHub CI this is done with the\n\"ci-config\" step, see e76eec35540 (ci: allow per-branch config for\nGitHub Actions, 2020-05-07) and 7d78d5fc1a9 (ci: skip GitHub workflow\nruns for already-tested commits/trees, 2020-10-08).\n\nThis code hasn't been used since 4a6e4b96026 (CI: remove Travis CI\nsupport, 2021-11-23). At one point it was used for the now-removed\nAzure Pipelines support. That support was removed in 6081d3898fe (ci:\nretire the Azure Pipelines definition, 2020-04-11), but before in\n50b206371d2 (travis: remove the hack to build the Windows job on Azure\nPipelines, 2019-02-28) the \"save_good_tree\" function had not been\ncalled by the Azure Pipelines code.\n\nTherefore even for those who'd like to resurrect the\nazure-pipelines.yml for occasional ad-hoc use (see the thread(s)\nstarting at [1]) this change should be OK. This code was really only\nused for the now-removed Travis CI.\n\nThis change also removes a subtle potential logic error introduced in\n0e7696c64db (ci: disallow directional formatting, 2021-11-04). The\n\"ci/check-directional-formatting.bash\" script would have been made to\nrun after the \"save_good_tree\" in invoked in\n\"ci/run-static-analysis.sh\". So if e.g. the \"make coccicheck\" failed\nwe'd still mark the tree as good.\n\nI.e. the addition of \"ci/check-directional-formatting.bash\" didn't\ntake into account that the various users of the \"save_good_tree\"\nfunction in ci/*.sh made a hard assumption that they're the only\nci/*.sh script that's being run (and they use \"set -e\").\n\nThis is entirely academic since we weren't actually running this code,\nbut is something to be careful of if anyone ever needs to resurrect\nparts of this.\n\nFinally, the cache_dir=\"$HOME/none\" added in a3f2eec862b (ci/lib:\nallow running in GitHub Actions, 2020-04-08) for the GitHub CI can be\nremoved. It appears to have been added to appease the subsequent\n'mkdir -p \"$cache_dir\"', which wasn't needed in GitHub CI.\n\n1. https://lore.kernel.org/git/220609.86r13xsj00.gmgdl@evledraar.gmail.com/\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh                 | 91 ---------------------------------------\n ci/run-build-and-tests.sh |  2 -\n ci/run-static-analysis.sh |  2 -\n ci/test-documentation.sh  |  2 -\n 4 files changed, 97 deletions(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex f32c588f6ad..fcb79c83087 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -52,75 +52,6 @@ else\n \tbegin_group \"CI setup\"\n fi\n \n-skip_branch_tip_with_tag () {\n-\t# Sometimes, a branch is pushed at the same time the tag that points\n-\t# at the same commit as the tip of the branch is pushed, and building\n-\t# both at the same time is a waste.\n-\t#\n-\t# When the build is triggered by a push to a tag, $CI_BRANCH will\n-\t# have that tagname, e.g. v2.14.0.  Let's see if $CI_BRANCH is\n-\t# exactly at a tag, and if so, if it is different from $CI_BRANCH.\n-\t# That way, we can tell if we are building the tip of a branch that\n-\t# is tagged and we can skip the build because we won't be skipping a\n-\t# build of a tag.\n-\n-\tif TAG=$(git describe --exact-match \"$CI_BRANCH\" 2>/dev/null) &&\n-\t\ttest \"$TAG\" != \"$CI_BRANCH\"\n-\tthen\n-\t\techo \"$(tput setaf 2)Tip of $CI_BRANCH is exactly at $TAG$(tput sgr0)\"\n-\t\texit 0\n-\tfi\n-}\n-\n-# Save some info about the current commit's tree, so we can skip the build\n-# job if we encounter the same tree again and can provide a useful info\n-# message.\n-save_good_tree () {\n-\techo \"$(git rev-parse $CI_COMMIT^{tree}) $CI_COMMIT $CI_JOB_NUMBER $CI_JOB_ID\" >>\"$good_trees_file\"\n-\t# limit the file size\n-\ttail -1000 \"$good_trees_file\" >\"$good_trees_file\".tmp\n-\tmv \"$good_trees_file\".tmp \"$good_trees_file\"\n-}\n-\n-# Skip the build job if the same tree has already been built and tested\n-# successfully before (e.g. because the branch got rebased, changing only\n-# the commit messages).\n-skip_good_tree () {\n-\tif test true = \"$GITHUB_ACTIONS\"\n-\tthen\n-\t\treturn\n-\tfi\n-\n-\tif ! good_tree_info=\"$(grep \"^$(git rev-parse $CI_COMMIT^{tree}) \" \"$good_trees_file\")\"\n-\tthen\n-\t\t# Haven't seen this tree yet, or no cached good trees file yet.\n-\t\t# Continue the build job.\n-\t\treturn\n-\tfi\n-\n-\techo \"$good_tree_info\" | {\n-\t\tread tree prev_good_commit prev_good_job_number prev_good_job_id\n-\n-\t\tif test \"$CI_JOB_ID\" = \"$prev_good_job_id\"\n-\t\tthen\n-\t\t\tcat <<-EOF\n-\t\t\t$(tput setaf 2)Skipping build job for commit $CI_COMMIT.$(tput sgr0)\n-\t\t\tThis commit has already been built and tested successfully by this build job.\n-\t\t\tTo force a re-build delete the branch's cache and then hit 'Restart job'.\n-\t\t\tEOF\n-\t\telse\n-\t\t\tcat <<-EOF\n-\t\t\t$(tput setaf 2)Skipping build job for commit $CI_COMMIT.$(tput sgr0)\n-\t\t\tThis commit's tree has already been built and tested successfully in build job $prev_good_job_number for commit $prev_good_commit.\n-\t\t\tThe log of that build job is available at $SYSTEM_TASKDEFINITIONSURI$SYSTEM_TEAMPROJECT/_build/results?buildId=$prev_good_job_id\n-\t\t\tTo force a re-build delete the branch's cache and then hit 'Restart job'.\n-\t\t\tEOF\n-\t\tfi\n-\t}\n-\n-\texit 0\n-}\n-\n check_unignored_build_artifacts () {\n \t! git ls-files --other --exclude-standard --error-unmatch \\\n \t\t-- ':/*' 2>/dev/null ||\n@@ -144,16 +75,8 @@ if test -n \"$SYSTEM_COLLECTIONURI\" || test -n \"$SYSTEM_TASKDEFINITIONSURI\"\n then\n \tCI_TYPE=azure-pipelines\n \t# We are running in Azure Pipelines\n-\tCI_BRANCH=\"$BUILD_SOURCEBRANCH\"\n-\tCI_COMMIT=\"$BUILD_SOURCEVERSION\"\n-\tCI_JOB_ID=\"$BUILD_BUILDID\"\n-\tCI_JOB_NUMBER=\"$BUILD_BUILDNUMBER\"\n \tCC=\"${CC:-gcc}\"\n \n-\t# use a subdirectory of the cache dir (because the file share is shared\n-\t# among *all* phases)\n-\tcache_dir=\"$HOME/test-cache/$SYSTEM_PHASENAME\"\n-\n \texport GIT_PROVE_OPTS=\"--timer --jobs 10 --state=failed,slow,save\"\n \texport GIT_TEST_OPTS=\"--verbose-log -x --write-junit-xml\"\n \tMAKEFLAGS=\"$MAKEFLAGS --jobs=10\"\n@@ -162,11 +85,7 @@ then\n elif test true = \"$GITHUB_ACTIONS\"\n then\n \tCI_TYPE=github-actions\n-\tCI_BRANCH=\"$GITHUB_REF\"\n-\tCI_COMMIT=\"$GITHUB_SHA\"\n-\tCI_JOB_ID=\"$GITHUB_RUN_ID\"\n \tCC=\"${CC_PACKAGE:-${CC:-gcc}}\"\n-\tDONT_SKIP_TAGS=t\n \thandle_failed_tests () {\n \t\tmkdir -p t/failed-test-artifacts\n \t\techo \"FAILED_TEST_ARTIFACTS=t/failed-test-artifacts\" >>$GITHUB_ENV\n@@ -189,8 +108,6 @@ then\n \t\treturn 1\n \t}\n \n-\tcache_dir=\"$HOME/none\"\n-\n \texport GIT_PROVE_OPTS=\"--timer --jobs 10\"\n \texport GIT_TEST_OPTS=\"--verbose-log -x --github-workflow-markup\"\n \tMAKEFLAGS=\"$MAKEFLAGS --jobs=10\"\n@@ -202,14 +119,6 @@ else\n \texit 1\n fi\n \n-good_trees_file=\"$cache_dir/good-trees\"\n-\n-mkdir -p \"$cache_dir\"\n-\n-test -n \"${DONT_SKIP_TAGS-}\" ||\n-skip_branch_tip_with_tag\n-skip_good_tree\n-\n if test -z \"$jobname\"\n then\n \tjobname=\"$CI_OS_NAME-$CC\"\ndiff --git a/ci/run-build-and-tests.sh b/ci/run-build-and-tests.sh\nindex 9a5032e6a77..1a89a4967bf 100755\n--- a/ci/run-build-and-tests.sh\n+++ b/ci/run-build-and-tests.sh\n@@ -47,5 +47,3 @@ then\n \thandle_failed_tests\n fi\n check_unignored_build_artifacts\n-\n-save_good_tree\ndiff --git a/ci/run-static-analysis.sh b/ci/run-static-analysis.sh\nindex 0d51e5ce0e7..faae31f0078 100755\n--- a/ci/run-static-analysis.sh\n+++ b/ci/run-static-analysis.sh\n@@ -30,5 +30,3 @@ make hdr-check ||\n exit 1\n \n make check-pot\n-\n-save_good_tree\ndiff --git a/ci/test-documentation.sh b/ci/test-documentation.sh\nindex de41888430a..9e0652c30dd 100755\n--- a/ci/test-documentation.sh\n+++ b/ci/test-documentation.sh\n@@ -41,5 +41,3 @@ grep '<meta name=\"generator\" content=\"Asciidoctor ' Documentation/git.html\n \n rm -f stdout.log stderr.log stderr.raw\n check_unignored_build_artifacts\n-\n-save_good_tree\n-- \n2.37.1.996.g651fc6e809f\n\n"},{"id":"459073","messageId":"patch-04.10-5d1df78d0de-20220714T193808Z-avarab@gmail.com","threadId":"58161","inReplyTo":"cover-00.10-00000000000-20220714T193808Z-avarab@gmail.com","subject":"[PATCH 04/10] CI: make \"$jobname\" explicit, remove fallback","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-07-14T19:39:41Z","receivedAt":"2022-07-14T19:40:11Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Remove the $jobname fallback last adjusted in b011fabd6e0 (ci/lib.sh:\nencapsulate Travis-specific things, 2019-01-27).\n\nThis makes all of our CI jobs have an explicit $jobname, and removes\nthe special-case of the Windows jobs implicitly setting one (that they\ndon't currently use).\n\nThis is a follow-up to my 25715419bf4 (CI: don't run \"make test\" twice\nin one job, 2021-11-23), since then all the jobs except the Windows\njobs have had an explicit $jobname.\n\nIn the case of the Windows jobs we were using a jobname of windows-gcc\nfor both, due to picking \"gcc\" as a default fallback for \"$CC\" in\nci/lib.sh.\n\nSince we'll need this to run ci/lib.sh it makes sense to move the\ncheck to the top of the file.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml |  7 +++++++\n ci/lib.sh                  | 12 +++++++-----\n 2 files changed, 14 insertions(+), 5 deletions(-)\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex cd1f52692a5..8b7697df9fb 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -79,6 +79,8 @@ jobs:\n \n   windows-build:\n     name: win build\n+    env:\n+      jobname: windows-build\n     needs: ci-config\n     if: needs.ci-config.outputs.enabled == 'yes'\n     runs-on: windows-latest\n@@ -100,6 +102,8 @@ jobs:\n         path: artifacts\n   windows-test:\n     name: win test\n+    env:\n+      jobname: windows-test\n     runs-on: windows-latest\n     needs: [windows-build]\n     strategy:\n@@ -134,6 +138,7 @@ jobs:\n     needs: ci-config\n     if: needs.ci-config.outputs.enabled == 'yes'\n     env:\n+      jobname: vs-build\n       NO_PERL: 1\n       GIT_CONFIG_PARAMETERS: \"'user.name=CI' 'user.email=ci@git'\"\n     runs-on: windows-latest\n@@ -183,6 +188,8 @@ jobs:\n         path: artifacts\n   vs-test:\n     name: win+VS test\n+    env:\n+      jobname: vs-test\n     runs-on: windows-latest\n     needs: vs-build\n     strategy:\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex fcb79c83087..969ba2ff0d0 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -8,6 +8,13 @@\n # are installed.\n set -e\n \n+# Starting assertions\n+if test -z \"$jobname\"\n+then\n+\techo \"error: must set a CI jobname in the environment\" >&2\n+\texit 1\n+fi\n+\n if test true != \"$GITHUB_ACTIONS\"\n then\n \tbegin_group () { :; }\n@@ -119,11 +126,6 @@ else\n \texit 1\n fi\n \n-if test -z \"$jobname\"\n-then\n-\tjobname=\"$CI_OS_NAME-$CC\"\n-fi\n-\n export DEVELOPER=1\n export DEFAULT_TEST_TARGET=prove\n export GIT_TEST_CLONE_2GB=true\n-- \n2.37.1.996.g651fc6e809f\n\n"},{"id":"459074","messageId":"patch-05.10-ee36d4eb2a9-20220714T193808Z-avarab@gmail.com","threadId":"58161","inReplyTo":"cover-00.10-00000000000-20220714T193808Z-avarab@gmail.com","subject":"[PATCH 05/10] CI/lib.sh: stop adding leading whitespace to $MAKEFLAGS","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-07-14T19:39:42Z","receivedAt":"2022-07-14T19:40:13Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"In a8c51f77d16 (ci: clear and mark MAKEFLAGS exported just once,\n2019-02-07) the assignment of MAKEFLAGS was done up-front to\nfuture-proof this code for the bug fixed in 406f93ae488 (ci: make sure\nwe build Git parallel, 2019-02-07).\n\nBut since 4a6e4b96026 (CI: remove Travis CI support, 2021-11-23) the\n--jobs=10 has been an invariant here, so let's assign --jobs=$NPROC to\nthe MAKEFLAGS right away, this gets rid of the leading whitespace from\nthe $MAKEFLAGS variable, as it would previously be empty on the first\nassignment.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh | 11 ++++++-----\n 1 file changed, 6 insertions(+), 5 deletions(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 969ba2ff0d0..3591919ba44 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -75,8 +75,11 @@ handle_failed_tests () {\n # GitHub Action doesn't set TERM, which is required by tput\n export TERM=${TERM:-dumb}\n \n+# How many jobs to run in parallel?\n+NPROC=10\n+\n # Clear MAKEFLAGS that may come from the outside world.\n-export MAKEFLAGS=\n+export MAKEFLAGS=--jobs=$NPROC\n \n if test -n \"$SYSTEM_COLLECTIONURI\" || test -n \"$SYSTEM_TASKDEFINITIONSURI\"\n then\n@@ -84,9 +87,8 @@ then\n \t# We are running in Azure Pipelines\n \tCC=\"${CC:-gcc}\"\n \n-\texport GIT_PROVE_OPTS=\"--timer --jobs 10 --state=failed,slow,save\"\n+\texport GIT_PROVE_OPTS=\"--timer --jobs $NPROC --state=failed,slow,save\"\n \texport GIT_TEST_OPTS=\"--verbose-log -x --write-junit-xml\"\n-\tMAKEFLAGS=\"$MAKEFLAGS --jobs=10\"\n \ttest Windows_NT != \"$AGENT_OS\" ||\n \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n elif test true = \"$GITHUB_ACTIONS\"\n@@ -115,9 +117,8 @@ then\n \t\treturn 1\n \t}\n \n-\texport GIT_PROVE_OPTS=\"--timer --jobs 10\"\n+\texport GIT_PROVE_OPTS=\"--timer --jobs $NPROC\"\n \texport GIT_TEST_OPTS=\"--verbose-log -x --github-workflow-markup\"\n-\tMAKEFLAGS=\"$MAKEFLAGS --jobs=10\"\n \ttest Windows != \"$RUNNER_OS\" ||\n \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n else\n-- \n2.37.1.996.g651fc6e809f\n\n"},{"id":"459075","messageId":"patch-06.10-7cbf8191105-20220714T193808Z-avarab@gmail.com","threadId":"58161","inReplyTo":"cover-00.10-00000000000-20220714T193808Z-avarab@gmail.com","subject":"[PATCH 06/10] CI: consistently use \"export\" in ci/lib.sh","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-07-14T19:39:43Z","receivedAt":"2022-07-14T19:40:16Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change the \"ci/lib.sh\" script to consistently use \"export\", for\ne.g. MAKEFLAGS we were exporting it, and then assigning to it, let's\ndo it the other way around.\n\nRight now this doesn't matter, since we in\ne.g. \"ci/install-dependencies.sh\" source this file, and don't use\nsomething like \"env(1)\" to retrieve these variables.\n\nBut in a subsequent commit we'll \"export\" these variables through a\nwrapper (and to eventually write them to a GitHub CI-specific\n$GITHUB_ENV file). This change makes that subsequent change easier to\nread, as it won't need to do any control flow refactoring.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh | 9 ++++++---\n 1 file changed, 6 insertions(+), 3 deletions(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 3591919ba44..44039152ebc 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -79,7 +79,7 @@ export TERM=${TERM:-dumb}\n NPROC=10\n \n # Clear MAKEFLAGS that may come from the outside world.\n-export MAKEFLAGS=--jobs=$NPROC\n+MAKEFLAGS=--jobs=$NPROC\n \n if test -n \"$SYSTEM_COLLECTIONURI\" || test -n \"$SYSTEM_TASKDEFINITIONSURI\"\n then\n@@ -88,9 +88,10 @@ then\n \tCC=\"${CC:-gcc}\"\n \n \texport GIT_PROVE_OPTS=\"--timer --jobs $NPROC --state=failed,slow,save\"\n-\texport GIT_TEST_OPTS=\"--verbose-log -x --write-junit-xml\"\n+\tGIT_TEST_OPTS=\"--verbose-log -x --write-junit-xml\"\n \ttest Windows_NT != \"$AGENT_OS\" ||\n \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n+\texport GIT_TEST_OPTS\n elif test true = \"$GITHUB_ACTIONS\"\n then\n \tCI_TYPE=github-actions\n@@ -118,9 +119,10 @@ then\n \t}\n \n \texport GIT_PROVE_OPTS=\"--timer --jobs $NPROC\"\n-\texport GIT_TEST_OPTS=\"--verbose-log -x --github-workflow-markup\"\n+\tGIT_TEST_OPTS=\"--verbose-log -x --github-workflow-markup\"\n \ttest Windows != \"$RUNNER_OS\" ||\n \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n+\texport GIT_TEST_OPTS\n else\n \techo \"Could not identify CI type\" >&2\n \tenv >&2\n@@ -187,6 +189,7 @@ linux-leaks)\n esac\n \n MAKEFLAGS=\"$MAKEFLAGS CC=${CC:-cc}\"\n+export MAKEFLAGS\n \n end_group\n set -x\n-- \n2.37.1.996.g651fc6e809f\n\n"},{"id":"459076","messageId":"patch-07.10-e6805874eb9-20220714T193808Z-avarab@gmail.com","threadId":"58161","inReplyTo":"cover-00.10-00000000000-20220714T193808Z-avarab@gmail.com","subject":"[PATCH 07/10] CI: export variables via a wrapper","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-07-14T19:39:44Z","receivedAt":"2022-07-14T19:40:24Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Add and use a \"setenv\" wrapper to export the variables set in\nci/lib.sh.\n\nFor now this merely adds debugging information about what variables\nare set, but in a subsequent commit we'll expand this to set variables\nin $GITHUB_ENV instead of the environment, and thus carry variable\nsettings between steps in a job.\n\nWe'll also eventually be interested in what type of variable we're\nsetting, and when it needs to be used, because we'll prominently\nexpose what variables we set in what CI \"step\", so having only the\nones we actually use will improve readability.\n\nTo that end call the \"setenv\" function with optional \"--install\",\n\"--build\", \"--test\" and \"--all\" parameters to indicate whether they're\nneeded for building, testing or both.\n\nWe currently ignore the \"varname\" parameter, but will make use of it in a\nsubsequent commit. Adding it here reduces the needless churn, as we\nwon't need to change all these lines again for that subsequent change.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh                 | 69 +++++++++++++++++++++++++++++----------\n ci/run-build-and-tests.sh | 34 +++++++++----------\n 2 files changed, 68 insertions(+), 35 deletions(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 44039152ebc..67b7b32a0f1 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -59,6 +59,38 @@ else\n \tbegin_group \"CI setup\"\n fi\n \n+# Helper functions\n+setenv () {\n+\twhile test $# != 0\n+\tdo\n+\t\tcase \"$1\" in\n+\t\t--install)\n+\t\t\t;;\n+\t\t--build)\n+\t\t\t;;\n+\t\t--test)\n+\t\t\t;;\n+\t\t--all)\n+\t\t\t;;\n+\t\t-*)\n+\t\t\techo \"BUG: bad setenv() option '$1'\" >&2\n+\t\t\texit 1\n+\t\t\t;;\n+\t\t*)\n+\t\t\tbreak\n+\t\t\t;;\n+\t\tesac\n+\t\tshift\n+\tdone\n+\n+\tkey=$1\n+\tval=$2\n+\tshift 2\n+\n+\teval \"$key=\\\"$val\\\"\"\n+\teval \"export $key\"\n+}\n+\n check_unignored_build_artifacts () {\n \t! git ls-files --other --exclude-standard --error-unmatch \\\n \t\t-- ':/*' 2>/dev/null ||\n@@ -73,7 +105,7 @@ handle_failed_tests () {\n }\n \n # GitHub Action doesn't set TERM, which is required by tput\n-export TERM=${TERM:-dumb}\n+setenv --all TERM ${TERM:-dumb}\n \n # How many jobs to run in parallel?\n NPROC=10\n@@ -87,11 +119,11 @@ then\n \t# We are running in Azure Pipelines\n \tCC=\"${CC:-gcc}\"\n \n-\texport GIT_PROVE_OPTS=\"--timer --jobs $NPROC --state=failed,slow,save\"\n+\tsetenv --test GIT_PROVE_OPTS \"--timer --jobs $NPROC --state=failed,slow,save\"\n \tGIT_TEST_OPTS=\"--verbose-log -x --write-junit-xml\"\n \ttest Windows_NT != \"$AGENT_OS\" ||\n \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n-\texport GIT_TEST_OPTS\n+\tsetenv --test GIT_TEST_OPTS \"$GIT_TEST_OPTS\"\n elif test true = \"$GITHUB_ACTIONS\"\n then\n \tCI_TYPE=github-actions\n@@ -118,21 +150,21 @@ then\n \t\treturn 1\n \t}\n \n-\texport GIT_PROVE_OPTS=\"--timer --jobs $NPROC\"\n+\tsetenv --test GIT_PROVE_OPTS \"--timer --jobs $NPROC\"\n \tGIT_TEST_OPTS=\"--verbose-log -x --github-workflow-markup\"\n \ttest Windows != \"$RUNNER_OS\" ||\n \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n-\texport GIT_TEST_OPTS\n+\tsetenv --test GIT_TEST_OPTS \"$GIT_TEST_OPTS\"\n else\n \techo \"Could not identify CI type\" >&2\n \tenv >&2\n \texit 1\n fi\n \n-export DEVELOPER=1\n-export DEFAULT_TEST_TARGET=prove\n-export GIT_TEST_CLONE_2GB=true\n-export SKIP_DASHED_BUILT_INS=YesPlease\n+setenv --build DEVELOPER 1\n+setenv --test DEFAULT_TEST_TARGET prove\n+setenv --test GIT_TEST_CLONE_2GB true\n+setenv --build SKIP_DASHED_BUILT_INS YesPlease\n \n case \"$runs_on_pool\" in\n ubuntu-latest)\n@@ -148,19 +180,20 @@ ubuntu-latest)\n \t\tMAKEFLAGS=\"$MAKEFLAGS PYTHON_PATH=/usr/bin/python2\"\n \tfi\n \n-\texport GIT_TEST_HTTPD=true\n+\tsetenv --test GIT_TEST_HTTPD true\n \n \t# The Linux build installs the defined dependency versions below.\n \t# The OS X build installs much more recent versions, whichever\n \t# were recorded in the Homebrew database upon creating the OS X\n \t# image.\n \t# Keep that in mind when you encounter a broken OS X build!\n-\texport LINUX_P4_VERSION=\"16.2\"\n-\texport LINUX_GIT_LFS_VERSION=\"1.5.2\"\n+\tsetenv --install LINUX_P4_VERSION \"16.2\"\n+\tsetenv --install LINUX_GIT_LFS_VERSION \"1.5.2\"\n \n-\tP4_PATH=\"$HOME/custom/p4\"\n-\tGIT_LFS_PATH=\"$HOME/custom/git-lfs\"\n-\texport PATH=\"$GIT_LFS_PATH:$P4_PATH:$PATH\"\n+\tsetenv --install P4_PATH \"$HOME/custom/p4\"\n+\tsetenv --install GIT_LFS_PATH \"$HOME/custom/git-lfs\"\n+\tsetenv --all PATH \"$GIT_LFS_PATH:$P4_PATH:$PATH\"\n+\tsetenv --test GIT_TEST_HTTPD true\n \t;;\n macos-latest)\n \tif [ \"$jobname\" = osx-gcc ]\n@@ -183,13 +216,13 @@ linux-musl)\n \tMAKEFLAGS=\"$MAKEFLAGS GIT_TEST_UTF8_LOCALE=C.UTF-8\"\n \t;;\n linux-leaks)\n-\texport SANITIZE=leak\n-\texport GIT_TEST_PASSING_SANITIZE_LEAK=true\n+\tsetenv --build SANITIZE leak\n+\tsetenv --test GIT_TEST_PASSING_SANITIZE_LEAK true\n \t;;\n esac\n \n MAKEFLAGS=\"$MAKEFLAGS CC=${CC:-cc}\"\n-export MAKEFLAGS\n+setenv --all MAKEFLAGS \"$MAKEFLAGS\"\n \n end_group\n set -x\ndiff --git a/ci/run-build-and-tests.sh b/ci/run-build-and-tests.sh\nindex 1a89a4967bf..b7774e4abcf 100755\n--- a/ci/run-build-and-tests.sh\n+++ b/ci/run-build-and-tests.sh\n@@ -9,33 +9,33 @@ run_tests=t\n \n case \"$jobname\" in\n linux-gcc)\n-\texport GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main\n+\tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME main\n \t;;\n linux-TEST-vars)\n-\texport GIT_TEST_SPLIT_INDEX=yes\n-\texport GIT_TEST_MERGE_ALGORITHM=recursive\n-\texport GIT_TEST_FULL_IN_PACK_ARRAY=true\n-\texport GIT_TEST_OE_SIZE=10\n-\texport GIT_TEST_OE_DELTA_SIZE=5\n-\texport GIT_TEST_COMMIT_GRAPH=1\n-\texport GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS=1\n-\texport GIT_TEST_MULTI_PACK_INDEX=1\n-\texport GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP=1\n-\texport GIT_TEST_ADD_I_USE_BUILTIN=0\n-\texport GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master\n-\texport GIT_TEST_WRITE_REV_INDEX=1\n-\texport GIT_TEST_CHECKOUT_WORKERS=2\n+\tsetenv --test GIT_TEST_SPLIT_INDEX yes\n+\tsetenv --test GIT_TEST_MERGE_ALGORITHM recursive\n+\tsetenv --test GIT_TEST_FULL_IN_PACK_ARRAY true\n+\tsetenv --test GIT_TEST_OE_SIZE 10\n+\tsetenv --test GIT_TEST_OE_DELTA_SIZE 5\n+\tsetenv --test GIT_TEST_COMMIT_GRAPH 1\n+\tsetenv --test GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS 1\n+\tsetenv --test GIT_TEST_MULTI_PACK_INDEX 1\n+\tsetenv --test GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP 1\n+\tsetenv --test GIT_TEST_ADD_I_USE_BUILTIN 0\n+\tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME master\n+\tsetenv --test GIT_TEST_WRITE_REV_INDEX 1\n+\tsetenv --test GIT_TEST_CHECKOUT_WORKERS 2\n \t;;\n linux-clang)\n-\texport GIT_TEST_DEFAULT_HASH=sha1\n+\tsetenv --test GIT_TEST_DEFAULT_HASH sha1\n \t;;\n linux-sha256)\n-\texport GIT_TEST_DEFAULT_HASH=sha256\n+\tsetenv --test GIT_TEST_DEFAULT_HASH sha256\n \t;;\n pedantic)\n \t# Don't run the tests; we only care about whether Git can be\n \t# built.\n-\texport DEVOPTS=pedantic\n+\tsetenv --build DEVOPTS pedantic\n \trun_tests=\n \t;;\n esac\n-- \n2.37.1.996.g651fc6e809f\n\n"},{"id":"459077","messageId":"patch-08.10-8bcaeb1dd79-20220714T193808Z-avarab@gmail.com","threadId":"58161","inReplyTo":"cover-00.10-00000000000-20220714T193808Z-avarab@gmail.com","subject":"[PATCH 08/10] CI: don't have \"git grep\" invoke a pager in tree content check","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-07-14T19:39:45Z","receivedAt":"2022-07-14T19:40:28Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Fix the omission of not adding \"-P\" (a.k.a. \"--no-pager\") to the \"git\"\ninvocation that spaws \"git grep\", added in 0e7696c64db (ci: disallow\ndirectional formatting, 2021-11-04).\n\nThis didn't matter for the GitHub CI, but does when running the check\nlocally. A subsequent commit will start invoking it via a new check\nfrom the top-level Makefile, and without this we'd visibly spawn a\npager when doing so.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/check-directional-formatting.bash | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/ci/check-directional-formatting.bash b/ci/check-directional-formatting.bash\nindex e6211b141aa..de8e6e486f0 100755\n--- a/ci/check-directional-formatting.bash\n+++ b/ci/check-directional-formatting.bash\n@@ -23,5 +23,5 @@\n # U+2066..U+2069: LRI, RLI, FSI and PDI\n regex='(\\u202a|\\u202b|\\u202c|\\u202d|\\u202e|\\u2066|\\u2067|\\u2068|\\u2069)'\n \n-! LC_CTYPE=C git grep -El \"$(LC_CTYPE=C.UTF-8 printf \"$regex\")\" \\\n+! LC_CTYPE=C git -P grep -El \"$(LC_CTYPE=C.UTF-8 printf \"$regex\")\" \\\n \t-- ':(exclude,attr:binary)' ':(exclude)*.po'\n-- \n2.37.1.996.g651fc6e809f\n\n"},{"id":"459078","messageId":"patch-10.10-5ef362505c1-20220714T193808Z-avarab@gmail.com","threadId":"58161","inReplyTo":"cover-00.10-00000000000-20220714T193808Z-avarab@gmail.com","subject":"[PATCH 10/10] CI: have \"static-analysis\" run \"check-builtins\", not \"documentation\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-07-14T19:39:47Z","receivedAt":"2022-07-14T19:40:30Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Move the \"make check-builtins\" check from the \"documentation\" job to\nthe \"static-analysis\" job.\n\nThe \"check-builtins\" target added in c74390e4a1d (cherry is built-in,\ndo not ship git-cherry.sh, 2006-11-05) is unrelated to the\ndocumentation, so it's odd that b98712b9aa9 (travis-ci: build\ndocumentation, 2016-05-04) added it to the \"documentation\" job.\n\nLet's just move it to the \"ci-static-analysis\" target, and while we're\nat it improve the output with $(QUIET_CHECK).\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n Makefile                 | 3 ++-\n ci/test-documentation.sh | 1 -\n 2 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex c328e190d64..c2b0a728df5 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -3520,7 +3520,7 @@ check-docs::\n ### Make sure built-ins do not have dups and listed in git.c\n #\n check-builtins::\n-\t./check-builtins.sh\n+\t$(QUIET_CHECK)./check-builtins.sh\n \n ### Test suite coverage testing\n #\n@@ -3615,6 +3615,7 @@ ci-check-directional-formatting:\n \n .PHONY: ci-static-analysis\n ci-static-analysis: ci-check-directional-formatting\n+ci-static-analysis: check-builtins\n ci-static-analysis: check-coccicheck\n ci-static-analysis: hdr-check\n ci-static-analysis: check-pot\ndiff --git a/ci/test-documentation.sh b/ci/test-documentation.sh\nindex 9e0652c30dd..41e2b126311 100755\n--- a/ci/test-documentation.sh\n+++ b/ci/test-documentation.sh\n@@ -14,7 +14,6 @@ filter_log () {\n \t    \"$1\"\n }\n \n-make check-builtins\n make check-docs\n \n # Build docs with AsciiDoc\n-- \n2.37.1.996.g651fc6e809f\n\n"},{"id":"459079","messageId":"patch-09.10-95b9c3797c0-20220714T193808Z-avarab@gmail.com","threadId":"58161","inReplyTo":"cover-00.10-00000000000-20220714T193808Z-avarab@gmail.com","subject":"[PATCH 09/10] CI: have \"static-analysis\" run a \"make ci-static-analysis\" target","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-07-14T19:39:46Z","receivedAt":"2022-07-14T19:40:31Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Make it easier to run the CI logic locally by creating\n\"ci-static-analysis\" target.\n\nNow the \"check-coccicheck\" logic added in 0860a7641ba (travis-ci: fail\nif Coccinelle static analysis found something to transform,\n2018-07-23) can be easily tested outside of CI, and likewise the\nsanity check added in 0e7696c64db (ci: disallow directional\nformatting, 2021-11-04).\n\nThese targets could be improved, the \"hdr-check\" target will re-do all\nof its work every time it's run, and could with a change similar to my\nc234e8a0ecf (Makefile: make the \"sparse\" target non-.PHONY,\n2021-09-23). The same goes for the new\n\"ci-check-directional-formatting\" target.\n\nBut without those improvements being able to easily run a 1=1\nequivalent of the checks we do in CI during a local build is already\nan improvement.\n\nThis change will also make the CI check faster, since we can take\nadvantage of parallelism across these \"make\" invocations. The \"make\ncoccicheck\" command in particular takes a long to finish its last job,\nat the end we might only have one job pegging 100% of one CPU\ncore. Now any extra cores will be free to run the rest of the targets\nunder \"ci-static-analysis\".\n\nBecause we're now going to invoke \"make\" directly from the CI recipe\nwe'll need to amend the new \"setenv\" wrapper to write the \"MAKEFLAGS\"\nand other variables to \"$GITHUB_ENV\".\n\nIn my testing the \"static-analysis\" job runs in just over 10 minutes\nwithout this change, but this change cuts just over a minute off the\nruntime.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml |  6 ++++--\n Makefile                   | 29 +++++++++++++++++++++++++++++\n ci/lib.sh                  |  7 ++++++-\n ci/run-static-analysis.sh  | 32 --------------------------------\n shared.mak                 |  1 +\n 5 files changed, 40 insertions(+), 35 deletions(-)\n delete mode 100755 ci/run-static-analysis.sh\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex 8b7697df9fb..fa6d861c75a 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -319,9 +319,11 @@ jobs:\n     runs-on: ubuntu-18.04\n     steps:\n     - uses: actions/checkout@v2\n+    - run: ci/lib.sh\n+      env:\n+        NO_CI_GROUPS: 1\n     - run: ci/install-dependencies.sh\n-    - run: ci/run-static-analysis.sh\n-    - run: ci/check-directional-formatting.bash\n+    - run: make ci-static-analysis\n   sparse:\n     needs: ci-config\n     if: needs.ci-config.outputs.enabled == 'yes'\ndiff --git a/Makefile b/Makefile\nindex 04d0fd1fe60..c328e190d64 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -3147,6 +3147,20 @@ coccicheck: $(addsuffix .patch,$(filter-out %.pending.cocci,$(wildcard contrib/c\n # See contrib/coccinelle/README\n coccicheck-pending: $(addsuffix .patch,$(wildcard contrib/coccinelle/*.pending.cocci))\n \n+.PHONY: check-coccicheck\n+check-coccicheck: coccicheck\n+\t$(QUIET_CHECK)for cocci_patch in contrib/coccinelle/*.patch; do \\\n+\t\tif test -s \"$$cocci_patch\"; then \\\n+\t\t\techo \"Coccinelle suggests the following changes in '$$cocci_patch':\"; \\\n+\t\t\tcat \"$$cocci_patch\"; \\\n+\t\t\tfail=UnfortunatelyYes; \\\n+\t\tfi \\\n+\tdone; \\\n+\tif test -n \"$$fail\"; then \\\n+\t\techo \"error: Coccinelle suggested some changes\"; \\\n+\t\texit 1; \\\n+\tfi\n+\n .PHONY: coccicheck coccicheck-pending\n \n ### Installation rules\n@@ -3589,3 +3603,18 @@ $(FUZZ_PROGRAMS): all\n \t\t$(XDIFF_OBJS) $(EXTLIBS) git.o $@.o $(LIB_FUZZING_ENGINE) -o $@\n \n fuzz-all: $(FUZZ_PROGRAMS)\n+\n+### CI \"check\" targets\n+#\n+# These targets are run from the CI, see .github/workflows/main.yml,\n+# but can also be run manually to run the same assertions locally.\n+\n+.PHONY: ci-check-directional-formatting\n+ci-check-directional-formatting:\n+\t$(QUIET_CHECK)ci/check-directional-formatting.bash\n+\n+.PHONY: ci-static-analysis\n+ci-static-analysis: ci-check-directional-formatting\n+ci-static-analysis: check-coccicheck\n+ci-static-analysis: hdr-check\n+ci-static-analysis: check-pot\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 67b7b32a0f1..14d0af2fa7f 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -15,7 +15,7 @@ then\n \texit 1\n fi\n \n-if test true != \"$GITHUB_ACTIONS\"\n+if test true != \"$GITHUB_ACTIONS\" || test -n \"$NO_CI_GROUPS\"\n then\n \tbegin_group () { :; }\n \tend_group () { :; }\n@@ -89,6 +89,11 @@ setenv () {\n \n \teval \"$key=\\\"$val\\\"\"\n \teval \"export $key\"\n+\teval \"export $key=\\\"$val\\\"\"\n+\tif test -n \"$GITHUB_ENV\"\n+\tthen\n+\t\techo \"$key=$val\" >>\"$GITHUB_ENV\"\n+\tfi\n }\n \n check_unignored_build_artifacts () {\ndiff --git a/ci/run-static-analysis.sh b/ci/run-static-analysis.sh\ndeleted file mode 100755\nindex faae31f0078..00000000000\n--- a/ci/run-static-analysis.sh\n+++ /dev/null\n@@ -1,32 +0,0 @@\n-#!/bin/sh\n-#\n-# Perform various static code analysis checks\n-#\n-\n-. ${0%/*}/lib.sh\n-\n-make coccicheck\n-\n-set +x\n-\n-fail=\n-for cocci_patch in contrib/coccinelle/*.patch\n-do\n-\tif test -s \"$cocci_patch\"\n-\tthen\n-\t\techo \"$(tput setaf 1)Coccinelle suggests the following changes in '$cocci_patch':$(tput sgr0)\"\n-\t\tcat \"$cocci_patch\"\n-\t\tfail=UnfortunatelyYes\n-\tfi\n-done\n-\n-if test -n \"$fail\"\n-then\n-\techo \"$(tput setaf 1)error: Coccinelle suggested some changes$(tput sgr0)\"\n-\texit 1\n-fi\n-\n-make hdr-check ||\n-exit 1\n-\n-make check-pot\ndiff --git a/shared.mak b/shared.mak\nindex 4330192e9c3..3bd846aaf9e 100644\n--- a/shared.mak\n+++ b/shared.mak\n@@ -58,6 +58,7 @@ ifndef V\n ## Used in \"Makefile\"\n \tQUIET_CC       = @echo '   ' CC $@;\n \tQUIET_AR       = @echo '   ' AR $@;\n+\tQUIET_CHECK    = @echo '   ' CHECK $@;\n \tQUIET_LINK     = @echo '   ' LINK $@;\n \tQUIET_BUILT_IN = @echo '   ' BUILTIN $@;\n \tQUIET_LNCP     = @echo '   ' LN/CP $@;\n-- \n2.37.1.996.g651fc6e809f\n\n"}]}